Mysql Slave stuck in "System lock"
Databases running on distributed storage facepalm. I would benchmark the filesystem running on top of the EC2 EBS storage system. Probably the simplest method is to use something like s=$(date +%s); dd if=/dev/zero of=<database-dir> bs=1M count=512; e=$(date +%s); echo "scale=4; 512 / ( $e - $s )" | bc
. That assumes you have 512 MB to spare. Now, the problem with this benchmarking is that (1) it doesn't take into account caching effects, and (2) the resolution is not very fine. But if this test is slow, then the problem is definitely with EC2 EBS. If the test is fast or nominal, we have to dig further and use more sophisticated techniques.
The bonnie++ program is somewhat adequate, but it doesn't (AFAIK) flush the OS buffers between the write and read. Still, you should get an idea with something like bonnie++ -u mysql -r 8 -s 16:512 -n 1 -b -d <mysql-data-directory>
. When I do this on a VM running on local storage, I get:
Version 1.96 ------Sequential Output------ --Sequential Input- --Random-
Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size:chnk K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
test 16M:512 1173 99 +++++ +++ +++++ +++ 3187 99 +++++ +++ +++++ +++
Latency 1553us 23us 330us 750us 173us 6372us
Version 1.96 ------Sequential Create------ --------Random Create--------
test -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
1 1850 20 +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++
Latency 27428us 24us 1188us 30258us 36us 1107us
Here is what I get when running on a VM over NFS:
Version 1.96 ------Sequential Output------ --Sequential Input- --Random-
Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size:chnk K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
test 16M:512 1273 98 +++++ +++ +++++ +++ 3053 99 +++++ +++ +++++ +++
Latency 1372us 28us 380us 832us 19us 9473us
Version 1.96 ------Sequential Create------ --------Random Create--------
test -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
1 754 11 +++++ +++ 728 8 751 12 +++++ +++ 791 8
Latency 12695us 47us 5306us 3710us 30us 3278us