SSD与HDD性能对比测试

本文发布时间: 2019-Mar-22
经过两周的测试,得出以下结果MySQL-OLTP测试结果:(50张表,每张表1000万数据,1000个线程)TPS:MySQL在SSD上运行是在HDD上运行的5.63倍writes:MySQL在SSD上运行是在HDD上运行的5.58倍reads:MySQL在SSD上运行是在HDD上运行的5.55倍Response_time:MySQL在SSD上运行比在HDD上运行响应时间快44.45倍Errors:MySQL在SSD上运行是在HDD上运行错误率低83.5倍随机IO测试结论:SSD随机读写IO处理能力是HDD随机读写IO处理能力的20倍以下是详细测试过程准备工作操作系统:CentOS6.4 64位D B:MySQL5.6.22 64位硬 盘:SSD(Shannon Direct-IO 1.6TB)、HDD测试工具:sysbench0.5监控工具:zabix一、安装sysbench 0.5sysbench 0.5相比0.4版本的主要变化是,oltp测试结合了lua脚本,不需要修改源码,通过自定义lua脚本就可以实现不同业务类型的测试。同时0.5相比0.4需要消耗更多的cpu资源。下载sysbench源码包原来官网 http://sysbench.sourceforge.net 已停用,目前sysbench代码托管在launchpad上https://launchpad.net/sysbench更新和安装依赖包yum -y install gccyum -y install libtool安装bzr客户端yum -y install bzr在线获取0.5的版本,#下载到当前目录,文件名为: sysbench_0.5bzr branch lp:sysbench_0.5cd sysbench_0.5/运行命令:./autogen.sh,对环境进行清理./autogen.sh./configure --with-mysql-includes=/usr/local/mysqla/include/ --with-mysql-libs=/usr/local/mysqla/lib/# with-mysql-includes 指定MySQL安装目录# with-mysql-libs 指定MySQL lib所在目录make && make install如果遇到以下错误../libtool: line 841: X--tag=CC: command not found../libtool: line 874: libtool: ignoring unknown tag : command not found../libtool: line 841: X--mode=link: command not found../libtool: line 1007: *** Warning: inferring the mode of operation is deprecated.: command not found../libtool: line 1008: *** Future versions of Libtool will require --mode=MODE be specified.: command not found../libtool: line 2234: X-g: command not found../libtool: line 2234: X-O2: command not found../libtool: line 1954: X-L/usr/local/mysqla/lib/: No such file or directory../libtool: line 2403: Xsysbench: command not found../libtool: line 2408: X: command not found../libtool: line 2415: Xsysbench: command not found../libtool: line 2550: X-lmysqlclient_r: command not found../libtool: line 2550: X-lrt: command not found../libtool: line 2550: X-lm: command not found../libtool: line 2632: X-L/home/sysopt/src/sysbench-0.4.12/sysbench: No such file or directory../libtool: line 2550: X-lmysqlclient_r: command not found../libtool: line 2550: X-lrt: command not found../libtool: line 2550: X-lm: command not found../libtool: line 2632: X-L/home/sysopt/src/sysbench-0.4.12/sysbench: No such file or directory../libtool: line 2550: X-lmysqlclient_r: command not found../libtool: line 2550: X-lrt: command not found../libtool: line 2550: X-lm: command not found可能原因:1、没装依赖包libtool2、安装的版本不对(libtool版本过旧)3、其它原因解决方法:1、安装依赖包libtool2、libtoo更新到新版本3、用autoreconf代替autogen.sh,方法如下:autoreconf -iconfiguremakemake install安装成功后可通过help命令查看sysbench帮助[root@localhost src]# sysbench --helpMissing required command argument.Usage: sysbench [general-options]... --test=<test-name> [test-options]... commandGeneral options: --num-threads=N number of threads to use [1]#使用线程数量 --max-requests=N limit for total number of requests [10000]#请求数,默认为10000 --max-time=N limit for total execution time in seconds [0]#执行时间,默认为0表示表示不限制 --forced-shutdown=STRING amount of time to wait after --max-time before forcing shutdown [off] --thread-stack-size=SIZE size of stack per thread [64K] --tx-rate=N target transaction rate (tps) [0] --report-interval=N periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0]#0.5的新增参数(默认值0,表示禁用该功能)在指定的时间间隔报告测试信息,不用等到运行结束时再得到反馈 --report-checkpoints=[LIST,...]dump full statistics and reset all counters at specified points in time. The argument is a list of comma-separated values representing the amount of time in seconds elapsed from start of test when report checkpoint(s) must be performed. Report checkpoints are off by default. [] --test=STRING test to run --debug=[on|off] print more debugging info [off] --validate=[on|off] perform validation checks where possible [off] --help=[on|off] print help and exit --version=[on|off] print version and exit [off] --rand-init=[on|off] initialize random number generator [off]#初始化时生成随机的数据,默认关闭 --rand-type=STRING random numbers distribution {uniform,gaussian,special,pareto} [special] --rand-spec-iter=N number of iterations used for numbers generation [12] --rand-spec-pct=N percentage of values to be treated as 'special' (for special distribution) [1] --rand-spec-res=N percentage of 'special' values to use (for special distribution) [75] --rand-seed=N seed for random number generator, ignored when 0 [0] --rand-pareto-h=N parameter h for pareto distibution [0.2]Log options: --verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3] --percentile=N percentile rank of query response times to count [95]Compiled-in tests:测试项目 fileio - File I/O test #磁盘IO测试 cpu - CPU performance test #CPU运算性能 memory - Memory functions speed test #内存分配及传输速度 threads - Threads subsystem performance test #POSIX线程性能 mutex - Mutex performance test #互斥性能测试Commands: prepare run cleanup help versionSee 'sysbench --test=<name> help' for a list of options for each test.二、测试1.MySQL-OLTP测试数据准备[root@localhost sysbench_0.5]# sysbench --mysql-db=sbtest --num-threads=24 --mysql-engine-trx=yes --mysql-table-engine=innodb --rand-type=special --mysql-host=localhost --mysql-port=3307 --mysql-user=root --mysql-password= --mysql-socket=/data1/lib/mysql/mysql.sock --test=sysbench/tests/db/oltp.lua --oltp_tables_count=50 --oltp-table-size=10000000 --rand-init=on prepare参数说明:--mysql-db:指定在哪个数据库创建测试表,默认为sbtest库,需要提前创建好--num-threads:使用多线程创建多表,节省准备时间--mysql-engine-trx=yes 支持事务--mysql-table-engine:指定存储引擎,如myisam,innodb,heap,ndbcluster,bdb,maria,falcon,pbxt 默认InnoDB--test=tests/db/oltp.lua 表示调用 tests/db/oltp.lua 脚本进行 oltp 模式测试--oltp_tables_count=10 表示会生成 10 个测试表--oltp-table-size=1000000 表示每个测试表填充数据量为 1000000--db-driver:指定驱动,默认为Mysql--rand-init=on 表示每个测试表都是用随机数据来填充的#使用1000个线程开始测试,读写模式。模拟 对50个表并发OLTP测试,每个表1000万行记录,持续压测时间为 1小时[root@localhost sysbench_0.5]# sysbench --mysql-engine-trx=yes --mysql-table-engine=innodb --mysql-host=localhost --mysql-port=3307 --mysql-user=root --mysql-password= --mysql-socket=/data1/lib/mysql/mysql.sock --test=sysbench/tests/db/oltp.lua --oltp_tables_count=50 --oltp-table-size=100000000 --num-threads=1000 --oltp-read-only=off --report-interval=10 --rand-type=uniform --max-time=3600 --max-requests=0 --percentile=95 run >>/data1/sysbench-rw.txt参数说明--oltp-read-only=off 表示不要进行只读测试,也就是会采用读写混合模式测试--report-interval=10 表示每10秒输出一次测试进度报告--rand-type=uniform:数据分布模式,special表示存在热点数据,uniform表示非热点数据模式: uniform(固定),gaussian(高斯),special(特定的),pareto(帕累托)--max-time=3600 表示最大执行时长为 3600秒--max-requests=0 表示总请求数为 0,因为上面已经定义了总执行时长,所以总请求数可以设定为 0;也可以只设定总请求数,不设定最大执行时长--percentile=95 表示设定采样比例,默认是 95%,即丢弃5%的长请求,在剩余的95%里取最大值可选参数:--oltp-point-selects:在一个事务里面Point select的数量,默认为10--oltp-range-size:range查询的范围大小,默认100,应该小于oltp-table-size--oltp-simple-ranges:在一个事务里面简单range查询的数量,默认1--oltp-sum-ranges:在一个事务里面SUM range查询的数量,默认1--oltp-order-ranges:在一个事务里面ORDER range查询的数量,默认1--oltp-distinct-ranges:在一个事务里面DISTINCT range查询的数量,默认1注意:我这里将测试中输出信息存放到一个文本文件里,便于用监控展示成图表形式,这样更直观监控结果:SSD-IOHDD-IOSSD-TPSHDD-TPSSSD-writesHDD-WritesSSD-readsHDD-ReadsSSD-Response-timeHDD-Response_timeSSD-errorsHDD-Errors结论:(监控参数相同的情况下--oltp_tables_count=50 --oltp-table-size=100000000 --num-threads=1000 --oltp-read-only=off --rand-type=uniform )TPS:MySQL在SSD上运行是在HDD上运行的5.63倍writes:MySQL在SSD上运行是在HDD上运行的5.58倍reads:MySQL在SSD上运行是在HDD上运行的5.55倍Response_time:MySQL在SSD上运行比在HDD上运行响应时间快44.45倍Errors:MySQL在SSD上运行是在HDD上运行错误率低83.5倍2、随机IO测试(这里就不再上图了)数据准备(创建70G文件)注意:文件大小需要大于内存大小sysbench --test=fileio --file-total-size=70G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 prepare测试阶段sysbench --test=fileio --file-total-size=70G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run清楚测试数据sysbench --test=fileio --file-total-size=70G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 clean随机读写混合SSDOperations performed: 1789098 reads, 1192732 writes, 3816704 Other= 6798534 TotalRead 27.299Gb Written 18.2Gb Total transferred 45.499Gb (155.3Mb/sec)9939.43 Requests/sec executedGeneral statistics:total time: 300.0001stotal number of events: 2981830total time taken by event execution: 214.9376sresponse time:min: 0.00msavg: 0.07msmax: 7.26msapprox. 95 percentile: 0.23msThreads fairness:events (avg/stddev): 2981830.0000/0.00execution time (avg/stddev): 214.9376/0.00HDDOperations performed: 85851 reads, 57234 writes, 183040 Other =326125 TotalRead 1.31Gb Written 894.28Mb Totaltransferred 2.1833Gb (7.4523Mb/sec)476.95 Requests/sec executedGeneral statistics:total time: 300.0024stotal number of events: 143085total time taken by event execution: 291.8164sresponse time:min: 0.01msavg: 2.04msmax: 170.33msapprox. 95 percentile: 5.22msThreads fairness:events (avg/stddev): 143085.0000/0.00execution time (avg/stddev): 291.8164/0.00随机写SSDOperations performed: 0 reads, 10441500 writes, 13365074 Other =23806574 TotalRead 0b Written 159.32Gb Totaltransferred 159.32Gb (271.91Mb/sec)17402.24 Requests/sec executedGeneral statistics:total time: 600.0090stotal number of events: 10441500total time taken by event execution: 168.8168sresponse time:min: 0.00msavg: 0.02msmax: 0.71msapprox. 95 percentile: 0.02msThreads fairness:events (avg/stddev): 10441500.0000/0.00execution time(avg/stddev): 168.8168/0.00HDDOperationsperformed: 0 reads, 427200 writes,546689 Other = 973889 TotalRead 0b Written 6.5186Gb Total transferred 6.5186Gb (11.125Mb/sec)712.00 Requests/sec executedGeneralstatistics:total time: 600.0002stotal number of events: 427200total time taken by event execution:10.5053sresponse time:min: 0.01msavg: 0.02msmax: 29.30msapprox. 95 percentile: 0.03msThreadsfairness:events (avg/stddev): 427200.0000/0.00execution time (avg/stddev): 10.5053/0.00随机读SSDOperationsperformed: 3898994 reads, 0 writes, 0Other = 3898994 TotalRead59.494Gb Written 0b Total transferred 59.494Gb (203.07Mb/sec)12996.64Requests/sec executedGeneralstatistics:total time: 300.0001stotal number of events: 3898994total time taken by event execution:294.7603sresponse time:min: 0.00msavg: 0.08msmax: 30.09msapprox. 95 percentile: 0.24msThreadsfairness:events (avg/stddev): 3898994.0000/0.00execution time (avg/stddev): 294.7603/0.00HDDOperationsperformed: 131643 reads, 0 writes, 0Other = 131643 TotalRead2.0087Gb Written 0b Total transferred 2.0087Gb (6.8564Mb/sec)438.81 Requests/sec executedGeneralstatistics:total time: 300.0014stotal number of events: 131643total time taken by event execution:299.7703sresponse time:min: 0.00msavg: 2.28msmax: 121.94msapprox. 95 percentile: 5.34msThreadsfairness:events (avg/stddev): 131643.0000/0.00execution time (avg/stddev): 299.7703/0.00结论:SSD随机读写IO处理能力是HDD随机读写IO处理能力的20倍


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:09pm
栏目列表