Home Database Mysql Tutorial TPCC-MySQL基准测试_MySQL

TPCC-MySQL基准测试_MySQL

Jun 01, 2016 pm 01:06 PM

 

  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 of this Website
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

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

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Explain InnoDB Full-Text Search capabilities. Explain InnoDB Full-Text Search capabilities. Apr 02, 2025 pm 06:09 PM

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.

When might a full table scan be faster than using an index in MySQL? When might a full table scan be faster than using an index in MySQL? Apr 09, 2025 am 12:05 AM

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.

Can I install mysql on Windows 7 Can I install mysql on Windows 7 Apr 08, 2025 pm 03:21 PM

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.

Difference between clustered index and non-clustered index (secondary index) in InnoDB. Difference between clustered index and non-clustered index (secondary index) in InnoDB. Apr 02, 2025 pm 06:25 PM

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.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

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

How do you handle large datasets in MySQL? How do you handle large datasets in MySQL? Mar 21, 2025 pm 12:15 PM

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

Explain different types of MySQL indexes (B-Tree, Hash, Full-text, Spatial). Explain different types of MySQL indexes (B-Tree, Hash, Full-text, Spatial). Apr 02, 2025 pm 07:05 PM

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: Simple Concepts for Easy Learning MySQL: Simple Concepts for Easy Learning Apr 10, 2025 am 09:29 AM

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.

See all articles