当前位置:网站首页>Mysql database performance testing tool recommendation
Mysql database performance testing tool recommendation
2022-06-24 17:30:00 【Zezhongyun test】
One .sysbench How to use
Listed below sysbench Test the database mysql Common options for .
[[email protected] ~]# sysbench --help Usage: sysbench [options]... [test_lua] [lua_options] [command] Commands implemented by most tests: prepare run cleanup help General options : The values in the following brackets represent the default values --threads=N Specified number of threads [1] --events=N Limit the maximum number of requests ,0 Means unrestricted [0] --time=N Limit the maximum execution time ,0 Means unrestricted [10] --events and --time Choose one of them --forced-shutdown=STRING How long do I have to wait to close after the maximum execution time is reached sysbench off Indicates that the function is disabled [off] --thread-stack-size=SIZE The amount of stack space used by each thread [64K] --rate=N Average transaction rate ,0 Means unrestricted [0] --report-interval=N Report the results every few seconds ,0 Indicates that interval reporting is disabled [0] --config-file=FILENAME Read command line options from file --tx-rate=N obsolete , yes --rate Another name for [0] --max-requests=N obsolete , yes --events Another name for [0] --max-time=N obsolete , yes --time Another name for [0] --num-threads=N obsolete , yes --threads Another name for [1] --db-ps-mode=STRING Whether to use prepare Pattern statements {auto, disable} [auto] mysql Related options : --mysql-host=[LIST,...] MySQL server host [localhost] --mysql-port=[LIST,...] MySQL server port [3306] --mysql-socket=[LIST,...] MySQL socket --mysql-user=STRING MySQL user [sbtest] --mysql-password=STRING MySQL password [] --mysql-db=STRING MySQL database name [sbtest] --mysql-ignore-errors=[LIST,...] Error codes to ignore , The value can be "all" [1213,1020,1205] 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
among ,command Some have 4 class :prepare run cleanup and help:
prepare: Commands for preparing data . for example , stay sysbench Pressure test Before , You need to prepare the test library first 、 Test table and data in the test table . See the following text for specific usage .
run: Means to conduct a pressure test .
cleanup: Clear the data generated during the test .
help: Output given lua Help for scripts .
test_lua Is what you want to use lua Script , If it is rpm Packages installed sysbench, Then these scripts are /usr/share/sysbench Under the table of contents . For general database testing , Just use and oltp Relevant lua Script is enough .
options and lua_options Is different ,options yes sysbench The option to ,lua_options yes lua Script options ,lua_options It should be placed in test_lua Behind ( Non essential , But the advice ).
for example , To see oltp_common.lua Usage of , Sure :
sysbench /usr/share/sysbench/oltp_common.lua help
Two . Prepare test data
First create sysbench Required database sbtest( This is a sysbench Default library name , You must create a test library ).
mysqladmin -h127.0.0.1 -uroot [email protected]! -P3306 create sbtest;
then , Prepare the table for the test , These test tables are in the test library sbtest in . the lua The script is /usr/share/sysbench/oltp_common.lua.
sysbench --mysql-host=127.0.0.1 \ --mysql-port=3306 \ --mysql-user=root \ [email protected]! \ /usr/share/sysbench/oltp_common.lua \ --tables=10 \ --table_size=100000 \ prepare
among --tables=10 Representation creation 10 A test table ,--table_size=100000 Means insert... In each table 10W Row data ,prepare It means that this is the process of preparing numbers .
mysql> show tables from sbtest; +------------------+ | Tables_in_sbtest | +------------------+ | sbtest1 | | sbtest10 | | sbtest2 | | sbtest3 | | sbtest4 | | sbtest5 | | sbtest6 | | sbtest7 | | sbtest8 | | sbtest9 | +------------------+ mysql> select count(*) from sbtest.sbtest1; +----------+ | count(*) | +----------+ | 100000 | +----------+
If you want to clear this 10 Tables , You can use cleanup command .
sysbench --mysql-host=127.0.0.1 \ --mysql-port=3306 \ --mysql-user=root \ [email protected]! \ /usr/share/sysbench/oltp_common.lua \ --tables=10 \ cleanup
3、 ... and . Database test and result analysis
Attention should be paid to the lua The script is oltp_common.lua, It is a generic script , By others lua The script calls , Can't test directly .
So here we use oltp_read_write.lua Script to do reading 、 Write tests . There are many other types of tests , For example, read-only test 、 Write only tests 、 Delete the test 、 Mass insert testing and so on . You can find the corresponding lua The script can be called .
sysbench --threads=4 \ --time=20 \ --report-interval=5 \ --mysql-host=127.0.0.1 \ --mysql-port=3306 \ --mysql-user=root \ [email protected]! \ /usr/share/sysbench/oltp_read_write.lua \ --tables=10 \ --table_size=100000 \ run
The following is the result of the test :
Initializing worker threads... Threads started! [ 5s ] thds: 4 tps: 130.16 qps: 2606.30 (r/w/o: 1824.51/520.66/261.13) lat (ms,95%): 104.84 err/s: 0.00 reconn/s: 0.00 [ 10s ] thds: 4 tps: 126.74 qps: 2539.17 (r/w/o: 1778.17/507.52/253.47) lat (ms,95%): 108.68 err/s: 0.00 reconn/s: 0.00 [ 15s ] thds: 4 tps: 136.54 qps: 2736.34 (r/w/o: 1915.25/548.01/273.07) lat (ms,95%): 102.97 err/s: 0.00 reconn/s: 0.00 [ 20s ] thds: 4 tps: 107.44 qps: 2148.65 (r/w/o: 1505.60/428.17/214.89) lat (ms,95%): 132.49 err/s: 0.00 reconn/s: 0.00 SQL statistics: queries performed: read: 35098 # Number of read operations performed write: 10028 # Number of write operations performed other: 5014 # Number of other operations performed total: 50140 transactions: 2507 (124.29 per sec.) # Average rate of transaction execution queries: 50140 (2485.82 per sec.) # How many queries can be executed per second on average ignored errors: 0 (0.00 per sec.) reconnects: 0 (0.00 per sec.) General statistics: total time: 20.1694s # Total time consumed total number of events: 2507 # Total number of requests ( read 、 Write 、 Other ) Latency (ms): min: 2.32 avg: 32.13 max: 575.78 95th percentile: 118.92 # Average delay of sampling calculation sum: 80554.96 Threads fairness: events (avg/stddev): 626.7500/2.49 execution time (avg/stddev): 20.1387/0.04
Four .cpu/io/ Memory and other tests
sysbench Built in several test indicators
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
Directly help Output test method . for example ,fileio test .
[[email protected] ~]# sysbench fileio help sysbench 1.0.15 (using bundled LuaJIT 2.1.0-beta2) fileio options: --file-num=N number of files to create [128] --file-block-size=N block size to use in all IO operations [16384] --file-total-size=SIZE total size of files to create [2G] --file-test-mode=STRING test mode {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw} --file-io-mode=STRING file operations mode {sync,async,mmap} [sync] --file-async-backlog=N number of asynchronous operatons to queue per thread [128] --file-extra-flags=[LIST,...] list of additional flags to use to open files {sync,dsync,direct} [] --file-fsync-freq=N do fsync() after this number of requests (0 - don't use fsync()) [100] --file-fsync-all[=on|off] do fsync() after each write operation [off] --file-fsync-end[=on|off] do fsync() at the end of test [on] --file-fsync-mode=STRING which method to use for synchronization {fsync, fdatasync} [fsync] --file-merged-requests=N merge at most this number of IO requests if possible (0 - don't merge) [0] --file-rw-ratio=N reads/writes ratio for combined test [1.5]
for example , establish 5 File , in total 1G, Each file is about 200M.
sysbench fileio --file-num=5 --file-total-size=1G prepare [[email protected] ~]# ls -lh test* -rw------- 1 root root 205M Jul 8 12:15 test_file.0 -rw------- 1 root root 205M Jul 8 12:15 test_file.1 -rw------- 1 root root 205M Jul 8 12:15 test_file.2 -rw------- 1 root root 205M Jul 8 12:15 test_file.3 -rw------- 1 root root 205M Jul 8 12:15 test_file.4
then , Run the test .
sysbench --events=5000 \ --threads=16 \ fileio \ --file-num=5 \ --file-total-size=1G \ --file-test-mode=rndrw \ --file-fsync-freq=0 \ --file-block-size=16384 \ run
result : Test and analysis
File operations: reads/s: 98.67 writes/s: 66.85 fsyncs/s: 6.26 Throughput: # throughput read, MiB/s: 1.54 # Indicates the read bandwidth written, MiB/s: 1.04 # Indicates the read bandwidth General statistics: total time: 12.7426s total number of events: 2117 Latency (ms): min: 0.00 avg: 86.66 max: 2919.41 95th percentile: 646.19 sum: 183460.80 Threads fairness: events (avg/stddev): 132.3125/24.19 execution time (avg/stddev): 11.4663/1.09
Compare again cpu Performance testing :
[[email protected] ~]# sysbench cpu --threads=40 --events=10000 --cpu-max-prime=20000 run sysbench 1.0.15 (using bundled LuaJIT 2.1.0-beta2) Running the test with following options: Number of threads: 40 Initializing random number generator from current time Prime numbers limit: 20000 Initializing worker threads... Threads started! CPU speed: events per second: 2127.81 General statistics: total time: 4.6986s total number of events: 10000 Latency (ms): min: 1.72 avg: 18.16 max: 302.17 95th percentile: 110.66 sum: 181628.49 Threads fairness: events (avg/stddev): 250.0000/30.81 execution time (avg/stddev): 4.5407/0.10
边栏推荐
- "Gambler" bubble Matt turns around
- Install Clickhouse client code 210 connection referred (localhost:9000)
- Tiktok Kwai, e-commerce enters the same river
- Cloud native monitoring via blackbox_ Exporter monitoring website
- Zblog system realizes the tutorial of the number of articles published on the same day when the foreground calls
- 主链系统发展解析
- Yupi made an AI programming nickname generator!
- Devops in digital transformation digital risk
- Leveldb source code analysis -- open the database
- Leveldb source code analysis -- version management
猜你喜欢

MySQL learning -- table structure of SQL test questions

Mengyou Technology: tiktok current limiting? Teach you to create popular copywriting + popular background music selection

Etching process flow for PCB fabrication

Why do you develop middleware when you are young? "You can choose your own way"

LC 300. Longest increasing subsequence
Using consistent hash algorithm in Presto to enhance the data cache locality of dynamic clusters
随机推荐
Explanation of pod DNS configuration & cases of DNS resolution failure
[play Tencent cloud] experience and development of game multimedia engine (II)
Service not found troubleshooting and resolution of error messages in the secondary development of the source code of the open source platform easydarwin
跟着Vam一起学习Typescript(第一期)
[log service CLS] Tencent cloud game battle engine mgobe accesses CLS
Etching process flow for PCB fabrication
Analysis and introduction of NFT meta universe source code construction
Introduction to visual studio shortcut keys and advanced gameplay
New MySQL 8.0 feature - enhanced logical backup recovery
On N handshakes and M waves of TCP
Will the easycvr video channel of the urban intelligent video monitoring image analysis platform occupy bandwidth after stopping playing?
Tencent security officially released the IOT security capability map
March 27, 2021: give you a head node of the linked list, and rotate the linked list
Elastic searchable snapshot function (frozen Tier 3)
Fragment usage
FPGA systematic learning notes serialization_ Day8 [design of 4-bit multiplier and 4-bit divider]
Several cloud products of Tencent cloud have passed IPv6 enabled cloud logo certification
Zblog system realizes the tutorial of the number of articles published on the same day when the foreground calls
How to use SEO to increase the inquiry volume?
Analysis of signal preemptive scheduling based on go language from source code