Sysbench 基准压测 my.cnf

一、Sysench测试前准备

1.1、压测环境

配置 信息
主机 Dell PowerEdge R730xd
CPU 24 * Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz
内存 64G (16G * 4)
RAID RAID1
硬盘 7.2K RPM, 6000G SAS, 12G/s
文件系统 ext4
系统 Red Hat Enterprise Linux Server release 7.3 (Maipo)
内核 3.10.0-514.el7.x86_64
MySQL MySQL5.7.18
Sysbench 1.1.0-0167e45

1.2、压测基准值

测试工具 sysbench
每张表初始化的数据数量 10,000,000
测试表数 16
测试脚本 oltp_update_index.lua、oltp_update_non_index.lua
run time(秒) 3600
最大请求数 100,000,000
并发线程数 8 - 256
生成数据量 127.56G

二、进行OLTP_update测试

2.1、安装压测工具sysbench

  • 标准安装
[root@localhost-m(252) /r2/soft/dbtest] curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash &&
sudo yum -y install sysbench
  • Test 脚本

SVN地址:http://svn1.ipanel.cn:18080/svn/DBA/document/数据库压测/mysql_oltp_sysbench.sh

2.2、执行压测

  • 依据测试环境修改脚本的mysql参数和sysbench参数,然后执行
  • 注意:脚本会把执行结果写入到dbtest库下面的sysbench_test表里
Usage: ./sysbench_t1.sh test (test_scenario) (test_type) (mysql_host) (mysql_port) (mysql_user) (mysql_password)
       ./sysbench_t1.sh analyse
       ./sysbench_t1.sh chart [scenario]...

----------
测试: 子命令test
      test_scenario: 自定义的测试场景名
      test_type: read-only 或 read-write, 表示测试模式
      其余4参数表示待测试MySQL连接相关信息,密码若包含特殊字符,将其置于单引号内
----------
分析: 子命令analyse
----------
画图: 子命令chart
      会在/tmp/下生成request_per_second.png transactions_per_second.png 95_pct_time.png 三张图
      chart (对分析结果中的所有测试场景画图)
      chart scenario ... (对指定的测试场景画图,场景名依据先前自定义的名称)

[root@localhost-m(252) /r2/soft]# ll /usr/local/sysbench/share/sysbench/
total 64
-rwxr-xr-x 1 root root  1452 11月  2 17:14 bulk_insert.lua
-rw-r--r-- 1 root root 13918 11月  2 17:14 oltp_common.lua
-rwxr-xr-x 1 root root  1290 11月  2 17:14 oltp_delete.lua
-rwxr-xr-x 1 root root  2415 11月  2 17:14 oltp_insert.lua
-rwxr-xr-x 1 root root  1265 11月  2 17:14 oltp_point_select.lua
-rwxr-xr-x 1 root root  1649 11月  2 17:14 oltp_read_only.lua
-rwxr-xr-x 1 root root  1824 11月  2 17:14 oltp_read_write.lua
-rwxr-xr-x 1 root root  1118 11月  2 17:14 oltp_update_index.lua
-rwxr-xr-x 1 root root  1127 11月  2 17:14 oltp_update_non_index.lua
-rwxr-xr-x 1 root root  1440 11月  2 17:14 oltp_write_only.lua
-rwxr-xr-x 1 root root  1919 11月  2 17:14 select_random_points.lua
-rwxr-xr-x 1 root root  2118 11月  2 17:14 select_random_ranges.lua
drwxr-xr-x 4 root root  4096 11月  2 17:14 tests
[root@localhost-m(252) /r2/soft]# nohup ./mysql_oltp_sysbench.sh test scenario_oltp_update_non_index read-write localhost 3306 gcdb 'iforgot' &
[root@localhost-m(252) /r2/soft]# tail -f /tmp/mysql_oltp.log
[ 10s ] thds: 192 tps: 255.30 qps: 255.30 (r/w/o: 0.00/255.30/0.00) lat (ms,95%): 2728.81 err/s: 0.00 reconn/s: 0.00

三、执行结果

3.1 sysbench 执行结果

SQL statistics:
    queries performed:
        read:                            0
        write:                           367252 --写总数
        other:                           0
        total:                           367252
    transactions:                        367252 (203.97 per sec.) -- 总事务数(每秒事务数)
    queries:                             367252 (203.97 per sec.) -- 读写务数(每秒事务数)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

Throughput:
    events/s (eps):                      203.9661   --每秒事务数
    time elapsed:                        1800.5544s --总耗时
    total number of events:              367252     --总事务数    

Latency (ms):
         min:                                  0.12     --最小耗时
         avg:                                470.60     --平均耗时
         max:                              48410.54     --最大耗时
         95th percentile:                    846.57     --超过95%平均耗时
         sum:                            172829974.82   --总耗时

Threads fairness:
    events (avg/stddev):           3825.5417/76.81      --事件(平均值/偏差)
    execution time (avg/stddev):   1800.3122/0.10       --执行时间(平均值/偏差)

3.2 查看脚本执行记录

  • 查询dbtest.sysbench_test表
mysql> SELECT scenario,sb_threads,server_load,request_read,request_write,transactions_per_second,request_per_second,95_pct_time FROM dbtest.sysbench_test;
+--------------------------------+------------+-------------+--------------+---------------+-------------------------+--------------------+-------------+
| scenario                       | sb_threads | server_load | request_read | request_write | transactions_per_second | request_per_second | 95_pct_time |
+--------------------------------+------------+-------------+--------------+---------------+-------------------------+--------------------+-------------+
| scenario_oltp_update_index     |         24 |       13.35 |            0 |        745072 |                  413.84 |             413.84 |      277.21 |
| scenario_oltp_update_index     |         32 |        7.81 |            0 |        249685 |                  138.69 |             138.69 |      493.24 |
| scenario_oltp_update_index     |         64 |        8.20 |            0 |        333937 |                  185.50 |             185.50 |      733.00 |
| scenario_oltp_update_index     |         96 |       20.03 |            0 |        343386 |                  190.69 |             190.69 |     1032.01 |
| scenario_oltp_update_index     |        128 |        6.72 |            0 |        326057 |                  177.64 |             177.64 |     1479.41 |
| scenario_oltp_update_index     |        160 |        7.23 |            0 |        342488 |                  187.00 |             187.00 |     1869.60 |
| scenario_oltp_update_index     |        192 |        9.93 |            0 |        331669 |                  184.15 |             184.15 |     2493.86 |
| scenario_oltp_update_index     |        256 |        6.63 |            0 |        322515 |                  177.02 |             177.02 |     2680.11 |
| scenario_oltp_update_non_index |         24 |       24.78 |            0 |       1003021 |                  557.19 |             557.19 |      189.93 |
| scenario_oltp_update_non_index |         32 |       17.21 |            0 |        547258 |                  303.78 |             303.78 |      601.29 |
| scenario_oltp_update_non_index |         64 |       27.47 |            0 |        454084 |                  251.93 |             251.93 |     1618.78 |
| scenario_oltp_update_non_index |         96 |       18.86 |            0 |        452345 |                  250.91 |             250.91 |     2120.76 |
| scenario_oltp_update_non_index |        128 |       16.62 |            0 |        437129 |                  242.45 |             242.45 |     2778.39 |
| scenario_oltp_update_non_index |        160 |       22.01 |            0 |        421289 |                  233.70 |             233.70 |     3511.19 |
| scenario_oltp_update_non_index |        192 |       16.81 |            0 |        398962 |                  221.19 |             221.19 |     4358.09 |
| scenario_oltp_update_non_index |        256 |       18.24 |            0 |        407225 |                  225.80 |             225.80 |     5813.24 |
| scenario_oltp_update_non_index |         24 |       16.45 |            0 |        406238 |                  225.59 |             225.59 |      746.32 |
| scenario_oltp_update_non_index |         32 |       16.82 |            0 |        419489 |                  232.93 |             232.93 |     1032.01 |
| scenario_oltp_update_non_index |         64 |       23.02 |            0 |        426404 |                  236.83 |             236.83 |     1836.24 |
| scenario_oltp_update_non_index |         96 |       20.04 |            0 |        457630 |                  253.94 |             253.94 |     2045.74 |
| scenario_oltp_update_non_index |        128 |       24.04 |            0 |        460669 |                  255.80 |             255.80 |     2632.28 |
| scenario_oltp_update_non_index |        160 |       21.59 |            0 |        454371 |                  252.04 |             252.04 |     3267.19 |
| scenario_oltp_update_non_index |        192 |       18.05 |            0 |        450096 |                  249.65 |             249.65 |     3911.79 |
| scenario_oltp_update_non_index |        256 |       19.35 |            0 |        437986 |                  243.02 |             243.02 |     5507.54 |
| scenario_oltp_update_non_index |         24 |       15.51 |            0 |        427093 |                  237.23 |             237.23 |      733.00 |
| scenario_oltp_update_non_index |         32 |       17.80 |            0 |        433449 |                  240.72 |             240.72 |      977.74 |
| scenario_oltp_update_non_index |         64 |       17.65 |            0 |        432506 |                  240.08 |             240.08 |     1803.47 |
| scenario_oltp_update_non_index |         96 |       18.55 |            0 |        426209 |                  236.44 |             236.44 |     2279.14 |
| scenario_oltp_update_non_index |        128 |       17.06 |            0 |        415146 |                  230.27 |             230.27 |     2880.27 |
| scenario_oltp_update_non_index |        160 |       19.04 |            0 |        416016 |                  230.63 |             230.63 |     3511.19 |
| scenario_oltp_update_non_index |        192 |       19.73 |            0 |        411943 |                  228.56 |             228.56 |     4280.32 |
| scenario_oltp_update_non_index |        256 |       17.48 |            0 |        418163 |                  231.88 |             231.88 |     5709.50 |
| scenario_oltp_update_index     |         24 |       11.59 |            0 |        490759 |                  272.63 |             272.63 |      411.96 |
| scenario_oltp_update_index     |         32 |       21.27 |            0 |        560223 |                  311.19 |             311.19 |      458.96 |
| scenario_oltp_update_index     |         64 |       29.03 |            0 |        357102 |                  198.36 |             198.36 |      601.29 |
| scenario_oltp_update_index     |         96 |       19.62 |            0 |        403699 |                  222.30 |             222.30 |      846.57 |
| scenario_oltp_update_index     |        128 |       15.11 |            0 |        380223 |                  211.14 |             211.14 |     1170.65 |
| scenario_oltp_update_index     |        160 |       16.88 |            0 |        391103 |                  216.96 |             216.96 |     1506.29 |
| scenario_oltp_update_index     |        192 |        8.91 |            0 |        378316 |                  209.84 |             209.84 |     2045.74 |
| scenario_oltp_update_index     |        256 |        8.18 |            0 |        377455 |                  206.79 |             206.79 |     2932.60 |
| scenario_oltp_update_index     |         24 |        8.76 |            0 |        375782 |                  208.75 |             208.75 |      257.95 |
| scenario_oltp_update_index     |         32 |        5.58 |            0 |        356393 |                  197.99 |             197.99 |      356.70 |
| scenario_oltp_update_index     |         64 |        5.52 |            0 |        377180 |                  205.27 |             205.27 |      559.50 |
| scenario_oltp_update_index     |         96 |        8.48 |            0 |        367252 |                  203.97 |             203.97 |      846.57 |
| scenario_oltp_update_index     |        128 |       11.43 |            0 |        374881 |                  205.08 |             205.08 |     1149.76 |
| scenario_oltp_update_index     |        160 |        9.46 |            0 |        366998 |                  200.27 |             200.27 |     1618.78 |
| scenario_oltp_update_index     |        192 |        5.50 |            0 |        351154 |                  194.18 |             194.18 |     2159.29 |
| scenario_oltp_update_index     |        256 |       11.49 |            0 |        367447 |                  202.42 |             202.42 |     2449.36 |
+--------------------------------+------------+-------------+--------------+---------------+-------------------------+--------------------+-------------+

3.3 最后一次压测MySQL各种状态

  • CPU MEM

  • IO

  • 线程数和update

  • Innodb buffer

3.4 统计三次循环压测结果并画图

3.5 测试结果

  • 当线程并发到32个时TPS在208左右,事务95%的平均耗时也在不断攀升,在线程数达并发到64个时候,耗时在1000ms以上即1s,系统不可以用
  • oltp_update_index.lua模式下压测,update语句/每秒平均为197个

四、关于测试后的分析和建议

  • 4.1、本次进行两种模式模式压测分别为oltp_update_non_index.lua(无索引更新)和oltp_update_index.lua(索引更新);从上面io和cpu图知道,执行并发24线程压测是CPU负载上升但并未达到瓶颈,innodb buffer 使用 8G,但是IO使用率100%并出现io延迟

  • 4.2、建议:
    • /r2目录所在磁盘(RAID1 SAS 7.2K 3.5 12G/s 6T), RAID组进行升级,建议部署(RADI10 1T sas 15K )

02:Sysbench基准压测(oltp_update_index.lua、oltp_update_non_index.lua)my.cnf的更多相关文章

  1. 01:Sysbench 基准压测 IO篇

    line:V1.1 mail: gczheng@139.com date: 2017-11-17 一.Sysench测试前准备 1.1.压测环境 配置 信息 主机 Dell PowerEdge R73 ...

  2. 03:TPCC 基准压测my.cnf

    line: V1.3 mail: gczheng@139.com date: 2017-11-09 一.TPCC测试前准备 1.压测环境 配置 信息 主机 Dell PowerEdge R730xd ...

  3. sysbench压测过程

    1.sysbench安装(sysbench1.1.0)  [root@master soft]# ls sysbench1.1.0.zip sysbench1.1.0.zip 解压: [root@ma ...

  4. Http压测工具wrk使用指南

    用过了很多压测工具,却一直没找到中意的那款.最近试了wrk感觉不错,写下这份使用指南给自己备忘用,如果能帮到你,那也很好. 安装 wrk支持大多数类UNIX系统,不支持windows.需要操作系统支持 ...

  5. Http压测工具wrk使用指南【转】

    用过了很多压测工具,却一直没找到中意的那款.最近试了wrk感觉不错,写下这份使用指南给自己备忘用,如果能帮到你,那也很好. 安装 wrk支持大多数类UNIX系统,不支持windows.需要操作系统支持 ...

  6. sysbench对MySQL的压测,使用sysbench压测磁盘io

    QPS - query per secondTPS - transaction per second 不是特别关注,每个业务场景中事务标准是不一样的 Ⅰ.sysbench测试框架 Ⅱ.常用测试脚本 [ ...

  7. sysbench压测自装MySQL数据库

    压测准备 测试机器 2vCPUs | 4GB | s6.large.2 CentOS 7.6 64bit 建立测试库 create database test_db character set utf ...

  8. sysbench对MySQL的压测

    QPS - query per second TPS - transaction per second 不是特别关注,每个业务场景中事务标准是不一样的 Ⅰ.sysbench测试框架 Ⅱ.常用测试脚本 ...

  9. 【MySQL】sysbench压测服务器及结果解读

    主要压测范围包括CPU测试.磁盘IO测试.线程测试.OLTP测试等,那么sysbench就可以满足我们的压测需求.下面我们简单来看下sysbench的安装使用以及压测结果的解读. 一.sysbench ...

随机推荐

  1. C++STL内存配置的设计思想与关键源码分析

    说明:我认为要读懂STL中allocator部分的源码,并汲取它的思想,至少以下几点知识你要了解:operator new和operator delete.handler函数以及一点模板知识.否则,下 ...

  2. 不能在具有唯一索引“IX_******”的对象“dbo.****”中插入重复键的行。重复键值为 (110, 372000, 2)。

    当尝试插入数据,或者更新某个表的时候出现 不能在具有唯一索引“IX_******”的对象“dbo.****”中插入重复键的行.重复键值为 (110, 372000, 2). 遇到这个问题的时候,请找到 ...

  3. New Concept English three(10)

    The great ship, Titanic, sailed for New York from Southampton on April 10th, 1912. She was carrying ...

  4. Caused by: java.lang.AbstractMethodError: org.hibernate.validator.internal.engine.ConfigurationImpl

    1.错误描述 严重: StandardWrapper.Throwable org.springframework.beans.factory.BeanCreationException: Error ...

  5. Aria2 - OS X 下载百度云资源神器

    官网介绍: (Aria2 is a light weight multi-protocol & multi-source command-line download utility. It s ...

  6. Android Studio单独生成apk

    /********************************************************************* * Android Studio单独生成apk * 说明: ...

  7. wait() ,notify() ,notifyAll(),synchronized 和同步方法锁,对象锁的联系,关系,区别;

    一直不明白一个问题,因为在书上关于生产者和消费者的例子里看到一段这样的代码,估计很多人都和我一样迷惑 public synchronized void set(String name, String ...

  8. 基于NodeJS的全栈式开发(基于NodeJS的前后端分离)

    也谈基于NodeJS的全栈式开发(基于NodeJS的前后端分离) 前言 为了解决传统Web开发模式带来的各种问题,我们进行了许多尝试,但由于前/后端的物理鸿沟,尝试的方案都大同小异.痛定思痛,今天我们 ...

  9. 奇异值分解(SVD)详解

    在网上看到有很多文章介绍SVD的,讲的也都不错,但是感觉还是有需要补充的,特别是关于矩阵和映射之间的对应关系.前段时间看了国外的一篇文章,叫A Singularly Valuable Decompos ...

  10. 《DSP using MATLAB》示例Example 6.9

    代码: % All-Pole IIR filter to Lattice structure filter a = [1, 13/24, 5/8, 1/3]; K = dir2latc(a) % To ...