• PCIe固态存储和HDD常见的硬盘性能对比测试


    2周测试后,导致以下结果

    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源代码包
    原来官网  http://sysbench.sourceforge.net 已停用。眼下sysbench代码托管在launchpad上https://launchpad.net/sysbench

    更新和安装依赖包

    yum -y install gcc
    yum -y install libtool
    

    安装bzrclient

    yum -y install bzr
    

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

    bzr branch lp:sysbench
    cd 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 -i
    configure
    make
    make install
    

    成功安装后可通过help命令查看sysbench帮助

    [root@localhost src]# sysbench --help
    Missing required command argument.
    Usage:
      sysbench [general-options]... --test=<test-name> [test-options]... command
    
    General 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,表示禁用该功能)在指定的时间间隔报告測试信息,<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=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 version
    
    See '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=0 clean

    随机读写混合

    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.31Gb Written 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 0b Written 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倍


     

    版权声明:本文博客原创文章,博客,未经同意,不得转载。

  • 相关阅读:
    php读取大文件如日志文件
    大型站点高并发架构技术
    Nginx配置文件nginx.conf详细说明文档
    关于PHP高并发抢购系统设计
    Mysql常用的锁机制
    Sping基础
    Reliable Master持续集成环境搭建Centos
    Win7 macaca自动化环境搭建 PC篇
    安卓appium无线调试
    Selenium PageFactory使用
  • 原文地址:https://www.cnblogs.com/mengfanrong/p/4682720.html
Copyright © 2020-2023  润新知