加入收藏 | 设为首页 | 会员中心 | 我要投稿 银川站长网 (https://www.0951zz.com/)- 云通信、基础存储、云上网络、机器学习、视觉智能!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

利用 tpcc-mysql 如何进行 TPCC 的 MySQL 效能测评

发布时间:2023-10-27 13:29:42 所属栏目:MySql教程 来源:
导读:这篇文章主要介绍如何使用tpcc-mysql对mysql进行TPCC性能测试,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!tpcc-mysq是满足TPCC规范的性能测试工具,具体步骤如下:1、下载从https://git

这篇文章主要介绍如何使用tpcc-mysql对mysql进行TPCC性能测试,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

tpcc-mysq是满足TPCC规范的性能测试工具,具体步骤如下:

1、下载

从https://github.com/Percona-Lab/tpcc-mysql下载安装包。

2、安装

[root@D2-LZY245 ~]# unzip tpcc-mysql-master.zip

[root@D2-LZY245 ~]# cd tpcc-mysql-master/src/

[root@D2-LZY245 src]# make

[root@D2-LZY245 ~]# ll tpcc-mysql-master/tpcc_*

-rwxrwxr-x 1 root root 81114 May 19 15:12 tpcc-mysql-master/tpcc_load

-rwxrwxr-x 1 root root 188582 May 19 15:13 tpcc-mysql-master/tpcc_start

编译完成后,就有了tpcc_load和tpcc_start这两个脚本。tpcc_load用于初始化数据,tpcc_start用于执行基准测试。

3、加载

[root@D2-LZY245 ~]# mysqladmin -uroot -p123456 create tpcc

[root@D2-LZY245 ~]# mysql -uroot -p123456 tpcc < /root/tpcc-mysql-master/create_table.sql

[root@D2-LZY245 ~]# mysql -uroot -p123456 tpcc < /root/tpcc-mysql-master/add_fkey_idx.sql

[root@D2-LZY245 ~]# cd /root/tpcc-mysql-master/

[root@D2-LZY245 tpcc-mysql-master]# ./tpcc_load -h227.0.0.1 -dtpcc -uroot -p123456 -w5

其中w表示仓库的数量,数量越多,数据量也越大,这里只初始化了5个仓库。在生产环境中建议设置至少100以上。

如果提示找不到libmysqlclient.so.20,则需要创建下面的软连接:

[root@D2-LZY245 ~]# ln -s /usr/local/mysql/lib/libmysqlclient.so.20 /usr/lib64/libmysqlclient.so.20

4、测试

配置如下参数:

max_connections=3000

innodb_buffer_pool_size=1G

innodb_flush_log_at_trx_commit = 1

sync_binlog=1

innodb_support_xa=1

开始测试:

[root@D2-LZY245 tpcc-mysql-master]# ./tpcc_start -h227.0.0.1 -P3306 -dtpcc -uroot -p123456 -w5 -c10 -r10 -l60 -i5

***************************************

*** ###easy### TPC-C Load Generator ***

***************************************

option h with value '127.0.0.1'

option P with value '3306'

option d with value 'tpcc'

option u with value 'root'

option p with value '123456'

option w with value '5'

option c with value '10'

option r with value '10'

option l with value '60'

option i with value '5'

    [server]: 127.0.0.1

    [port]: 3306

    [DBname]: tpcc

      [user]: root

      [pass]: 123456

 [warehouse]: 5

 [connection]: 10

    [rampup]: 10 (sec.)

   [measure]: 60 (sec.)

RAMP-UP TIME.(10 sec.)

MEASURING START.

  5, trx: 893, 95%: 42.974, 99%: 51.769, max_rt: 78.867, 897|64.315, 89|34.091, 90|108.740, 89|153.851

 10, trx: 899, 95%: 42.513, 99%: 47.764, max_rt: 56.527, 897|45.126, 90|11.137, 90|107.048, 90|151.175

 15, trx: 921, 95%: 41.732, 99%: 48.921, max_rt: 74.593, 919|61.086, 93|11.268, 91|122.762, 91|117.930

 20, trx: 905, 95%: 42.184, 99%: 47.308, max_rt: 72.272, 906|38.270, 90|10.840, 92|126.833, 91|138.162

 25, trx: 918, 95%: 42.260, 99%: 51.183, max_rt: 66.282, 914|39.754, 92|10.141, 91|126.593, 91|127.785

 30, trx: 934, 95%: 42.285, 99%: 50.212, max_rt: 56.423, 939|37.721, 93|12.561, 93|114.696, 94|133.147

 35, trx: 948, 95%: 41.532, 99%: 49.808, max_rt: 59.926, 945|35.327, 95|6.179, 95|104.323, 95|125.155

 40, trx: 949, 95%: 40.562, 99%: 46.411, max_rt: 65.310, 950|49.201, 95|7.696, 96|117.888, 94|131.387

 45, trx: 953, 95%: 40.067, 99%: 46.689, max_rt: 61.701, 955|50.164, 95|5.216, 95|110.307, 96|118.410

 50, trx: 953, 95%: 40.537, 99%: 47.864, max_rt: 87.589, 950|48.743, 95|6.670, 95|118.108, 95|138.823

 55, trx: 947, 95%: 39.995, 99%: 46.203, max_rt: 62.354, 948|41.478, 95|6.599, 94|114.913, 95|132.025

 60, trx: 986, 95%: 40.477, 99%: 45.516, max_rt: 59.243, 982|37.025, 98|8.749, 99|105.574, 99|127.634

STOPPING THREADS..........

 [0] sc:44 lt:11162 rt:0 fl:0 avg_rt: 32.3 (5)

 [1] sc:1734 lt:9468 rt:0 fl:0 avg_rt: 9.3 (5)

 [2] sc:1063 lt:57 rt:0 fl:0 avg_rt: 3.3 (5)

 [3] sc:690 lt:431 rt:0 fl:0 avg_rt: 90.5 (80)

 [4] sc:0 lt:1120 rt:0 fl:0 avg_rt: 114.3 (20)

 in 60 sec.

 [0] sc:44 lt:11162 rt:0 fl:0

 [1] sc:1734 lt:9469 rt:0 fl:0

 [2] sc:1063 lt:57 rt:0 fl:0

 [3] sc:690 lt:431 rt:0 fl:0

 [4] sc:0 lt:1120 rt:0 fl:0

(all must be [OK])

 [transaction percentage]

       Payment: 43.47% (>=43.0%) [OK]

  Order-Status: 4.35% (>= 4.0%) [OK]

      Delivery: 4.35% (>= 4.0%) [OK]

   Stock-Level: 4.35% (>= 4.0%) [OK]

 [response time (at least 90% passed)]

     New-Order: 0.39% [NG] *

       Payment: 15.48% [NG] *

  Order-Status: 94.91% [OK]

      Delivery: 61.55% [NG] *

   Stock-Level: 0.00% [NG] *

11206.000 TpmC

其中:

-w:仓库数量

-c:并发线程数

-r:预热时间,以秒为单位,默认10秒,主要目的是为了将数据加载到内存。

-l:运行时间,以秒为单位,默认20秒

-i:输出时间间隔

真实测试场景中,建议预热时间不小于5分钟,持续压测时长不小于30分钟,否则测试数据可能不具参考意义。

5、结果

  5, trx: 893, 95%: 42.974, 99%: 51.769, max_rt: 78.867, 897|64.315, 89|34.091, 90|108.740, 89|153.851

5表示从测试开始到现在的时间为5秒。

trx: 893表示这个时间间隔完成的新订单事物数量,实际上就是吞吐量,越大越好。

95%: 42.974表示这个时间间隔内95%的新订单事物响应时间为42.974秒。

99%: 51.769表示这个时间间隔内99%的新订单事物响应时间为51.769秒。

max_rt: 78.867表示这个时间间隔内新订单事物最大响应时间为78.867秒。

897|64.315, 89|34.091, 90|108.740, 89|153.851这几个表示其他种类事物的吞吐量和响应时间,可以忽略。

 [0] sc:44 lt:11162 rt:0 fl:0 avg_rt: 32.3 (5) //表示新订单业务成功(success,简写sc)次数,延迟(late,简写lt)次数,重试(retry,简写rt)次数,失败(failure,简写fl)次数。

 [1] sc:1734 lt:9468 rt:0 fl:0 avg_rt: 9.3 (5) //表示支付业务成功(success,简写sc)次数,延迟(late,简写lt)次数,重试(retry,简写rt)次数,失败(failure,简写fl)次数。

 [2] sc:1063 lt:57 rt:0 fl:0 avg_rt: 3.3 (5) //表示订单状态业务成功(success,简写sc)次数,延迟(late,简写lt)次数,重试(retry,简写rt)次数,失败(failure,简写fl)次数。

 [3] sc:690 lt:431 rt:0 fl:0 avg_rt: 90.5 (80) //表示发货业务成功(success,简写sc)次数,延迟(late,简写lt)次数,重试(retry,简写rt)次数,失败(failure,简写fl)次数。

 [4] sc:0 lt:1120 rt:0 fl:0 avg_rt: 114.3 (20) //表示库存业务成功(success,简写sc)次数,延迟(late,简写lt)次数,重试(retry,简写rt)次数,失败(failure,简写fl)次数。

(all must be [OK]) //下面所有的结果必须为OK

 [transaction percentage]

       Payment: 43.47% (>=43.0%) [OK] //支付模块占总业务的43.47%

  Order-Status: 4.35% (>= 4.0%) [OK] //订单状态模块占总业务的4.35%

      Delivery: 4.35% (>= 4.0%) [OK] //发货模块占总业务的4.35%

   Stock-Level: 4.35% (>= 4.0%) [OK] //库存模块占总业务的4.35%

 [response time (at least 90% passed)] //响应时间是否满足

     New-Order: 0.39% [NG] *

       Payment: 15.48% [NG] *

  Order-Status: 94.91% [OK]

      Delivery: 61.55% [NG] *

   Stock-Level: 0.00% [NG] *

指标如下:

New-Order 5ms

Payment 5ms

Order-Status 5ms

Delivery 80ms

Stock-Level 20ms

11206.000 TpmC //每分钟能够处理的新订单数量。

(编辑:银川站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章