中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

PostgreSQL DBA(8) - sysbench簡介

發布時間:2020-08-04 22:11:14 來源:ITPUB博客 閱讀:144 作者:husthxd 欄目:關系型數據庫

pgbench是一款開源的基準測試工具,支持多線程和多種數據庫(包括MySQL、PostgreSQL等);通過測試可衡量操作系統的CPU、磁盤IO、內存、POSIX線程性能和數據庫性能。

一、安裝

下載sysbench,當前最新版本是1.0.15

cd /tmp/install
wget https://github.com/akopytov/sysbench/archive/1.0.15.zip -O "sysbench-1.0.15.zip"
unzip sysbench-1.0.15.zip
cd sysbench-1.0.15

執行安裝

yum install automake libtool mysql-devel postgresql-devel –y
./autogen.sh
./configure --with-pgsql --with-pgsql-includes=/appdb/atlasdb/pg11beta2/include  --with-pgsql-libs=/appdb/atlasdb/pg11beta2/lib
make
make install 

安裝成功

[root@localhost sysbench-1.0.15]# sysbench --version
sysbench 1.0.15

二、參數說明

通過sysbench --help命令可以查看詳細的參數設置.

[root@localhost include]# sysbench --help
Usage:
  sysbench [options]... [testname] [command]

Commands implemented by most tests: prepare run cleanup help

General options:
  --threads=N                     number of threads to use [1]
...  

其中:
oltp-tables-count
生成測試數據表數量

--threads=N
sysbench使用的工作線程數

--time=N
執行時長,以秒為單位

--report-interval=N
報告間隔,以秒為單位

--config-file=FILENAME
配置文件

--db-driver=STRING
數據庫驅動mysql/pgsql

pgsql options:
--pgsql-host=STRING PostgreSQL server host [localhost]
--pgsql-port=N PostgreSQL server port [5432]
--pgsql-user=STRING PostgreSQL user [sbtest]
--pgsql-password=STRING PostgreSQL password []
--pgsql-db=STRING PostgreSQL database name [sbtest]

三、基本使用

連接數據庫,創建測試數據庫sysbench

$createdb sysbench

準備階段
執行以下命令,sysbench執行自帶的測試腳本

sysbench /usr/local/share/sysbench/tests/include/oltp_legacy/oltp.lua \
--oltp-tables-count=10 --oltp-table-size=500000 \
--db-driver=pgsql --pgsql-host=192.168.26.103 --pgsql-port=5432 \
--pgsql-user=atlasdb --pgsql-db=sysbench \
prepare

命令輸出

Creating table 'sbtest1'...
Inserting 500000 records into 'sbtest1'
Creating secondary indexes on 'sbtest1'...
Creating table 'sbtest2'...
Inserting 500000 records into 'sbtest2'
Creating secondary indexes on 'sbtest2'...
Creating table 'sbtest3'...
Inserting 500000 records into 'sbtest3'
Creating secondary indexes on 'sbtest3'...
Creating table 'sbtest4'...
Inserting 500000 records into 'sbtest4'
Creating secondary indexes on 'sbtest4'...
Creating table 'sbtest5'...
Inserting 500000 records into 'sbtest5'
Creating secondary indexes on 'sbtest5'...
Creating table 'sbtest6'...
Inserting 500000 records into 'sbtest6'
Creating secondary indexes on 'sbtest6'...
Creating table 'sbtest7'...
Inserting 500000 records into 'sbtest7'
Creating secondary indexes on 'sbtest7'...
Creating table 'sbtest8'...
Inserting 500000 records into 'sbtest8'
Creating secondary indexes on 'sbtest8'...
Creating table 'sbtest9'...
Inserting 500000 records into 'sbtest9'
Creating secondary indexes on 'sbtest9'...
Creating table 'sbtest10'...
Inserting 500000 records into 'sbtest10'
Creating secondary indexes on 'sbtest10'..

運行基準測試

sysbench /usr/local/share/sysbench/tests/include/oltp_legacy/oltp.lua \
--report-interval=5 \
--threads=4 --time=120 --db-driver=pgsql --pgsql-host=192.168.26.103 --pgsql-port=5432 \
--pgsql-user=atlasdb --pgsql-db=sysbench \
run

執行完畢,4線程的執行過程和結果如下:

sysbench 1.0.15 (using bundled LuaJIT 2.1.0-beta2)

Running the test with following options:
Number of threads: 4
Report intermediate results every 5 second(s)
Initializing random number generator from current time


Initializing worker threads...

Threads started!

[ 5s ] thds: 4 tps: 107.50 qps: 2160.56 (r/w/o: 1513.97/430.79/215.80) lat (ms,95%): 51.94 err/s: 0.00 reconn/s: 0.00
[ 10s ] thds: 4 tps: 80.79 qps: 1611.00 (r/w/o: 1126.26/323.16/161.58) lat (ms,95%): 71.83 err/s: 0.00 reconn/s: 0.00
[ 15s ] thds: 4 tps: 105.45 qps: 2114.74 (r/w/o: 1482.66/421.19/210.89) lat (ms,95%): 61.08 err/s: 0.00 reconn/s: 0.00
...
[ 120s ] thds: 4 tps: 88.00 qps: 1762.33 (r/w/o: 1232.95/353.39/175.99) lat (ms,95%): 77.19 err/s: 0.00 reconn/s: 0.00
SQL statistics:
    queries performed:
        read:                            181496
        write:                           51856
        other:                           25928
        total:                           259280
    transactions:                        12964  (108.00 per sec.)
    queries:                             259280 (2160.08 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          120.0312s
    total number of events:              12964

Latency (ms):
         min:                                   18.34
         avg:                                   37.02
         max:                                  122.90
         95th percentile:                       58.92
         sum:                               479962.76

Threads fairness:
    events (avg/stddev):           3241.0000/6.96
    execution time (avg/stddev):   119.9907/0.01

四、參考資料

How to Benchmark Performance of MySQL & MariaDB using SysBench
How to Benchmark PostgreSQL Performance Using Sysbench

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

衡阳县| 怀化市| 宜兴市| 壤塘县| 兰溪市| 汤原县| 莫力| 吉林市| 鲁山县| 临潭县| 东辽县| 临武县| 巴里| 曲松县| 乌拉特中旗| 万年县| 金塔县| 长垣县| 兴和县| 微山县| 淳安县| 龙海市| 长海县| 衡东县| 博野县| 抚宁县| 蕉岭县| 柏乡县| 大厂| 凯里市| 陆河县| 上犹县| 沧州市| 长武县| 衢州市| 山阳县| 晋中市| 石狮市| 冕宁县| 达拉特旗| 招远市|