search
HomeDatabaseMysql TutorialTPCC-MySQL基准测试_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_rt1822成功(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

 

  1. [0] sc:8677 lt:13 rt:0 fl:0 //新订单数
  2. [1] sc:8620 lt:1 rt:0 fl:0 //支付业务

  3. [2] sc:872 lt:0 rt:0 fl:0 //查询业务

  4. [3] sc:878 lt:0 rt:0 fl:0 //发货业务

  5. [4] sc:871 lt:0 rt:0 fl:0 //库存查询

  6. in 60 sec.

 

  1. (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. 8690.000 TpmC //每分钟可完成新订单业务8690笔

 

  1. innodb_buffer_pool_size=512m

 

 

可以看到性能有明显下降。

然后修改MySQL配置,再次运行相同测试

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

创建一个测试数据库,然后使用如下配置进行基准测试

创建软链接可以解决这个问题。

TPCC-MySQL是Percona公司研发的基准测试工具。

下载TPCC-MySQL

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
MySQL's Role: Databases in Web ApplicationsMySQL's Role: Databases in Web ApplicationsApr 17, 2025 am 12:23 AM

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.

MySQL: Building Your First DatabaseMySQL: Building Your First DatabaseApr 17, 2025 am 12:22 AM

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: A Beginner-Friendly Approach to Data StorageMySQL: A Beginner-Friendly Approach to Data StorageApr 17, 2025 am 12:21 AM

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.

Is MySQL Beginner-Friendly? Assessing the Learning CurveIs MySQL Beginner-Friendly? Assessing the Learning CurveApr 17, 2025 am 12:19 AM

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.

Is SQL a Programming Language? Clarifying the TerminologyIs SQL a Programming Language? Clarifying the TerminologyApr 17, 2025 am 12:17 AM

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

Explain the ACID properties (Atomicity, Consistency, Isolation, Durability).Explain the ACID properties (Atomicity, Consistency, Isolation, Durability).Apr 16, 2025 am 12:20 AM

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: Database Management System vs. Programming LanguageMySQL: Database Management System vs. Programming LanguageApr 16, 2025 am 12:19 AM

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: Managing Data with SQL CommandsMySQL: Managing Data with SQL CommandsApr 16, 2025 am 12:19 AM

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.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.