MYSQL性能测试工具SYSBENCH

[root@localhost ~]$ wget https://github.com/akopytov/sysbench/archive/1.0.zip -O "sysbench-1.0.zip"
--2019-04-25 15:49:16--  https://github.com/akopytov/sysbench/archive/1.0.zip
Resolving github.com (github.com)... 13.229.188.59, 52.74.223.119, 13.250.177.223
Connecting to github.com (github.com)|13.229.188.59|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/akopytov/sysbench/zip/1.0 [following]
--2019-04-25 15:49:17--  https://codeload.github.com/akopytov/sysbench/zip/1.0
Resolving codeload.github.com (codeload.github.com)... 54.251.140.56, 13.250.162.133, 13.229.189.0
Connecting to codeload.github.com (codeload.github.com)|54.251.140.56|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/zip]
Saving to: ‘sysbench-1.0.zip’
 
    [                                                         <=>                                                                                                             ] 2,291,660    149KB/s   in 13s    
 
2019-04-25 15:49:31 (171 KB/s) - ‘sysbench-1.0.zip’ saved [2291660]
 
[root@localhost ~]$ unzip -q sysbench-1.0.zip 
[root@localhost ~]$ cd sysbench-1.0
[root@localhost ~/sysbench-1.0]$ yum install automake libtool –y
( many more lines suppressed )
 
[root@localhost ~/sysbench-1.0]$ ./autogen.sh
./autogen.sh: running `libtoolize --copy --force' 
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'config'.
 
( many more lines suppressed )
 
src/Makefile.am: installing 'config/depcomp'
parallel-tests: installing 'config/test-driver'
./autogen.sh: running `autoconf' 
Libtoolized with: libtoolize (GNU libtool) 2.4.6
Automade with: automake (GNU automake) 1.13.4
Configured with: autoconf (GNU Autoconf) 2.69
[root@localhost ~/sysbench-1.0]$ ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
 
( many more lines suppressed )
 
Concurrency Kit    : bundled
CK_CFLAGS          : -I$(abs_top_builddir)/third_party/concurrency_kit/include
CK_LIBS            : $(abs_top_builddir)/third_party/concurrency_kit/lib/libck.a
configure flags    : 
===============================================================================
 
[root@localhost ~/sysbench-1.0]$ make
Making all in doc
make[1]: Entering directory `/root/sysbench-1.0/doc'
Making all in xsl
make[2]: Entering directory `/root/sysbench-1.0/doc/xsl'
 
( many more lines suppressed )
 
make[1]: Entering directory `/root/sysbench-1.0'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/root/sysbench-1.0'
[root@localhost ~/sysbench-1.0]$ make install
Making install in doc
make[1]: Entering directory `/root/sysbench-1.0/doc'
Making install in xsl
make[2]: Entering directory `/root/sysbench-1.0/doc/xsl'
make[3]: Entering directory `/root/sysbench-1.0/doc/xsl'
 
( many more lines suppressed )
 
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/root/sysbench-1.0'
make[1]: Leaving directory `/root/sysbench-1.0'
[root@localhost ~/sysbench-1.0]$ sysbench --version
sysbench: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory
[root@localhost /usr/local/mysql/lib]$  export LD_LIBRARY_PATH=/usr/local/mysql/lib
[root@localhost /usr/local/mysql/lib]$ sysbench --version
sysbench 1.0.17
[root@localhost /usr/local/mysql/lib]$ cd
[root@localhost ~]$ ls
dbdump.db  sysbench-1.0  sysbench-1.0.zip
[root@localhost ~]$ cd sysbench-1.0/
[root@localhost ~/sysbench-1.0]$ mysqladmin create sbtest -uroot -p
Enter password: 
[root@localhost ~/sysbench-1.0]$ sysbench ./tests/include/oltp_legacy/oltp.lua --mysql-host=localhost --mysql-port=3306 --mysql-user=root --mysql-password=mysql --oltp-test-mode=complex --oltp-tables-count=10 --oltp-table-size=100000 --threads=10 --time=120 --report-interval=10 prepare
sysbench 1.0.17 (using bundled LuaJIT 2.1.0-beta2)
 
Creating table 'sbtest1'...
Inserting 100000 records into 'sbtest1'
Creating secondary indexes on 'sbtest1'...
Creating table 'sbtest2'...
Inserting 100000 records into 'sbtest2'
Creating secondary indexes on 'sbtest2'...
Creating table 'sbtest3'...
Inserting 100000 records into 'sbtest3'
Creating secondary indexes on 'sbtest3'...
Creating table 'sbtest4'...
Inserting 100000 records into 'sbtest4'
Creating secondary indexes on 'sbtest4'...
Creating table 'sbtest5'...
Inserting 100000 records into 'sbtest5'
Creating secondary indexes on 'sbtest5'...
Creating table 'sbtest6'...
Inserting 100000 records into 'sbtest6'
Creating secondary indexes on 'sbtest6'...
Creating table 'sbtest7'...
Inserting 100000 records into 'sbtest7'
Creating secondary indexes on 'sbtest7'...
Creating table 'sbtest8'...
Inserting 100000 records into 'sbtest8'
Creating secondary indexes on 'sbtest8'...
Creating table 'sbtest9'...
Inserting 100000 records into 'sbtest9'
Creating secondary indexes on 'sbtest9'...
Creating table 'sbtest10'...
Inserting 100000 records into 'sbtest10'
Creating secondary indexes on 'sbtest10'...
[root@localhost ~/sysbench-1.0]$ cd
[root@localhost ~]$ touch tmp.log.sysbench
[root@localhost ~]$ ls
dbdump.db  sysbench-1.0  sysbench-1.0.zip  tmp.log.sysbench
[root@localhost ~]$ cd sysbench-1.0/
[root@localhost ~/sysbench-1.0]$ sysbench ./tests/include/oltp_legacy/oltp.lua --mysql-host=localhost --mysql-port=3306 --mysql-user=root --mysql-password=mysql --oltp-test-mode=complex --oltp-tables-count=10 --oltp-table-size=100000 --threads=10 --time=120 --report-interval=10 run >> /root/tmp.log.sysbench
[root@localhost ~/sysbench-1.0]$  sysbench ./tests/include/oltp_legacy/oltp.lua --mysql-host=localhost --mysql-port=3306 --mysql-user=root --mysql-password=mysql cleanup
sysbench 1.0.17 (using bundled LuaJIT 2.1.0-beta2)
 
Dropping table 'sbtest1'...
[root@localhost ~/sysbench-1.0]$ cd       
[root@localhost ~]$ cat tmp.log.sysbench 
WARNING: --num-threads is deprecated, use --threads instead
WARNING: --max-time is deprecated, use --time instead
sysbench 1.0.17 (using bundled LuaJIT 2.1.0-beta2)
 
FATAL: Cannot find benchmark 'oltp': no such built-in test, file or module
sysbench 1.0.17 (using bundled LuaJIT 2.1.0-beta2)
 
Running the test with following options:
Number of threads: 10
Report intermediate results every 10 second(s)
Initializing random number generator from current time
 
 
Initializing worker threads...
 
Threads started!
 
[ 10s ] thds: 10 tps: 601.84 qps: 12049.64 (r/w/o: 8436.69/2408.27/1204.68) lat (ms,95%): 29.72 err/s: 0.10 reconn/s: 0.00
[ 20s ] thds: 10 tps: 710.18 qps: 14200.78 (r/w/o: 9939.40/2841.02/1420.36) lat (ms,95%): 22.69 err/s: 0.00 reconn/s: 0.00
[ 30s ] thds: 10 tps: 716.51 qps: 14335.45 (r/w/o: 10035.90/2866.53/1433.02) lat (ms,95%): 21.50 err/s: 0.00 reconn/s: 0.00
[ 40s ] thds: 10 tps: 754.00 qps: 15077.41 (r/w/o: 10554.31/3015.10/1508.00) lat (ms,95%): 20.37 err/s: 0.00 reconn/s: 0.00
[ 50s ] thds: 10 tps: 700.58 qps: 14010.19 (r/w/o: 9807.18/2801.84/1401.17) lat (ms,95%): 22.69 err/s: 0.00 reconn/s: 0.00
[ 60s ] thds: 10 tps: 719.10 qps: 14388.35 (r/w/o: 10073.03/2876.91/1438.40) lat (ms,95%): 21.89 err/s: 0.10 reconn/s: 0.00
[ 70s ] thds: 10 tps: 678.72 qps: 13573.33 (r/w/o: 9500.63/2715.27/1357.43) lat (ms,95%): 23.95 err/s: 0.10 reconn/s: 0.00
[ 80s ] thds: 10 tps: 657.61 qps: 13152.83 (r/w/o: 9206.76/2630.75/1315.32) lat (ms,95%): 25.28 err/s: 0.00 reconn/s: 0.00
[ 90s ] thds: 10 tps: 664.21 qps: 13289.77 (r/w/o: 9302.32/2659.03/1328.42) lat (ms,95%): 24.83 err/s: 0.00 reconn/s: 0.00
[ 100s ] thds: 10 tps: 732.88 qps: 14654.96 (r/w/o: 10259.69/2929.21/1466.06) lat (ms,95%): 20.74 err/s: 0.30 reconn/s: 0.00
[ 110s ] thds: 10 tps: 740.67 qps: 14814.08 (r/w/o: 10370.03/2962.60/1481.45) lat (ms,95%): 20.74 err/s: 0.10 reconn/s: 0.00
[ 120s ] thds: 10 tps: 649.06 qps: 12982.91 (r/w/o: 9088.55/2596.54/1297.82) lat (ms,95%): 26.20 err/s: 0.10 reconn/s: 0.00
SQL statistics:
    queries performed:
        read:                            1165836
        write:                           333068
        other:                           166540
        total:                           1665444
    transactions:                        83266  (693.79 per sec.)
    queries:                             1665444 (13876.86 per sec.)
    ignored errors:                      8      (0.07 per sec.)
    reconnects:                          0      (0.00 per sec.)
 
General statistics:
    total time:                          120.0144s
    total number of events:              83266
 
Latency (ms):
         min:                                    3.66
         avg:                                   14.41
         max:                                  118.63
         95th percentile:                       23.52
         sum:                              1199489.04
 
Threads fairness:
    events (avg/stddev):           8326.6000/59.57
    execution time (avg/stddev):   119.9489/0.01
原文地址:https://www.cnblogs.com/yongestcat/p/11248503.html