由于公司最近需要上SSD,用于MySQL数据库服务器,以下针对单块480G SSD、接RAID卡240G SSD* 2 RAID0,以及与普通硬盘SATA硬盘以及SAS(raid10)做个比较:
480G SSD: INTEL SSDSC2BP480G4
SATA:WD6401AALS-00J7B1
240*2 SSD RAID0: INTEL SSDSC2BP240410BTJR408108F5240AGN RAID卡: LSI MegaRAID SAS 9271-4i
300G*4 SAS RAID10: SEAGATE ST3146855SS
测试目的:
1、测试单块480G SSD硬盘直连主板,与2块240G SSD 接RAID卡做RAID0 性能比较
2、测试单块SSD与SATA以及SAS(RAD10)的性能比较
测试方法:
1、通过sysbench mark基准测试工具对文件读写IO进行测试;
2、准备样本数据100G,分16个文件;
3、分别基于4KB,16KB 两个block size进行读写测试;
4、共进行随机读、随机写、随机读写、顺序读、顺序写、顺序读写6种Case测试;
5、测试同时加载16个线程,最大执行时间180秒,最大请求100000次;
测试脚本:
#!/bin/sh
device=$1
log_file=fileio.log
Usage() {
echo "basename $0 [Device Directory]"
exit 0
}if [ -z "$*" ] || [ $# -ne 1 ]; then
Usage
ficd $device
for blksize in 4096 16384; do
##prepare
/usr/local/sysbench/bin/sysbench --test=fileio --file-num=16 --file-total-size=100G prepare
for mode in rndrd rndwr rndrw seqrd seqwr seqrewr; do
# for mode in seqrewr; do
echo "----$device $blksize $mode----" >> $log_file #run
/usr/local/sysbench/bin/sysbench --test=fileio --file-num=16 --file-total-size=100G --file-test-mode=$mode --max-time=180 --max-requests=100000 --num-t
hreads=16 --init-rng=on --file-extra-flags=direct --file-fsync-freq=0 --file-block-size=$blksize run >> $log_file 2>&1 done
#cleanup
/usr/local/sysbench/bin/sysbench --test=fileio --file-total-size=100G cleanupdone测试结果1:单块480G SSD与2块240 SSD(RAID0)性能比较
1、随机读
4KB Block随机读:两者相当 16KB Block随机读:240G*2 SSD(RAID0)相对较优;
2、随机写
4KB Block随机写:480G SSD(Local)较优 16KB Block随机写:两者相当;
3、随机读写
4KB Block随机读写: 480G SSD(Local)较优 16KB Block随机读写:240G*2 SSD(RAID0)相对较优
4、顺序读
4KB Block顺序读: 240G*2 SSD(RAID0)较优 16KB Block顺序读:240G*2 SSD(RAID0)较优
5、顺序写
4KB Block顺序写:480G SSD(Local)较优 16KB Block顺序写: 480G SSD(Local)较优
6、顺序读写
4KB Block顺序读写:480G SSD(Local)较优 16KB Block顺序写:480G SSD(Local)较优
测试结论1:(For 单块SSD与SSD(raid0)比较)
1、总体IO读方面:240G*2 SSD (RAID0)在读性能方面相对较优,但只是略微高于480G SSD(Local),远远未达到2倍的效果;
2、总体IO写方面:480G SSD(Local) 各种写情况都高于240G*2 SSD (RAID0) ;
测试结果2:(For SSD与SATA以及SAS(RAID10)的性能测试对比)
(由于mysql innodb datafile 每个PAGE Size默认为16KB,这里主要看16KB Block Size的性能对比结果)
480G SSD(Local) vs 640G SATA vs 300G SAS(RAID10):
Ramdom Read of IOPS: | SSD 为SATA的219倍左右,为SAS(RAID10)的32倍左右; |
Ramdom Write of IOPS: | SSD 为SATA的222倍左右,为SAS(RAID10)的67倍左右; |
Ramdom Read&Write of IOPS: | SSD为SATA的110倍左右,为SAS(RAID10)的30倍左右; |
Sequential Read of IOPS: | SSD为SATA的4倍左右,为SAS(RAID10)的6倍左右; |
Sequential Write of IOPS: | SSD与SATA基本一致,SSD为SAS(RAID10)的26倍左右; |
Sequential Read&Write of IOPS: | SATA优于SSD, SSD为SAS(RAID10)的25倍左右; |
测试结论2:
1、可见SSD在随机读、写等方面等有非常大的优势,顺序读和顺序写方面,与SATA的优势不明显,但仍远远大于SAS(RAID10)的性能;
2、虽在Sequential Read&Write of IOPS方面 SATA略优于SSD,但数据库很少有这种应用。
测试结果数据统计:
4KB Block Ramdom Read | | 16KB Block Ramdom Read | |||||
Drive | IOPS | Response Time(ms) | Rate(MB/s) | | IOPS | Response Time(ms) | Rate(MB/s) |
480GB SSD (Local) | 48190 | 0.59 | 188.24 | | 25267 | 1.11 | 394.81 |
240GB SSD*2 (RAID 0) | 47446 | 0.92 | 185.34 | | 35199 | 0.79 | 549.99 |
640G SATA (Local) | 124 | 348 | 0.499 | | 115 | 379.47 | 1.8113 |
300GB SAS*4(RAID10) | 863 | 49.59 | 3.3723 | | 788 | 53.03 | 12.314 |
| | | | | | | |
4KB Block Ramdom Write | | 16KB Block Ramdom Write | |||||
Drive | IOPS | Response Time(ms) | Rate(MB/s) | | IOPS | Response Time(ms) | Rate(MB/s) |
480GB SSD (Local) | 28989 | 2.28 | 113.24 | | 15391 | 3.72 | 240.49 |
240GB SSD*2 (RAID 0) | 26730 | 2.54 | 104.42 | | 17228 | 3.92 | 269.2 |
640G SATA (Local) | 130 | 574 | 0.522 | | 124 | 589.75 | 1.9434 |
300GB SAS*4(RAID10) | 429 | 98 | 1.6787 | | 393 | 106.49 | 6.1472 |
| | | | | | | |
4KB Block Ramdom Read&Write | | 16KB Block Ramdom Read&Write | |||||
Drive | IOPS | Response Time(ms) | Rate(MB/s) | | IOPS | Response Time(ms) | Rate(MB/s) |
480GB SSD (Local) | 39072 | 1.88 | 152.63 | | 18051 | 2.75 | 282.06 |
240GB SSD*2 (RAID 0) | 32228 | 2.06 | 125.89 | | 19507 | 2.63 | 304.8 |
640G SATA (Local) | 178 | 344 | 0.712 | | 164 | 364.44 | 2.5673 |
300GB SAS*4(RAID10) | 659 | 68.26 | 2.5776 | | 592 | 76 | 9.255 |
| | | | | | | |
4KB Block Sequential Read | | 16KB Sequential Read | |||||
Drive | IOPS | Response Time(ms) | Rate(MB/s) | | IOPS | Response Time(ms) | Rate(MB/s) |
480GB SSD (Local) | 55702 | 0.56 | 217.59 | | 26174 | 0.95 | 408.98 |
240GB SSD*2 (RAID 0) | 74233 | 0.36 | 289.97 | | 41869 | 0.71 | 654.21 |
640G SATA (Local) | 8172 | 2.6 | 31.923 | | 6139 | 3.47 | 95.932 |
300GB SAS*4(RAID10) | 5261 | 10.93 | 20.552 | | 3927 | 10.48 | 61.37 |
| | | | | | | |
4KB Block Sequential Write | | 16KB Block Sequential Write | |||||
Drive | IOPS | Response Time(ms) | Rate(MB/s) | | IOPS | Response Time(ms) | Rate(MB/s) |
480GB SSD (Local) | 3299 | 12.34 | 12.887 | | 3153 | 11.7 | 49.271 |
240GB SSD*2 (RAID 0) | 1982 | 16.51 | 7.7441 | | 2364 | 13.76 | 36.952 |
640G SATA (Local) | 4970 | 4.05 | 19.417 | | 2810 | 6.41 | 43.909 |
300GB SAS*4(RAID10) | 152 | 16.01 | 0.609 | | 119 | 814 | 1.8645 |
| | | | | | | |
4KB Block Sequential Read&Write | | 16KB Block Sequential Read&Write | |||||
Drive | IOPS | Response Time(ms) | Rate(MB/s) | | IOPS | Response Time(ms) | Rate(MB/s) |
480GB SSD (Local) | 3973 | 11.15 | 15.523 | | 3178 | 12.17 | 49.666 |
240GB SSD*2 (RAID 0) | 2421 | 15.01 | 9.4608 | | 2487 | 13.62 | 38.864 |
640G SATA (Local) | 6615 | 3.82 | 25.843 | | 3750 | 7.16 | 58.605 |
300GB SAS*4(RAID10) | 111 | 1116.76 | 0.447 | | 126 | 825 | 1.9702 |
以上主要测试硬盘在IO方面的性能对比结果,目前暂未测试基于MySQL QPS/TPS的测试结果。
















