I'm giving a hands on presentation in a couple weeks. Part of this demo is for basic mysql trouble shooting including use of the slow query log. I've generated a database and installed our app but its a clean database and therefore difficult to generate enough problems.
I've tried the following to get queries in the slow query log:
Set slow query time to 1 second.
Deleted multiple indexes.
Stressed the system:
stress --cpu 100 --io 100 --vm 2 --vm-bytes 128M --timeout 1m
Scripted some basic webpage calls using wget.
None of this has generated slow queries. Is there another way of artificially stressing the database to generate problems? I don't have enough skills to write a complex Jmeter or other load generator. I'm hoping perhaps for something built into mysql or another linux trick beyond stress.
Totally artificial but you can use the
sleep()
function:In the log:
Checkout mysqlslap. You can pass one of your webapp's queries with --query and specify concurrent clients with --concurrency.
Perhaps de-tuning the database might help? For example reducing the key_buffers size?