本文主要描述了对本地磁盘(普通raid存储,具体不详)与LSI闪存卡性能测试的对比 及 测试结果,共大家参考。
欢迎转载,请注明作者、出处。
Sysbench测试:
测试环境:
工具:sysbench 0.4.12
Mysql 5.6.15
Innodb buffer pool:2G
本次测试,数据量:11.7G
注:以下所提及到的本地硬盘,为raid存储划分到本地的空间。
准备数据:
sysbench --debug=off --test=oltp --mysql-table-engine=innodb --oltp-table-size=50000000 --mysql-user=root --mysql-password=mysql --mysql-socket=/lsi/mysql/mysql.sock prepare
说明:模拟OLTP操作,数据量5000万行,每行记录252Byte。
LSI:
sysbench --num-threads=256 --test=oltp --mysql-user=root --mysql-password=mysql --mysql-table-engine=innodb --init-rng=on --oltp-table-size=50000000 --max-time=$RT --max-requests=1000000 --mysql-socket=/lsi/mysql/mysql.sock run > sysbench.log
说明:并发256,存储引擎innodb
执行过程中,CPU与LSI卡的情况:
说明:并发较大,CPU较繁忙,但是IO不是太busy,说明瓶颈不在IO上。
最终结果:
Initializing random number generator from timer.
Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 1000000
Threads started!
Done.
OLTP test statistics:
queries performed:
read: 14014098
write: 5005024
other: 2002010
total: 21021132
transactions: 1001003 (3445.66 per sec.)
deadlocks: 4 (0.01 per sec.)
read/write requests: 19019122 (65467.84 per sec.)
other operations: 2002010 (6891.34 per sec.)
Test execution summary:
total time: 290.5109s
total number of events: 1001003
total time taken by event execution: 74348.2259
per-request statistics:
min: 3.41ms
avg: 74.27ms
max: 756.14ms
approx. 95 percentile: 144.95ms
Threads fairness:
events (avg/stddev): 3910.1680/32.56
execution time (avg/stddev): 290.4228/0.01
本地盘:
sysbench --num-threads=256 --test=oltp --mysql-user=root --mysql-password=mysql --mysql-table-engine=innodb --init-rng=on --oltp-table-size=50000000 --max-time=$RT --max-requests=1000000 --mysql-socket=/var/lib/mysql/mysql.sock run > sysbench.log
执行过程中磁盘与CPU情况:
说明:与LSI存储卡相比,本地磁盘进行OLTP模拟测试时,CPU相对空闲,IO成为瓶颈。
最终结果:
Initializing random number generator from timer.
Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 1000000
Threads started!
Done.
OLTP test statistics:
queries performed:
read: 14013118
write: 5004682
other: 2001873
total: 21019673
transactions: 1000936 (959.86 per sec.)
deadlocks: 1 (0.00 per sec.)
read/write requests: 19017800 (18237.34 per sec.)
other operations: 2001873 (1919.72 per sec.)
Test execution summary:
total time: 1042.7948s
total number of events: 1000936
total time taken by event execution: 266923.0217
per-request statistics:
min: 3.46ms
avg: 266.67ms
max: 6884.36ms
approx. 95 percentile: 649.23ms
Threads fairness:
events (avg/stddev): 3909.9062/30.04
execution time (avg/stddev): 1042.6681/0.03
结论:使用LSI闪存卡后,MySQL的TPS提升了260%。其实本测试中的磁盘也是相当高端的存储,一般磁盘达不到这个数(具体配置我记不清了,可通过下面的IOPS可以看出来)
FIO测试:
进行8K的随机读,测试时间为10分钟
LSI:
fio tmp.txt
tmp.txt
[global]
direct=1
iodepth=32
ioengine=libaio
norandommap
randrepeat=0
numjobs=128
runtime=600
ramp_time=60
thread
group_reporting
name=mytest
[randread]
filename=/dev/sda1
bs=8k
rw=randread
说明:FIO测试是直接对存储设备进行读写
最终结果:
[1123MB/0KB/0KB /s] [144K/0/0 iops] [eta 00m:00s]
mytest: (groupid=0, jobs=128): err= 0: pid=9514: Fri Jan 17 15:30:26 2014
read : io=671818MB, bw=1119.7MB/s, iops=143310, runt=600015msec
slat (usec): min=3, max=136762, avg=871.03, stdev=4018.21
clat (usec): min=77, max=237967, avg=27708.34, stdev=11974.67
lat (usec): min=83, max=237985, avg=28578.69, stdev=12253.82
clat percentiles (usec):
| 1.00th=[ 1608], 5.00th=[16768], 10.00th=[17792], 20.00th=[19328],
| 30.00th=[20352], 40.00th=[21376], 50.00th=[22400], 60.00th=[25984],
| 70.00th=[35072], 80.00th=[37632], 90.00th=[40704], 95.00th=[45824],
| 99.00th=[63744], 99.50th=[75264], 99.90th=[94720], 99.95th=[101888],
| 99.99th=[125440]
bw (KB /s): min= 0, max=12931, per=0.78%, avg=8957.79, stdev=980.34
lat (usec) : 100=0.01%, 250=0.01%, 500=0.01%, 750=0.01%, 1000=0.05%
lat (msec) : 2=1.96%, 4=0.70%, 10=0.01%, 20=24.54%, 50=68.30%
lat (msec) : 100=4.39%, 250=0.06%
说明:60%的延迟在50ms
cpu : usr=0.39%, sys=2.42%, ctx=6605219, majf=0, minf=8200
IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=109.8%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.1%, 64=0.0%, >=64=0.0%
issued : total=r=85988683/w=0/d=0, short=r=0/w=0/d=0
Run status group 0 (all jobs):
READ: io=671818MB, aggrb=1119.7MB/s, minb=1119.7MB/s, maxb=1119.7MB/s, mint=600015msec, maxt=600015msec
Disk stats (read/write):
sda: ios=94385676/0, merge=110/0, ticks=207649589/0, in_queue=207374825, util=100.00%
本地盘:
[global]
direct=1
iodepth=32
ioengine=libaio
norandommap
randrepeat=0
numjobs=128
runtime=600
ramp_time=60
thread
group_reporting
name=mytest
[randread]
filename=/dev/cciss/c0d0p2
bs=8k
rw=randread
最终结果:
[19083KB/0KB/0KB /s] [2385/0/0 iops] [eta 18h:41m:14s]
mytest: (groupid=0, jobs=128): err= 0: pid=18257: Sun Mar 31 06:17:48 2013
read : io=3708.1MB, bw=6300.2KB/s, iops=780, runt=602834msec
slat (usec): min=5, max=5489.7K, avg=162593.81, stdev=906297.12
clat (usec): min=29, max=10575K, avg=5068121.79, stdev=1001568.61
lat (usec): min=40, max=15858K, avg=5231354.46, stdev=1336481.76
clat percentiles (msec):
| 1.00th=[ 29], 5.00th=[ 5145], 10.00th=[ 5145], 20.00th=[ 5211],
| 30.00th=[ 5211], 40.00th=[ 5276], 50.00th=[ 5276], 60.00th=[ 5276],
| 70.00th=[ 5342], 80.00th=[ 5342], 90.00th=[ 5342], 95.00th=[ 5407],
| 99.00th=[ 5473], 99.50th=[ 5473], 99.90th=[ 5538], 99.95th=[ 5538],
| 99.99th=[ 5538]
bw (KB /s): min= 0, max= 1158, per=0.78%, avg=48.88, stdev=19.10
lat (usec) : 50=0.01%, 100=0.01%, 250=0.02%, 500=0.04%, 750=0.01%
lat (usec) : 1000=0.01%
lat (msec) : 4=0.01%, 10=0.09%, 20=0.43%, 50=1.32%, 100=1.31%
lat (msec) : 250=0.22%, 500=0.05%, 750=0.07%, 1000=0.07%, 2000=0.16%
lat (msec) : >=2000=97.03%
说明:97.03%的延迟在2000ms以上
cpu : usr=0.00%, sys=0.01%, ctx=35292, majf=0, minf=8198
IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.2%, 16=0.4%, 32=109.1%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.1%, 64=0.0%, >=64=0.0%
issued : total=r=470774/w=0/d=0, short=r=0/w=0/d=0
Run status group 0 (all jobs):
READ: io=3708.1MB, aggrb=6300KB/s, minb=6300KB/s, maxb=6300KB/s, mint=602834msec, maxt=602834msec
Disk stats (read/write):
cciss!c0d0: ios=517653/321, merge=0/717, ticks=96165858/457, in_queue=96178286, util=99.94%
LSI、本地磁盘结果比较:
LSI的IOPS为:144k,本地硬盘IOPS为2385,LSI存储卡速度明显高于本地磁盘。而且,LSI延迟较低,大部分延迟在50ms,而本地磁盘97%的延迟在2000ms。