测试环境:centos 6.6
mysql数据库版本:5.6.23-72.1-log Percona Server
阅读前 请确保了解基本的tpcc基准测试模型和概念:可参考:http://baike.baidu.com/link?url=-lUUdL2pU3KrrjfGSpbYRd-gJ2PAQUwvK4qZBkByVLEEF03t3yO6H4LNqT8cdJBqYqUd3Qn5d2T7mO-guvxFW_
- 安装tpcc-mysql测试工具(注意:网上介绍的bzr工具方式安装已无法使用,源码已迁移到github)
a安装依赖库:yum install openssl-devel (若已安装请忽略)
若没有安装会执行make编译时会报“/usr/bin/ld: cannot find -lssl”
- b安装mysql_configure
我用的rpm包安装的数据库,之前没有安装Percona-Server-devel
rpm -ivh Percona-Server-devel-56-5.6.23-rel72.1.el6.x86_64.rpm
若已有mysql_configure命令请忽略此步骤
- c wget https://github.com/Percona-Lab/tpcc-mysql/archive/master.zip
解压 unzip master.zip 后进入src目录 执行make命令
cd /tpcc-mysql-master/src&& make
安装完成进入上级目录会看到已安装的tpcc_load tpcc_start命令工具
[[email protected] tpcc-mysql-master]# pwd
/backup/tpcc-mysql-master
[[email protected] tpcc-mysql-master]# ls
add_fkey_idx.sql count.sql create_table.sql drop_cons.sql load_multi_schema.sh load.sh README.md schema2 scripts src tpcc_load tpcc_start
导入测试数据
- 创建测试库
mysqladmin create tpcc20
- 创建测试表
mysql tpcc20 < create_table.sql
- 创建索引 ( this step can be done after loading data)
mysql tpcc1000 < add_fkey_idx.sql
- 创建原始数据,导入20个仓库(这里的仓库和数据仓库不是一个概念,具体请参考tpcc基准测试介绍)
./tpcc_load -P3306 -uroot -h10.8.61.31 -p "password" -dtpcc20 -w20; 参数说明: 端口号|账号|数据库ip|密码|库名|仓库数量。仓库数据量比较大,若超过5个仓库建议使用load.sh脚本可以并发任务。具体more load.sh。
开始测试
./tpcc_start -P3306 -uroot -h10.8.61.31 -p "password" -dtpcc20 -w20 -c200 -r30 -l600; 参数说明:端口号|账号|数据库ip|密码|库名|仓库数量|并发数|预热时间(正式压力测试前)|基准测试时间
4 测试结果
MEASURING START. 10, trx: 4700, 95%: 428.940, 99%: 885.645, max_rt: 1920.296, 4757|3566.813, 473|255.802, 462|2702.691, 479|893.191 20, trx: 5643, 95%: 305.109, 99%: 614.508, max_rt: 1015.003, 5608|1684.128, 562|206.708, 568|1004.167, 559|692.252 30, trx: 4746, 95%: 405.346, 99%: 711.375, max_rt: 1196.385, 4772|1968.726, 476|206.029, 474|1066.785, 476|687.413 40, trx: 4441, 95%: 430.483, 99%: 812.735, max_rt: 1261.233, 4417|1968.184, 443|204.180, 440|1357.476, 454|679.320 50, trx: 4159, 95%: 744.044, 99%: 969.728, max_rt: 1534.601, 4173|2324.394, 416|607.596, 422|1446.548, 411|683.274 60, trx: 4504, 95%: 370.754, 99%: 875.890, max_rt: 1448.355, 4467|2240.447, 450|205.589, 449|1276.708, 455|690.625 70, trx: 5077, 95%: 381.677, 99%: 830.690, max_rt: 1249.186, 5105|2115.777, 509|211.996, 502|1297.547, 505|862.763 80, trx: 3533, 95%: 694.126, 99%: 1190.421, max_rt: 1514.771, 3561|2252.089, 354|205.268, 360|1572.588, 354|710.957 90, trx: 4800, 95%: 628.272, 99%: 918.586, max_rt: 1255.853, 4749|2297.545, 478|207.880, 483|1187.023, 476|681.710 100, trx: 5394, 95%: 308.415, 99%: 640.233, max_rt: 1277.130, 5425|2618.926, 540|204.686, 536|1164.268, 529|747.695 110, trx: 4045, 95%: 677.093, 99%: 964.517, max_rt: 1472.178, 4009|2763.736, 402|207.217, 406|1266.781, 403|705.090 120, trx: 5029, 95%: 385.235, 99%: 751.430, max_rt: 1383.705, 5072|1481.077, 506|202.096, 499|1391.187, 515|698.176 130, trx: 4749, 95%: 373.651, 99%: 699.968, max_rt: 1131.529, 4762|1910.060, 475|205.153, 471|1397.526, 482|879.531 140, trx: 4200, 95%: 756.622, 99%: 1067.530, max_rt: 1352.236, 4191|2024.030, 419|204.160, 416|1455.315, 409|860.392 150, trx: 5565, 95%: 290.405, 99%: 799.225, max_rt: 1532.885, 5521|2055.414, 556|206.612, 567|1431.614, 557|687.511 160, trx: 4125, 95%: 691.016, 99%: 938.036, max_rt: 1397.399, 4133|3230.433, 412|203.584, 406|1355.051, 408|734.559 170, trx: 3170, 95%: 939.441, 99%: 1126.628, max_rt: 1516.002, 3205|2210.551, 319|210.435, 316|1998.869, 332|676.829 180, trx: 5652, 95%: 322.675, 99%: 804.987, max_rt: 1328.751, 5650|2511.995, 564|207.887, 570|1386.244, 544|888.548 190, trx: 3348, 95%: 845.238, 99%: 1045.707, max_rt: 1414.300, 3322|2175.770, 335|204.274, 340|1387.906, 355|709.723 200, trx: 4829, 95%: 406.196, 99%: 905.753, max_rt: 1318.476, 4852|2501.958, 483|205.114, 473|1238.977, 473|680.581 210, trx: 4147, 95%: 714.362, 99%: 986.711, max_rt: 1310.247, 4116|2189.404, 414|205.126, 425|1457.890, 409|871.530 220, trx: 4735, 95%: 384.429, 99%: 831.437, max_rt: 1380.657, 4782|2095.396, 476|203.546, 468|1453.987, 479|714.391 230, trx: 5162, 95%: 320.557, 99%: 616.351, max_rt: 1433.349, 5145|2195.136, 514|205.807, 514|1145.519, 509|711.853 240, trx: 4851, 95%: 357.780, 99%: 920.788, max_rt: 1337.256, 4852|1974.231, 486|207.196, 484|1510.378, 493|689.413 250, trx: 4435, 95%: 443.033, 99%: 948.200, max_rt: 1349.656, 4455|2971.600, 444|205.080, 443|1347.988, 438|646.253 260, trx: 4655, 95%: 395.163, 99%: 855.676, max_rt: 1272.236, 4640|2248.044, 465|209.923, 464|1267.537, 467|680.635 270, trx: 4617, 95%: 420.926, 99%: 983.173, max_rt: 1187.771, 4577|1832.442, 461|205.876, 474|1494.718, 463|680.334 280, trx: 5279, 95%: 307.125, 99%: 776.585, max_rt: 1194.467, 5277|2143.208, 527|401.945, 520|1301.845, 531|909.279 290, trx: 5011, 95%: 339.418, 99%: 783.121, max_rt: 1134.000, 5049|1658.640, 501|605.879, 501|1274.438, 501|545.094 300, trx: 4366, 95%: 504.646, 99%: 948.483, max_rt: 1304.767, 4349|2097.574, 437|32.417, 432|1458.425, 441|518.310 310, trx: 3960, 95%: 686.481, 99%: 858.498, max_rt: 1035.270, 3964|2396.634, 398|207.142, 396|1301.402, 401|677.568 320, trx: 4800, 95%: 387.897, 99%: 848.534, max_rt: 1148.947, 4805|3124.958, 479|209.718, 481|1403.409, 469|570.137 330, trx: 4184, 95%: 441.181, 99%: 833.181, max_rt: 1165.305, 4196|2712.584, 418|208.606, 418|1550.491, 418|667.355 340, trx: 5276, 95%: 299.678, 99%: 602.127, max_rt: 971.093, 5276|2727.185, 528|206.957, 528|1174.649, 534|493.693 350, trx: 4419, 95%: 399.683, 99%: 879.042, max_rt: 1258.422, 4427|2692.648, 442|210.444, 440|1675.907, 435|519.607 360, trx: 4723, 95%: 346.294, 99%: 810.306, max_rt: 1145.448, 4723|1713.288, 473|203.770, 465|1606.423, 483|506.055 370, trx: 5085, 95%: 322.289, 99%: 463.102, max_rt: 747.190, 5068|2184.392, 508|204.656, 518|1347.677, 498|528.927 380, trx: 4663, 95%: 338.201, 99%: 923.825, max_rt: 1274.652, 4672|2289.740, 467|30.246, 466|1561.195, 479|531.999 390, trx: 4776, 95%: 362.306, 99%: 834.179, max_rt: 1137.897, 4786|2019.490, 477|207.067, 477|1440.193, 477|499.797 400, trx: 4798, 95%: 373.986, 99%: 520.759, max_rt: 1116.486, 4813|1935.966, 479|27.314, 482|1215.929, 478|688.037 410, trx: 4717, 95%: 326.171, 99%: 826.721, max_rt: 1305.971, 4684|1646.484, 472|203.365, 474|1339.575, 458|445.976 420, trx: 5064, 95%: 352.148, 99%: 484.660, max_rt: 673.180, 5096|1250.936, 508|39.405, 505|1045.664, 512|517.473 430, trx: 4815, 95%: 343.404, 99%: 734.748, max_rt: 1112.121, 4791|1540.625, 480|209.914, 480|1834.704, 480|514.530 440, trx: 4767, 95%: 344.124, 99%: 673.656, max_rt: 927.917, 4752|1384.652, 476|205.878, 474|1082.319, 479|713.907 450, trx: 4515, 95%: 388.013, 99%: 812.249, max_rt: 1109.697, 4533|1707.772, 453|203.876, 455|2008.894, 456|506.964 460, trx: 4752, 95%: 360.251, 99%: 536.102, max_rt: 1247.768, 4756|1718.023, 475|54.577, 469|1383.047, 476|505.369 470, trx: 4864, 95%: 346.398, 99%: 714.576, max_rt: 1054.529, 4852|2087.399, 487|29.947, 495|1378.135, 483|492.999 480, trx: 4925, 95%: 319.312, 99%: 746.945, max_rt: 1052.444, 4915|1793.215, 491|34.054, 489|1252.328, 491|569.504 490, trx: 4555, 95%: 438.154, 99%: 700.388, max_rt: 1216.314, 4576|1473.310, 458|76.842, 460|1375.907, 465|371.818 500, trx: 4872, 95%: 340.130, 99%: 741.598, max_rt: 1161.157, 4877|1660.460, 485|209.654, 479|1095.486, 484|458.768 510, trx: 5063, 95%: 320.269, 99%: 432.939, max_rt: 715.263, 5055|1243.325, 506|33.111, 510|899.843, 499|414.171 520, trx: 4202, 95%: 431.128, 99%: 945.932, max_rt: 1512.428, 4226|2494.120, 422|29.256, 416|1902.241, 423|473.010 530, trx: 4765, 95%: 336.787, 99%: 735.849, max_rt: 1027.395, 4751|1862.714, 476|42.096, 484|1306.952, 470|387.847 540, trx: 4416, 95%: 376.457, 99%: 828.455, max_rt: 1049.297, 4419|2420.450, 441|43.589, 437|1381.193, 454|364.195 550, trx: 4485, 95%: 405.225, 99%: 592.649, max_rt: 1120.372, 4476|1792.942, 449|55.972, 449|1513.009, 443|582.111 560, trx: 4638, 95%: 350.046, 99%: 839.188, max_rt: 1270.343, 4633|1422.445, 465|202.123, 465|1628.613, 470|373.063 570, trx: 4509, 95%: 369.978, 99%: 940.849, max_rt: 1269.418, 4494|2367.761, 449|65.385, 450|1482.585, 449|413.966 580, trx: 4184, 95%: 422.188, 99%: 898.193, max_rt: 1148.696, 4182|1628.696, 418|53.012, 420|1607.173, 409|481.172 590, trx: 4148, 95%: 393.864, 99%: 922.719, max_rt: 1177.640, 4152|2156.057, 415|39.375, 413|1776.311, 425|559.922 600, trx: 3949, 95%: 552.723, 99%: 785.234, max_rt: 1036.021, 3925|1996.091, 394|42.687, 403|1283.490, 393|482.022 STOPPING THREADS........................................................................................................................................................................................................ <Raw Results> [0] sc:6 lt:277850 rt:0 fl:0 avg_rt: 133.1 (5) [1] sc:17007 lt:260864 rt:0 fl:0 avg_rt: 265.3 (5) [2] sc:21821 lt:5965 rt:0 fl:0 avg_rt: 5.5 (5) [3] sc:1963 lt:25820 rt:0 fl:0 avg_rt: 386.4 (80) [4] sc:0 lt:27798 rt:0 fl:0 avg_rt: 159.2 (20) in 600 sec. <Raw Results2(sum ver.)> [0] sc:6 lt:277852 rt:0 fl:0 [1] sc:17007 lt:260867 rt:0 fl:0 [2] sc:21821 lt:5965 rt:0 fl:0 [3] sc:1963 lt:25820 rt:0 fl:0 [4] sc:0 lt:27798 rt:0 fl:0 <Constraint Check> (all must be [OK]) [transaction percentage] Payment: 43.48% (>=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.00% [NG] * Payment: 6.12% [NG] * Order-Status: 78.53% [NG] * Delivery: 7.07% [NG] * Stock-Level: 0.00% [NG] * <TpmC> 27785.600 TpmC
测试结果分析参考:
http://blog.itpub.net/29254281/viewspace-1195589/