1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > PCIe固态存储与HDD普通硬盘性能对比测试

PCIe固态存储与HDD普通硬盘性能对比测试

时间:2022-05-16 11:06:04

相关推荐

PCIe固态存储与HDD普通硬盘性能对比测试

经过两周的测试,得出以下结果

MySQL-OLTP测试结果:(50张表,每张表1000万数据,1000个线程)

TPS:MySQL在PCIe固态存储上运行是在HDD上运行的5.63倍

writes:MySQL在PCIe固态存储上运行是在HDD上运行的5.58倍

reads:MySQL在PCIe固态存储上运行是在HDD上运行的5.55倍

Response_time:MySQL在PCIe固态存储上运行比在HDD上运行响应时间快44.45倍

Errors:MySQL在PCIe固态存储上运行是在HDD上运行错误率低83.5倍

随机IO测试结论:

PCIe固态存储随机读写IO处理能力是HDD随机读写IO处理能力的20倍

以下是详细测试过程

准备工作

操作系统:CentOS6.4 64位

D B:MySQL5.6.22 64位

硬 盘:PCIe(Shannon Direct-IO 1.6TB)、HDD

测试工具:sysbench0.5

监控工具:zabix

一、安装sysbench 0.5

sysbench 0.5相比0.4版本的主要变化是,oltp测试结合了lua脚本,不需要修改源码,通过自定义lua脚本就可以实现不同业务类型的测试。同时0.5相比0.4需要消耗更多的cpu资源。

下载sysbench源码包

原来官网 已停用,目前sysbench代码托管在launchpad上/sysbench

更新和安装依赖包

yum -y install gccyum -y install libtool

安装bzr客户端

yum -y install bzr

在线获取0.5的版本,#下载到当前目录,文件名为: sysbench_0.5

bzr branch lp:sysbenchcd 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、没装依赖包libtool

2、安装的版本不对(libtool版本过旧)

3、其它原因

解决方法:

1、安装依赖包libtool

2、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=Nlimit 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,表示禁用该功能)在指定的时间间隔报告测试信息,<span style="font-size:12px;">不用等到运行结束时再得到反馈</span>--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=STRINGtest 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=STRINGrandom numbers distribution {uniform,gaussian,special,pareto} [special]--rand-spec-iter=Nnumber 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=Nseed for random number generator, ignored when 0 [0]--rand-pareto-h=N parameter h for pareto distibution [0.2]Log options:--verbosity=Nverbosity level {5 - debug, 0 - only critical messages} [3]--percentile=Npercentile 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

注意:我这里将测试中输出信息存放到一个文本文件里,便于用监控展示成图表形式,这样更直观

监控结果:

PCIe固态存储-IO

HDD-IO

PCIe固态存储-TPS

HDD-TPS

PCIe固态存储-writes

HDD-Writes

PCIe固态存储-reads

HDD-Reads

PCIe固态存储-Response-time

HDD-Response_time

PCIe固态存储-errors

HDD-Errors

结论:(监控参数相同的情况下--oltp_tables_count=50 --oltp-table-size=100000000 --num-threads=1000 --oltp-read-only=off --rand-type=uniform)

TPS:MySQL在PCIe固态存储上运行是在HDD上运行的5.63倍

writes:MySQL在PCIe固态存储上运行是在HDD上运行的5.58倍

reads:MySQL在PCIe固态存储上运行是在HDD上运行的5.55倍

Response_time:MySQL在PCIe固态存储上运行比在HDD上运行响应时间快44.45倍

Errors:MySQL在PCIe固态存储上运行是在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=0clean

随机读写混合

PCIe固态存储

Operations performed: 1789098 reads, 1192732 writes, 3816704 Other= 6798534 Total

Read 27.299Gb Written 18.2Gb Total transferred 45.499Gb (155.3Mb/sec)

9939.43 Requests/sec executed

General statistics:

total time:300.0001s

total number of events:2981830

total time taken by event execution: 214.9376s

response time:

min:0.00ms

avg:0.07ms

max:7.26ms

approx. 95 percentile: 0.23ms

Threads fairness:

events (avg/stddev):2981830.0000/0.00

execution time (avg/stddev):214.9376/0.00

HDD

Operations performed: 85851 reads, 57234 writes, 183040 Other =326125 Total

Read 1.31GbWritten 894.28Mb Totaltransferred 2.1833Gb (7.4523Mb/sec)

476.95 Requests/sec executed

General statistics:

total time: 300.0024s

total number of events:143085

total time taken by event execution: 291.8164s

response time:

min:0.01ms

avg:2.04ms

max:170.33ms

approx. 95 percentile: 5.22ms

Threads fairness:

events (avg/stddev):143085.0000/0.00

execution time (avg/stddev):291.8164/0.00

随机写

PCIe固态存储

Operations performed: 0 reads, 10441500 writes, 13365074 Other =23806574 Total

Read 0bWritten 159.32Gb Totaltransferred 159.32Gb (271.91Mb/sec)

17402.24 Requests/sec executed

General statistics:

total time:600.0090s

total number of events:10441500

total time taken by event execution: 168.8168s

response time:

min:0.00ms

avg:0.02ms

max: 0.71ms

approx. 95 percentile: 0.02ms

Threads fairness:

events (avg/stddev):10441500.0000/0.00

execution time(avg/stddev): 168.8168/0.00

HDD

Operationsperformed: 0 reads, 427200 writes,546689 Other = 973889 Total

Read 0b Written 6.5186Gb Total transferred 6.5186Gb (11.125Mb/sec)

712.00 Requests/sec executed

Generalstatistics:

total time: 600.0002s

total number of events: 427200

total time taken by event execution:10.5053s

response time:

min: 0.01ms

avg: 0.02ms

max: 29.30ms

approx. 95 percentile: 0.03ms

Threadsfairness:

events (avg/stddev): 427200.0000/0.00

execution time (avg/stddev): 10.5053/0.00

随机读

PCIe固态存储

Operationsperformed: 3898994 reads, 0 writes, 0Other = 3898994 Total

Read59.494Gb Written 0b Total transferred 59.494Gb (203.07Mb/sec)

12996.64Requests/sec executed

Generalstatistics:

total time: 300.0001s

total number of events: 3898994

total time taken by event execution:294.7603s

response time:

min: 0.00ms

avg: 0.08ms

max: 30.09ms

approx. 95 percentile: 0.24ms

Threadsfairness:

events (avg/stddev): 3898994.0000/0.00

execution time (avg/stddev): 294.7603/0.00

HDD

Operationsperformed: 131643 reads, 0 writes, 0Other = 131643 Total

Read2.0087Gb Written 0b Total transferred 2.0087Gb (6.8564Mb/sec)

438.81 Requests/sec executed

Generalstatistics:

total time: 300.0014s

total number of events: 131643

total time taken by event execution:299.7703s

response time:

min: 0.00ms

avg: 2.28ms

max: 121.94ms

approx. 95 percentile: 5.34ms

Threadsfairness:

events (avg/stddev): 131643.0000/0.00

execution time (avg/stddev): 299.7703/0.00

结论:

PCIe固态存储随机读写IO处理能力是HDD随机读写IO处理能力的20倍

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。