TPCC-MySQL基准测试_MySQL
- yum install bzr -y
- bzr branch lp:~percona-dev/perconatools/tpcc-mysql
下载之后可以看到tpcc-mysql目录
进入这个目录下的src目录,执行make
在上层目录中,可以看到已经有了tpcc_load tpcc_start命令
如果有如下错误,则可能是源码安装的MySQL,所以它的库不在默认的位置
- error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
- ln -s /home/lihuilin/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18
- create database tpcc;
- MySQL配置如下
- max_connections=3000
- innodb_buffer_pool_size=1G
- innodb_flush_log_at_trx_commit = 1
- sync_binlog=1
- innodb_support_xa=1
首先加载数据,执行创建表和约束的SQL

这个工具是模拟仓库的系统,
可以选择初始化仓库的数量,数量越大,数据量也越大。

初始化10个仓库

开始进行基准测试,其中w指仓库数量,c指并发数量,r是预热时间,l是测试运行时间
- [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
- 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的结果
- 新订单模块 支付模块
- sl(l):rt90|max_rt1822成功(0延迟):90%平均响应时间1.256|最长响应时间4.119
- 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
- [0] sc:8677 lt:13 rt:0 fl:0 //新订单数
-
[1] sc:8620 lt:1 rt:0 fl:0 //支付业务
-
[2] sc:872 lt:0 rt:0 fl:0 //查询业务
-
[3] sc:878 lt:0 rt:0 fl:0 //发货业务
-
[4] sc:871 lt:0 rt:0 fl:0 //库存查询
- in 60 sec.
(all must be [OK]) - [transaction percentage]
-
Payment: 43.25% (>=43.0%) [OK] //支付模块占总业务的43.25%
-
Order-Status: 4.37% (>= 4.0%) [OK] //订单模块占总业务的4.37%
-
Delivery: 4.40% (>= 4.0%) [OK] //发货模块占总业务的4.40%
-
Stock-Level: 4.37% (>= 4.0%) [OK] //库存模块占总业务的4.37%
-
[response time (at least 90% passed)] //是否满足指标
- New-Order: 99.85% [OK]
- Payment: 99.99% [OK]
- Order-Status: 100.00% [OK]
- Delivery: 100.00% [OK]
- Stock-Level: 100.00% [OK]
//指标如下
New-Order 5ms
Payment 5ms
Order-Status 5ms
Delivery 80ms
Stock-Level 20ms
-
8690.000 TpmC //每分钟可完成新订单业务8690笔
- innodb_buffer_pool_size=512m
可以看到性能有明显下降。
然后修改MySQL配置,再次运行相同测试
sc:success,lt:late,rt:retry,fl:failure
创建一个测试数据库,然后使用如下配置进行基准测试
创建软链接可以解决这个问题。
TPCC-MySQL是Percona公司研发的基准测试工具。
下载TPCC-MySQL

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

The difference between clustered index and non-clustered index is: 1. Clustered index stores data rows in the index structure, which is suitable for querying by primary key and range. 2. The non-clustered index stores index key values and pointers to data rows, and is suitable for non-primary key column queries.

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

MySQL supports four index types: B-Tree, Hash, Full-text, and Spatial. 1.B-Tree index is suitable for equal value search, range query and sorting. 2. Hash index is suitable for equal value searches, but does not support range query and sorting. 3. Full-text index is used for full-text search and is suitable for processing large amounts of text data. 4. Spatial index is used for geospatial data query and is suitable for GIS applications.

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.
