Tpcc-mysql was published by Percona as a pressure tool to test the database, simulating an e-commerce business,
The main business has new orders, inventory inquiries, delivery, payment and other modules of the test
1. Download
2. Installation
1. Unzip the CD scr; make
The make command generates the TPCC command-line tool tpcc_load in the Tpcc-mysql directory, Tpcc_start
Tpcc_load provides the ability to initialize data
Tpcc_start for stress testing
[[email protected] src]# make
Cc-w-o2-g-I. ' Mysql_config--include '-C LOAD.C
Cc-w-o2-g-I. ' Mysql_config--include '-C support.c
CC LOAD.O SUPPORT.O ' mysql_config--libs_r '-lrt-o. /tpcc_load
Cc-w-o2-g-I. ' Mysql_config--include '-C main.c
Cc-w-o2-g-I. ' Mysql_config--include '-C SPT_PROC.C
Cc-w-o2-g-I. ' Mysql_config--include '-C driver.c
Cc-w-o2-g-I. ' Mysql_config--include '-C sequence.c
Cc-w-o2-g-I. ' Mysql_config--include '-C rthist.c
Cc-w-o2-g-I. ' Mysql_config--include '-C NEWORD.C
Cc-w-o2-g-I. ' Mysql_config--include '-C payment.c
Cc-w-o2-g-I. ' Mysql_config--include '-C ordstat.c
Cc-w-o2-g-I. ' Mysql_config--include '-C delivery.c
Cc-w-o2-g-I. ' Mysql_config--include '-C slev.c
CC MAIN.O SPT_PROC.O driver.o support.o sequence.o rthist.o neword.o payment.o ordstat.o delivery.o slev.o ' Mysql_config- -libs_r '-lrt-o. /tpcc_start
2. Modify PATH
[[email protected] ~]# vim. Bash_profile
Path= $PATH: $HOME/bin:/usr/local/xtrabackup/bin:/usr/local/mysql/bin/:/usr/local/mysql/bin/
3.socket File
TPCC default reads the/var/lib/mysql/mysql.sock socket location, if your test environment MySQL socket is not the corresponding path, you need to make a soft connection, or TCP/IP connection to the test server.
Ln-s/var/run/mysqld/mysql.sock/var/lib/mysql/mysql.sock
3. creating a database and table structure
# Create a database for testing
[Email protected] src]# mysqladmin Create tpcc1000
Mysqladmin:connect to server at ' localhost ' failed
Error: ' Access denied for user ' root ' @ ' localhost ' (using Password:no) '
[Email protected] src]# mysqladmin-uroot-p123123 Create tpcc1000
Warning:using a password on the command line interface can is insecure.
# Create a table for testing
[Email protected] tpcc-mysql]# mysql-uroot-p123123-h127.0.0.1-p3306-s/var/run/mysqld/mysql.sock tpcc1000 < creat E_table.sql
Warning:using a password on the command line interface can is insecure.
# Create FK and Index
[Email protected] tpcc-mysql]# mysql-uroot-p123123-h127.0.0.1-p3306-s/var/run/mysqld/mysql.sock tpcc1000 < Add_f Key_idx.sql
Warning:using a password on the command line interface can is insecure.
4. Loading Data
Usage:
#./tpcc_load–help
tpcc_load [Server] [DB] [user] [pass] [warehouse]
Server: Servers name : Port number
DB: Database name
User: Username
Pass: Password
Warehouse: Number of warehouses
Loading the data takes a while and generates a lot of output information, and we typically direct the program output to a file. Avoid losing scrolling information
[Email protected] tpcc-mysql]#./tpcc_load 127.0.0.1:3306 tpcc1000 Root 123123 10
5. Perform the test
#./tpcc_start–help
-H server_host: server name
-P Port: Port number, default is 3306
-d database_name: Database name
-u mysql_user: User name
-P Mysql_password: password
-W Warehouses: number of warehouses
-C Connections: Number of threads, default 1 specifies number of concurrent connections
-R warmup_time: Warm-up time, unit: s, default is 10s, warm-up is to load the data into memory.
-L Running_time: Test time, Unit: s, default is 20s
-I report_interval specifies how long the report interval is generated
-F report_file: Test result output file
[Email protected] tpcc-mysql]#/tpcc_start-h127.0.0.1-p3306-d tpcc1000-uroot-p123123-w 10-c 12-r 120-l 15-f TP cc_mysql_20160512
***************************************
# # #easy # # TPC-C Load Generator * * *
***************************************
Option h with value ' 127.0.0.1 '
Option P with value ' 3306 '
Option d with value ' tpcc1000 '
Option U with value ' root '
Option p with value ' 123123 '
Option W with value ' 10 '
Option C with value ' 12 '
Option r with value ' 120 '
Option L with value ' 15 '
Option F with value ' tpcc_mysql_20160512 '
<Parameters>
[Server]: 127.0.0.1
[Port]: 3306
[DBname]: tpcc1000
[User]: Root
[Pass]: 123123
[Warehouse]: 10
[Connection]: 12
[Rampup]: (sec.)
[Measure]: (sec.)
Ramp-up time. (sec.)
。
。
。
<TpmC>
1536.000 TPMC
Test success!
Pressure test Tpcc-mysql