sysbench測試mysql oltp
以前在做mysql壓力測試的時候用的是jmeter,jmeter配置有點煩,最近嘗試用sysbench來進行mysql的壓力測試
下載最新版的sysbench
cd /usr/local/src
wget %3A%2F%2Fsourceforge.net%2Fprojects%2Fsysbench%2F&use_mirror=nchc
tar zxf sysbench-0.4.12.tar.gz
cd sysbench-0.4.12
找到mysql的庫檔案和標頭檔案所在的目錄
本文在/usr/local/mysql/lib和/usr/local/mysql/include下
./configure --prefix=/usr/local/sysbench --with-mysql-includes=/usr/local/mysql/include/mysql --with-mysql-libs=/usr/local/mysql/lib/mysql
配置後在sysbench-0.4.12下會生成libtool檔案,找到該檔案的ECHO="echo"行,將ECHO="echo"改成echo="echo",否則編譯的時候會出錯,提示libtool找不到檔案
make
make install
這樣sysbench安裝完成,在/usr/local/sysbench/bin下會生成sysbench檔案,為了測試方便,我做個軟連線
ln -s /usr/local/sysbench/bin/sysbench /bin/sysbench
在mysql中建立sbtest庫,並授予相關許可權
create database sbtest;
grant all privileges on sbtest.* to etnet@'local' identified by 'etnet';
flush privileges;
為測試準備資料
sysbench --test=oltp --db-driver=mysql --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-socket=/var/lib/mysql/mysql.sock --mysql-db=sbtest --mysql-host=localhost --mysql-user=etnet --mysql-password=etnet --num-threads=128 prepare
測試
sysbench --test=oltp --db-driver=mysql --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-socket=/var/lib/mysql/mysql.sock --mysql-db=sbtest --mysql-host=localhost --mysql-user=etnet --mysql-password=etnet --num-threads=128 run
清除資料
sysbench --test=oltp --db-driver=mysql --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-socket=/var/lib/mysql/mysql.sock --mysql-db=sbtest --mysql-host=localhost --mysql-user=etnet --mysql-password=etnet --num-threads=128 cleanup
sysbench具體的引數可以引數sysbench --test= help
--test可選項如下
Compiled-in tests:
fileio - File I/O test
cpu - CPU performance test
memory - Memory functions speed test
threads - Threads subsystem performance test
mutex - Mutex performance test
oltp - OLTP test
測試結果
[root@192 ~]# sysbench --test=oltp --db-driver=mysql --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-socket=/var/lib/mysql/mysql.sock --mysql-db=sbtest --mysql-host=localhost --mysql-user=etnet --mysql-password=etnet --num-threads=128 run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 128
Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 10000
Threads started!
Done.
OLTP test statistics:
queries performed:
read: 140000
write: 50000
other: 20000
total: 210000
transactions: 10000 (1051.37 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 190000 (19975.96 per sec.)
other operations: 20000 (2102.73 per sec.)
Test execution summary:
total time: 9.5114s
total number of events: 10000
total time taken by event execution: 1210.2339
per-request statistics:
min: 2.32ms
avg: 121.02ms
max: 412.67ms
approx. 95 percentile: 228.54ms
Threads fairness:
events (avg/stddev): 78.1250/5.17
execution time (avg/stddev): 9.4550/0.04
1051.37 per sec 為每秒事務量,19975.96 per sec 每秒的讀寫請求數,total time: 9.5114s 總的用時
下載最新版的sysbench
cd /usr/local/src
wget %3A%2F%2Fsourceforge.net%2Fprojects%2Fsysbench%2F&use_mirror=nchc
tar zxf sysbench-0.4.12.tar.gz
cd sysbench-0.4.12
找到mysql的庫檔案和標頭檔案所在的目錄
本文在/usr/local/mysql/lib和/usr/local/mysql/include下
./configure --prefix=/usr/local/sysbench --with-mysql-includes=/usr/local/mysql/include/mysql --with-mysql-libs=/usr/local/mysql/lib/mysql
配置後在sysbench-0.4.12下會生成libtool檔案,找到該檔案的ECHO="echo"行,將ECHO="echo"改成echo="echo",否則編譯的時候會出錯,提示libtool找不到檔案
make
make install
這樣sysbench安裝完成,在/usr/local/sysbench/bin下會生成sysbench檔案,為了測試方便,我做個軟連線
ln -s /usr/local/sysbench/bin/sysbench /bin/sysbench
在mysql中建立sbtest庫,並授予相關許可權
create database sbtest;
grant all privileges on sbtest.* to etnet@'local' identified by 'etnet';
flush privileges;
為測試準備資料
sysbench --test=oltp --db-driver=mysql --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-socket=/var/lib/mysql/mysql.sock --mysql-db=sbtest --mysql-host=localhost --mysql-user=etnet --mysql-password=etnet --num-threads=128 prepare
測試
sysbench --test=oltp --db-driver=mysql --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-socket=/var/lib/mysql/mysql.sock --mysql-db=sbtest --mysql-host=localhost --mysql-user=etnet --mysql-password=etnet --num-threads=128 run
清除資料
sysbench --test=oltp --db-driver=mysql --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-socket=/var/lib/mysql/mysql.sock --mysql-db=sbtest --mysql-host=localhost --mysql-user=etnet --mysql-password=etnet --num-threads=128 cleanup
sysbench具體的引數可以引數sysbench --test=
--test可選項如下
Compiled-in tests:
fileio - File I/O test
cpu - CPU performance test
memory - Memory functions speed test
threads - Threads subsystem performance test
mutex - Mutex performance test
oltp - OLTP test
測試結果
[root@192 ~]# sysbench --test=oltp --db-driver=mysql --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-socket=/var/lib/mysql/mysql.sock --mysql-db=sbtest --mysql-host=localhost --mysql-user=etnet --mysql-password=etnet --num-threads=128 run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 128
Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 10000
Threads started!
Done.
OLTP test statistics:
queries performed:
read: 140000
write: 50000
other: 20000
total: 210000
transactions: 10000 (1051.37 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 190000 (19975.96 per sec.)
other operations: 20000 (2102.73 per sec.)
Test execution summary:
total time: 9.5114s
total number of events: 10000
total time taken by event execution: 1210.2339
per-request statistics:
min: 2.32ms
avg: 121.02ms
max: 412.67ms
approx. 95 percentile: 228.54ms
Threads fairness:
events (avg/stddev): 78.1250/5.17
execution time (avg/stddev): 9.4550/0.04
1051.37 per sec 為每秒事務量,19975.96 per sec 每秒的讀寫請求數,total time: 9.5114s 總的用時
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27181165/viewspace-1064315/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 利用sysbench進行MySQL OLTP基準測試MySql
- sysbench 測試MySQLMySql
- 使用sysbench測試Mysql效能MySql
- MySQL基準測試工具sysbenchMySql
- Mysql 壓力測試工具sysbenchMySql
- 【Mysql】sysbench基準測試工具MySql
- 使用 sysbench 測試 MySQL 的效能MySql
- mysql效能測試工具之sysbench薦MySql
- 使用 sysbench 測試 MySQL 的效能(二)MySql
- 【MySQL】利用sysbench進行基準測試MySql
- 使用sysbench測試mysql及postgresql(完整版)MySql
- mysql ,tidb sysbench 測試結果記錄MySqlTiDB
- 詳解 MySQL 基準測試和 sysbench 工具MySql
- sysbench測試軟體
- mysql壓力測試在青雲PCIE盤sysbench版本MySql
- 使用Sysbench對滴滴雲MySQL進行基準測試MySql
- mysql之 sysbench0.4.12資料庫效能測試MySql資料庫
- MySQL DB Server 上面安裝 sysbench 作壓力測試MySqlServer
- MySQL壓力測試中定製sysbench的Lua模板MySql
- MySQL 效能壓測工具-sysbench,從入門到自定義測試項MySql
- mysql叢集壓力測試在京東雲盤:sysbench版本MySql
- mysql壓力測試在京東雲ssd雲盤sysbench版本MySql
- Kunlun-Storage vs PostgreSQL OLTP 測試SQL
- 通過sysbench工具實現MySQL資料庫的效能測試MySql資料庫
- mysql之 sysbench1.0.3 安裝與系統壓力測試MySql
- 【工具】基準測試工具之sysbench
- 資料庫基準測試工具 sysbench資料庫
- 使用 Sysbench 進行 Linux 效能測試Linux
- sysbench的安裝和做效能測試
- 使用sysbench壓力測試MySQL(一)(r11筆記第3天)MySql筆記
- Sysbench測試神器:一條命令生成百萬級測試資料
- 資料庫效能測試:sysbench用法詳解資料庫
- 壓測工具之Sysbench1.0(2_MySQL壓測)MySql
- KunlunDB 0.9.1版本Sysbench效能測試報告測試報告
- NewSQL資料庫壓力測試工具系列——SysbenchSQL資料庫
- 開源多執行緒效能測試工具-sysbench執行緒
- MySQL 5.7和8.0 MHA架構下sysbench壓測MySql架構
- 壓力測試sysbench安裝及引數介紹