- 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

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

The steps to build a MySQL database include: 1. Create a database and table, 2. Insert data, and 3. Conduct queries. First, use the CREATEDATABASE and CREATETABLE statements to create the database and table, then use the INSERTINTO statement to insert the data, and finally use the SELECT statement to query the data.

MySQL is suitable for beginners because it is easy to use and powerful. 1.MySQL is a relational database, and uses SQL for CRUD operations. 2. It is simple to install and requires the root user password to be configured. 3. Use INSERT, UPDATE, DELETE, and SELECT to perform data operations. 4. ORDERBY, WHERE and JOIN can be used for complex queries. 5. Debugging requires checking the syntax and use EXPLAIN to analyze the query. 6. Optimization suggestions include using indexes, choosing the right data type and good programming habits.

MySQL is suitable for beginners because: 1) easy to install and configure, 2) rich learning resources, 3) intuitive SQL syntax, 4) powerful tool support. Nevertheless, beginners need to overcome challenges such as database design, query optimization, security management, and data backup.

Yes,SQLisaprogramminglanguagespecializedfordatamanagement.1)It'sdeclarative,focusingonwhattoachieveratherthanhow.2)SQLisessentialforquerying,inserting,updating,anddeletingdatainrelationaldatabases.3)Whileuser-friendly,itrequiresoptimizationtoavoidper

ACID attributes include atomicity, consistency, isolation and durability, and are the cornerstone of database design. 1. Atomicity ensures that the transaction is either completely successful or completely failed. 2. Consistency ensures that the database remains consistent before and after a transaction. 3. Isolation ensures that transactions do not interfere with each other. 4. Persistence ensures that data is permanently saved after transaction submission.

MySQL is not only a database management system (DBMS) but also closely related to programming languages. 1) As a DBMS, MySQL is used to store, organize and retrieve data, and optimizing indexes can improve query performance. 2) Combining SQL with programming languages, embedded in Python, using ORM tools such as SQLAlchemy can simplify operations. 3) Performance optimization includes indexing, querying, caching, library and table division and transaction management.

MySQL uses SQL commands to manage data. 1. Basic commands include SELECT, INSERT, UPDATE and DELETE. 2. Advanced usage involves JOIN, subquery and aggregate functions. 3. Common errors include syntax, logic and performance issues. 4. Optimization tips include using indexes, avoiding SELECT* and using LIMIT.


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Zend Studio 13.0.1
Powerful PHP integrated development environment

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 English version
Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.