tpcc-mysql安裝測試與使用生成對比圖


1:下載tpcc-mysql的壓縮包,從下面的網站進行下載
也可直接從葉總博客直接下載:
我這邊使用的就是后者。
2:安裝tpcc-mysql
[root@mxqmongodb2 tpccmysql]# gunzip tpcc-mysql-src.tgz
[root@mxqmongodb2 tpccmysql]# tar xf tpcc-mysql-src.tar
[root@mxqmongodb2 tpcc-mysql-master]# cd src/
[root@mxqmongodb2 src]# make
[root@mxqmongodb2 src]# cd ..
[root@mxqmongodb2 tpcc-mysql-master]# ls
add_fkey_idx.sql count.sql create_table.sql Dockerfile drop_cons.sql load_multi_schema.sh load.sh README.md schema2 scripts src tpcc_load tpcc_start

 

我們看到,安裝完成以后是會有 tpcc_load tpcc_start兩個可執行文件的。基本上已經安裝完成了,下面看一下測試
3:測試:上面是基本的安裝,安裝以后在進行測試,mysql版本.
首先安裝完成以后就要做初始化:
mysql> create database tpcc1000;
Query OK, 1 row affected (0.04 sec)
mysql> use tpcc1000;
Database changed
mysql> source /home/tpccmysql/tpcc-mysql-master/create_table.sql;
mysql> source /home/tpccmysql/tpcc-mysql-master/add_fkey_idx.sql;

 

然后開始往數據庫當中追加數據:
在這里,需要注意的是 tpcc 默認會讀取 /var/lib/mysql/mysql.sock 這個socket 文件。因此,如果你的 socket 文件不在相應路徑的話,可以做個軟連接,或者通過TCP/IP的方式連接測試服務器。真實測試場景中,倉庫數一般不建議少於100個,視服務器硬件配置而定。
執行下面的命令,開始灌入測試數據:(本人的是虛擬機,倉庫數就弄了30,省得壓死了)
[root@mxqmongodb2 tpcc-mysql-master]# ./tpcc_load -h10.103.16.35 -P3306 -d tpcc1000 -u root -p 123456 30
下面就要開始測試了,看一下tpcc_start的一些參數:
-w 指定倉庫數量 -c 指定並發連接數 -r 指定開始測試前進行warmup的時間,進行預熱后,測試效果更好 -l 指定測試持續時間 -i 指定生成報告間隔時長 -f 指定生成的報告文件名
看一下幫助:
[root@mxqmongodb2 tpcc-mysql-master]# ./tpcc_start --help
***************************************
*** ###easy### TPC-C Load Generator ***
***************************************
./tpcc_start: invalid option -- '-'
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_start -h10.103.16.35 -P3306 -dtpcc1000 -uroot -p123456 -w30 -c50 -r300 -l600

 

真實測試場景中,建議預熱時間不小於5分鍾,持續壓測時長不小於30分鍾,否則測試數據可能不具參考意義(我們預熱1分鍾,壓測10分鍾),下面看一下結果:
[root@mxqmongodb2 tpcc-mysql]# ./tpcc_start -h127.0.0.1 -P3306 -d tpcc -u root -p123456 -w 10 -c 50 -r 30 -l 300
***************************************
*** ###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 '10'
option c with value '50'
option r with value '30'
option l with value '300'
<Parameters>
[server]: 127.0.0.1
[port]: 3306
[DBname]: tpcc
[user]: root
[pass]: 123456
[warehouse]: 10
[connection]: 50
[rampup]: 30 (sec.)
[measure]: 300 (sec.)
 
RAMP-UP TIME.(30 sec.)
 
MEASURING START.
 
10, 140(0):3.055|3.476, 141(0):0.693|0.975, 14(0):0.326|0.334, 11(0):3.550|3.593, 15(0):9.091|9.119
20, 240(0):3.092|3.143, 242(0):0.668|0.730, 24(0):0.320|0.356, 26(0):3.533|3.596, 23(0):8.280|8.480
30, 232(0):2.981|3.110, 233(0):0.680|1.052, 23(0):0.329|0.360, 24(0):3.591|3.596, 23(0):9.042|9.407
40, 137(0):3.148|3.968, 136(0):0.658|0.713, 14(0):0.329|0.353, 13(0):3.677|3.682, 15(0):8.660|9.289
50, 149(0):2.984|3.334, 145(0):0.662|0.665, 14(0):0.310|0.334, 14(0):3.572|3.687, 13(0):9.155|9.497
60, 137(0):2.863|3.152, 142(0):0.674|0.689, 15(0):0.247|0.262, 14(0):3.308|3.548, 15(0):8.362|9.236
70, 157(0):3.144|3.410, 152(0):0.619|0.681, 15(0):0.339|0.414, 16(0):3.546|3.610, 16(0):8.440|9.627
80, 184(0):3.073|3.221, 182(0):0.678|0.707, 18(0):0.352|0.352, 18(0):3.693|3.766, 19(0):8.643|9.020
90, 192(0):3.035|3.668, 196(0):0.658|0.793, 20(0):0.298|0.400, 19(0):3.572|4.125, 18(0):8.267|9.535
100, 156(0):3.041|3.301, 153(0):0.647|0.679, 15(0):0.276|0.279, 16(0):3.436|3.497, 17(0):8.379|8.510
110, 167(0):2.900|3.178, 168(0):0.663|0.674, 17(0):0.294|0.297, 16(0):3.517|3.625, 16(0):8.262|8.626
120, 188(0):3.094|3.217, 190(0):0.638|0.740, 19(0):0.276|0.288, 20(0):3.472|3.697, 19(0):8.589|8.891
130, 161(0):3.295|3.617, 163(0):0.668|0.717, 16(0):0.346|0.393, 15(0):3.421|3.730, 16(0):9.250|10.387
140, 171(0):2.938|3.343, 168(0):0.683|0.714, 17(0):0.312|0.321, 18(0):3.471|3.513, 18(0):8.190|8.602
150, 179(0):3.029|3.250, 178(0):0.694|0.813, 18(0):0.329|0.331, 16(0):3.571|3.623, 16(0):8.097|8.610
160, 123(0):2.938|3.333, 119(0):0.606|0.621, 12(0):0.278|0.293, 13(0):3.497|3.506, 13(0):8.327|8.454
170, 175(0):3.130|3.595, 179(0):0.666|0.778, 17(0):0.274|0.277, 18(0):3.638|4.027, 18(0):8.762|9.156
180, 187(0):3.146|3.427, 187(0):0.704|0.743, 20(0):0.312|0.322, 19(0):3.562|3.593, 18(0):8.282|9.524
190, 146(0):2.926|3.112, 143(0):0.641|0.701, 14(0):0.301|0.339, 14(0):3.475|3.592, 15(0):7.896|8.596
200, 189(0):3.028|3.277, 200(0):0.661|0.730, 19(0):0.300|0.319, 20(0):3.550|3.595, 20(0):8.361|8.659
210, 191(0):2.910|3.196, 184(0):0.618|0.720, 19(0):0.324|0.329, 17(0):3.448|3.463, 18(0):8.372|8.558
220, 143(0):3.057|3.116, 162(0):0.655|0.691, 15(0):0.259|0.355, 15(0):3.519|3.547, 14(0):8.816|8.893
230, 189(0):2.930|3.057, 169(0):0.630|0.682, 18(0):0.331|0.349, 19(0):3.575|3.864, 19(0):8.359|8.391
240, 131(0):2.958|3.035, 130(0):0.643|0.681, 14(0):0.273|0.326, 12(0):3.490|3.520, 13(0):8.671|9.160
250, 125(0):2.939|3.237, 124(0):0.659|0.707, 12(0):0.301|0.367, 12(0):3.464|3.527, 13(0):8.643|8.774
260, 127(0):2.895|2.983, 131(0):0.669|0.704, 13(0):0.328|0.360, 16(0):3.468|3.665, 12(0):8.433|8.562
270, 177(0):2.962|3.375, 174(0):0.686|0.722, 17(0):0.302|0.364, 16(0):3.548|3.629, 18(0):8.309|8.354
280, 139(0):2.874|3.047, 142(0):0.675|0.935, 15(0):0.280|0.294, 16(0):3.483|3.628, 14(0):8.154|8.730
290, 163(0):3.132|3.213, 162(0):0.636|0.663, 15(0):0.282|0.313, 15(0):3.654|3.925, 17(0):8.172|8.245
300, 147(0):3.024|3.230, 142(0):0.692|1.405, 16(0):0.265|0.300, 15(0):3.452|3.475, 14(0):8.518|9.214
 
STOPPING THREADS..................................................
 
<Raw Results> -- 第一次統計結果
[0] sc:4942 lt:0 rt:0 fl:0 -- New-Order,新訂單業務成功(success,簡寫sc)次數,延遲(late,簡寫lt)次數,重試(retry,簡寫rt)次數,失敗(failure,簡寫fl)次數
[1] sc:4937 lt:0 rt:0 fl:0 -- Payment,支付業務統計
[2] sc:495 lt:0 rt:0 fl:0 -- Order-Status,訂單狀態業務統計
[3] sc:493 lt:0 rt:0 fl:0 -- Delivery,發貨業務統計
[4] sc:495 lt:0 rt:0 fl:0 -- Stock-Level,庫存業務統計
in 300 sec.
 
<Raw Results2(sum ver.)> -- 第二次統計結果
[0] sc:4944 lt:0 rt:0 fl:0
[1] sc:4940 lt:0 rt:0 fl:0
[2] sc:495 lt:0 rt:0 fl:0
[3] sc:493 lt:0 rt:0 fl:0
[4] sc:495 lt:0 rt:0 fl:0
 
<Constraint Check> (all must be [OK]) -- 下面所有業務邏輯結果都必須為 OK 才行
[transaction percentage]
Payment: 43.45% (>=43.0%) [OK]
Order-Status: 4.36% (>= 4.0%) [OK]
Delivery: 4.34% (>= 4.0%) [OK]
Stock-Level: 4.36% (>= 4.0%) [OK]
[response time (at least 90% passed)]
New-Order: 100.00% [OK]
Payment: 100.00% [OK]
Order-Status: 100.00% [OK]
Delivery: 100.00% [OK]
Stock-Level: 100.00% [OK]
 
<TpmC>
988.400 TpmC-- TpmC結果值(每分鍾事務數,該值是第一次統計結果中的新訂單事務數除以總耗時分鍾數)

 

4:統計結果分析
我們看一下自己的INNODB配置:
mysql> show variables like 'innodb_buffer_pool_size';
+-------------------------+------------+
| Variable_name | Value |
+-------------------------+------------+
| innodb_buffer_pool_size | 2147483648 |
+-------------------------+------------+
1 row in set (0.17 sec)

 

大小是2048M,我們現在把innodb_buffer_pool_size 為2048修改為128,並且保留兩者的壓測的數據,重定向到一個文件:
[root@mxqmongodb2 tpcc-mysql]# ./tpcc_start -h127.0.0.1 -P3306 -d tpcc -u root -p123456 -w 10 -c 50 -r 10 -l 120 >/home/sa/tpcc_output_2048.log

 

修改innodb_buffer_pool_size:
mysql> set global innodb_buffer_pool_size=134217728;
Query OK, 0 rows affected (0.05 sec)
mysql> show variables like 'innodb_buffer_pool_size';
+-------------------------+------------+
| Variable_name | Value |
+-------------------------+------------+
| innodb_buffer_pool_size | 134217728|
+-------------------------+------------+
1 row in set (0.01 sec)
[root@mxqmongodb2 tpcc-mysql]# ./tpcc_start -h127.0.0.1 -P3306 -d tpcc -u root -p123456 -w 10 -c 50 -r 10 -l 1200 >/home/sa/tpcc_output_128.log

 

然后將兩個文件進行處理
[root@mxqmongodb2 sa]# cat tpcc_output_128.log | grep '(0)' | grep -v HY000 | grep -v payment | grep -v neword | awk -F ':' '{print $1}' |awk -F ',' '{print $1 $2}'|sed 's/(0)//g'|sed 's/(1)//g'>tpcc_output_1128.txt
[root@mxqmongodb2 sa]# cat tpcc_output_2048.log | grep '(0)' | grep -v HY000 | grep -v payment | grep -v neword | awk -F ':' '{print $1}' |awk -F ',' '{print $1 $2}'|sed 's/(0)//g'|sed 's/(1)//g'>tpcc_output_2048.txt

 

合並兩個文件:
[root@mxqmongodb2 sa]# paste tpcc_output_128.txt tpcc_output_2048.txt > tpcc-graph-data128.txt
[root@mxqmongodb2 sa]# ./tpcc-graph-build.sh tpcc-graph-data128.txt tpcc-graph128-2048.jpg

 

然后將tpcc-graph.jpg拷貝出來,看一下具體效果如下:
下面看一下tpcc-graph-build腳本:
#!/bin/bash
### goto user homedir and remove previous file
rm -f '$2'
gnuplot << EOP
### set data source file
datafile = '$1'
### set graph type and size
set terminal jpeg size 640,480
### set titles
set grid x y
set xlabel "Time (sec)"
set ylabel "Transactions"
### set output filename
set output '$2'
### build graph
# plot datafile with lines
plot datafile title "PS 5.7, buffer pool: 128M" with lines,datafile using 3:4 title "PS 5.7, buffer pool: 2048M" with lines axes x1y1
EOP

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM