sysbench-system, database stress test Tool

Source: Internet
Author: User
Tags lua

Sysbench is an easy-to-use stress testing tool that can test the CPU,MEMORY,FILEIO,MYSQL database;

Sysbench Installation Method:

The sysbench in the default Epel source is version 0.4 and is now in the 1.x version, and the master uses the 1.x version

Github-->https://github.com/akopytov/sysbench

CentOS Installation Method:

#curl-S Https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash #sudo yum-y install Sysbench

Important files after the installation is complete:

Files for the database stress test:

    /usr/share/sysbench/bulk_insert.lua
    /usr/share/sysbench/ Oltp_common.lua
    /usr/share/sysbench/oltp_delete.lua    #数据库删除测试文件
    /usr/share/sysbench/oltp_insert.lua     #数据库插入测试文件
     /usr/share/sysbench/oltp_point_select.lua
    /usr/share/sysbench/oltp_read _only.lua #数据库读测试文件
    /usr/share/sysbench/oltp_read_write.lua# Database read-write test file
    /usr/share/sysbench/oltp_update_index.lua
    /usr/share/sysbench/oltp_ Update_non_index.lua
    /usr/share/sysbench/oltp_write_only.lua #数据库写测试文件
     /usr/share/sysbench/select_random_points.lua
    /usr/share/sysbench/ Select_random_ranges.lua
Start database test:

Database testing is divided into 3 steps: Prepare (prepare test data), run (start test), Cleanup (clear test data)

The relevant parameters to use:

--db-driver=mysql
--mysql-host=localhost
--mysql-port=3306
--mysql-socket=/tmp/mysql.sock
--mysql-user=root
--mysql-password=123456
--mysql-db=sysbench
--tables=10
--table-size=500000
--report-interval=10
--time=120
--threads=50

Parameter resolution:

--db-driver: The type of database used

--mysql-host: IP of the database

--mysql-port: Port of the database

Path of the--mysql-socket:socket

--mysql-user: Database user name

--mysql-password: User Password

--MYSQL-DB: Database name, default is Sysbench, need to create well in advance

--tables: Number of tables generated

--table-size: Number of rows per table

--report-interval: How often do you print a message at the screen every

--time: Measuring Time

--threads: How many threads are started, that is, how many users are impersonated

To prepare the test data:

Sysbench/usr/share/sysbench/oltp_read_only.lua--db-driver=mysql--mysql-host=localhost--mysql-port=3306-- Mysql-socket=/tmp/mysql.sock--mysql-user=root--mysql-password=123456--mysql-db=sysbench--tables=10--table-size =500000--report-interval=10--time=120--threads=50 Prepare

Database for pressure measurement:

#读测试sysbench  /usr/share/sysbench/oltp_read_only.lua --db-driver=mysql --mysql-host=localhost  --mysql-port=3306 --mysql-socket=/tmp/mysql.sock --mysql-user=root --mysql-password= 123456 --mysql-db=sysbench --tables=10 --table-size=500000 --report-interval=10   --time=120 --threads=50 run# read-write test sysbench /usr/share/sysbench/oltp_read_write.lua -- db-driver=mysql --mysql-host=localhost --mysql-port=3306 --mysql-socket=/tmp/mysql.sock -- Mysql-user=root --mysql-password=123456 --mysql-db=sysbench --tables=10 --table-size= 500000 --report-interval=10  --time=120 --threads=50 run# Other Diagnostic Analogies # Read test results, simulate 320 users [  11s ] thds: 320 tps: 242.69 qps: 4209.17  (r/w/o: 3694.35/0.00/ 514.83)  lat  (ms,95%):  1678.14 err/s: 0.00 reconn/s: 0.00[ 21s ]  thds: 320 tps: 187.49 qps: 2996.82  (r/w/o: 2621.44/0.00/375.38)  lat  (ms,95%):  2120.76  err/s: 0.00 reconn/s: 0.00[ 31s ] thds: 320 tps: 229.77  qps: 3649.12  (r/w/o: 3190.18/0.00/458.94)  lat  (ms,95%):  2159.29 err/s :  0.00 reconn/s: 0.00[ 41s ] thds: 320 tps: 259.54 qps:  4175.73  (r/w/o: 3656.75/0.00/518.98)  lat  (ms,95%): 1803.47 err/s:  0.00 reconn/s: 0.00[ 51s ] thds: 320 tps: 276.39 qps:  4406.96  (r/w/o: 3853.68/0.00/553.28)  lat  (ms,95%):  1589.90 err/s: 0.00  reconn/s: 0.00[ 61s ] thds: 320 tps: 281.21 qps: 4496.82   (r/w/o: 3934.29/0.00/562.53)  lat  (ms,95%):  1561.52 err/s: 0.00 reconn /s: 0.00[ 71s ] thds: 320 tps: 276.10 qps: 4435.70  (r/w/o: 3883.80/0.00/551.90)  lat  (ms,95%):  1648.20 err/s: 0.00 reconn/s: 0.00[ 81s ] thds: 320  tps: 275.19 qps: 4392.43  (r/w/o: 3841.85/0.00/550.58)  lat  (ms,95%):  1618.78 err/s: 0.00 reconn/s: 0.00[ 91s ] thds: 320 tps:  280.39 qps: 4491.68  (r/w/o: 3931.19/0.00/560.48)  lat  (ms,95%):  1589.90 err/s: 0.00 reconn/s: 0.00[ 101s ] thds: 320 tps:  270.71 qps: 4334.41  (r/w/o: 3792.58/0.00/541.83)  lat  (ms,95%):  1678.14  err/s: 0.00 reconn/s: 0.00[ 111s ] thds: 320 tps: 256.68  qps: 4100.25  (r/w/o: 3587.18/0.00/513.07)  lat  (ms,95%):  1771.29 err/s :  0.00 reconn/s: 0.00[ 121s ] thds: 320 tps: 261.12 qps: 4087.48  (r/w/o: 3578.23 /0.00/509.25)  lat  (ms,95%): 1708.63 err/s: 0.00 reconn/s: 0.00sql  Statistics:    queries performed:        read :                             438242         write:                            0         other:                            62606         total:                            500848    transactions:                          31303   (258.37 per sec.)     queries:                              500848  ( 4133.87 per sec.)     ignored errors:                       0       (0.00  per sec.)     reconnects:                           0       (0.00  Per sec.) general statistics:    total time:                            121.1541s    total number of events:               31303Latency  (MS):          min:                                  124.29         avg:                                 1232.39         max:                                 3681.62          95th percentile:                    1836.24         sum:                              38577567.35Threads fairness:     events  (Avg/stddev):            97.8219/1.70     execution time  (Avg/stddev):    120.5549/0.33

To delete test data:

Sysbench/usr/share/sysbench/oltp_read_write.lua--db-driver=mysql--mysql-host=localhost--mysql-port=3306-- Mysql-socket=/tmp/mysql.sock--mysql-user=root--mysql-password=123456--mysql-db=sysbench--tables=10--table-size =500000--report-interval=10--time=120--threads=50 cleanup



This article is from the "burning Years of Passion" blog, please be sure to keep this source http://liuzhengwei521.blog.51cto.com/4855442/1923795

sysbench-system, database stress test Tool

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.