TPCC-MySQL基準測試

來源:互聯網
上載者:User

TPCC-MySQL基準測試

TPCC-MySQL是Percona公司研發的基準測試載入器。

下載TPCC-MySQL

  1. yum install bzr -y
  2. bzr branch lp:~percona-dev/perconatools/tpcc-mysql

下載之後可以看到tpcc-mysql目錄
進入這個目錄下的src目錄,執行make
在上層目錄中,可以看到已經有了tpcc_load tpcc_start命令

如果有如下錯誤,則可能是源碼安裝的MySQL,所以它的庫不在預設的位置

  1. error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

建立軟連結可以解決這個問題。

  1. ln -s /home/lihuilin/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18


建立一個測試資料庫,然後使用如下配置進行基準測試

  1. create database tpcc;
  2. MySQL配置如下
  3. max_connections=3000
  4. innodb_buffer_pool_size=1G
  5. innodb_flush_log_at_trx_commit = 1
  6. sync_binlog=1
  7. innodb_support_xa=1

首先載入資料,執行建立表和約束的SQL

這個工具是類比倉庫的系統,
可以選擇初始化倉庫的數量,數量越大,資料量也越大。

初始化10個倉庫



開始進行基準測試,其中w指倉庫數量,c指並發數量,r是預熱時間,l是測試回合時間

  1. [root@mysql1 tpcc-mysql]# ./tpcc_start -h 127.0.0.1 -u xx -p xx -d tpcc -w 10 -c 200 -r 10 -l 60 -i 10 -f report -t trx
  2. Usage: tpcc_start -h server_host -P port -d database_name -u mysql_user -p mysql_password -w warehouses -c connections -r warmup_time -l running_time -i report_interval -f report_file -t trx_file





TPCC-MySQL輸出結果包括五個商務邏輯,這五個商務邏輯構成了TPCC-MySQL測試的整個交易處理過程。具體如下所示:
New-Order:新訂單
Payment:支付
Order-Status:訂單查詢
Delivery:發貨
Stock-Level:庫存

預定義變數:
為了能夠清晰的說明以下內容,首先定義一些變數,便於以下的計算和說明。具體如下所示:
success = 執行成功的記錄數
late=執行延遲的記錄數
pre_success=上一次執行成功的記錄數
pre_late=上一次執行失敗的記錄數

根據以上定義的變數,計算相應欄位的結果和說明相應欄位的含義。
1、時間間隔內成功的事務(包括成功和延遲交易):sl=success+late-pre_success-pre_late
2、時間間隔內延遲交易:l=late-pre_late
3、時間間隔內前90%記錄(實際為99%)的平均回應時間:rt90
4、時間間隔內最大的回應時間:max_rt

查看TPCC的結果

  1. 新訂單模組 支付模組
  2. sl(l):rt90|max_rt 1822成功(0延遲):90%平均回應時間1.256|最長回應時間4.119
  3. 10, 1879(6):4.024|9.398, 1822(0):1.256|4.119, 190(0):0.712|2.017, 186(0):5.227|5.929, 191(0):18.450|24.997

sc:success,lt:late,rt:retry,fl:failure

  1. <Raw Results>
  2. [0] sc:8677 lt:13 rt:0 fl:0 //新訂單數
  3. [1] sc:8620 lt:1 rt:0 fl:0 //支付業務
  4. [2] sc:872 lt:0 rt:0 fl:0 //查詢業務
  5. [3] sc:878 lt:0 rt:0 fl:0 //發貨業務
  6. [4] sc:871 lt:0 rt:0 fl:0 //庫存查詢
  7. in 60 sec.

 

  1. <Constraint Check> (all must be [OK])
  2. [transaction percentage]
  3. Payment: 43.25% (>=43.0%) [OK] //支付模組佔總業務的43.25%
  4. Order-Status: 4.37% (>= 4.0%) [OK] //訂單模組佔總業務的4.37%
  5. Delivery: 4.40% (>= 4.0%) [OK] //發貨模組佔總業務的4.40%
  6. Stock-Level: 4.37% (>= 4.0%) [OK] //庫存模組佔總業務的4.37%
  7. [response time (at least 90% passed)] //是否滿足指標
  8. New-Order: 99.85% [OK]
  9. Payment: 99.99% [OK]
  10. Order-Status: 100.00% [OK]
  11. Delivery: 100.00% [OK]
  12. Stock-Level: 100.00% [OK]

//指標如下
New-Order 5ms
Payment 5ms
Order-Status 5ms
Delivery 80ms
Stock-Level 20ms

  1. <TpmC>
  2. 8690.000 TpmC //每分鐘可完成新訂單業務8690筆

然後修改MySQL配置,再次運行相同測試

  1. innodb_buffer_pool_size=512m


可以看到效能有明顯下降。

 

--------------------------------------分割線 --------------------------------------

基準測試載入器之tpcc-mysql

MySQL基準測試載入器TPCC-MySQL使用筆記

MySQL 5.6.7-RC 的 tpcc-mysql 基準測試結果

Ubuntu 14.04下安裝MySQL

《MySQL權威指南(原書第2版)》清晰中文掃描版 PDF

Ubuntu 14.04 LTS 安裝 LNMP Nginx\PHP5 (PHP-FPM)\MySQL

Ubuntu 14.04下搭建MySQL主從服務���

Ubuntu 12.04 LTS 構建高可用分布式 MySQL 叢集

Ubuntu 12.04下原始碼安裝MySQL5.6以及Python-MySQLdb

--------------------------------------分割線 --------------------------------------

本文永久更新連結地址:

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.