Mysql stress test shell script Mysql comes with the stress test tool mysqlslap, so we don't have to write our own program to test the pressure on Mysql reading. The stress test shell script is as follows: www.2cto.com [plain] #! /Bin/sh while true do mysqlslap -- concurrency = 100 -- iterations = 10 -- create-schema = 'test' -- query = "insert into test (c1, c2, c3, c4) values (1, 1, 'A ') "-- number-of-queries = 200 -- debug-info-uroot-p123456 usleep 100 done www.2cto.com the script above indicates doing this cyclically every 100 MS: Simulating mysql clients, perform 200 inserts (number-of-queries = concurrency *) on the test table of the database test. Therefore, the number of queries per mysql client is twice ), iterations: 10. -- Debug-info: prints information about memory and CPU. Then we can write a shell script to output the number of mysql operations within the specified time interval (for example, 1 second). The shell script is as follows: [plain] #! /Bin/sh lastTimes = "0" while true do currentTimes = $ (mysql-uroot-p '000000'-e "show global status like 'com _ insert'" | sed' 1d '| awk' {print $2 }') times = $ (expr $ {currentTimes}-$ {lastTimes}) lastTimes = "$ {currentTimes}" echo "$ {times}" sleep 1 done views the number of mysql operations, you can view the variables starting with 'com _ 'in global status, which are mysql operation commands. For example, Com_insert is the INSERT command and Com_update is the update command, for more information, see the document description. Subtract the number of adjacent two times to obtain the number of executions within the interval. PS: In addition to commands such as iostat, you can also use the top command to view the io load (see the percentage of wait. If it is greater than or equal to the number of 1/cpu cores, it indicates that the hard disk IO is faulty ). Please refer to the English article: Understanding Disk I/O-when shoshould you be worried? Source http://blog.csdn.net/skyman_2001