Mysql Performance Test-sysbench practice, mysql-sysbench
Sysbench
- Industry-renowned performance testing tools
- Allows you to test disks, CPUs, and databases.
- Supports multiple databases: oracle, DB2, and MYSQL
- Download, compile, and install the SDK by yourself.
- Recommended version: sysbench0.5
Sysbench is used not only to test the database performance, but also to test the performance of the server running the database. We strongly recommend that you familiarize yourself with sysbench testing. This should be one of the most useful tools in the mysql user's toolkit.
- Sysbench cpu Benchmark Test
- Sysbench file I/O Benchmark Test
- Sysbench OLTP Benchmark
Other benchmark tests of sysbench are not directly related to database performance.
- Memory ----- test the continuous read/write performance of the memory
- Thread ----- test the performance of the thread scheduler.
- Mutex lock-test the performance of the mutex lock.
- Sequential write-test the performance of sequential write.
Problem:
- Single Table Structure
- No constraints or Indexes
- The tested SQL statement is relatively simple.
Usage 1. Download sysbench
Git clone https://github.com/akopytov/sysbench directory structure root @ itcast01:/home/aiapple/sysbench # lsautogen. sh configure. ac install-sh missing README-WIN.txtChangeLog COPYING m4 mkinstalldirs sysbenchconfig doc Makefile. am README. md TODO
2. Compile and install
./autogen.sh./configure --prefix=/home/sysbenchmakemake install
3. sysbench Process
- Initialize data (prepare)
- Run)
- Cleanup)
A) initialize data prepare:
sysbench --test=parallel_prepare.lua --oltp_tables_count=1 --rand-init=on --oltp-table-size=500000000 --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=sys --mysql-password=netease --mysql-db=sbtest --max-requests=0 prepare
Sysbench table structure
B) run the test -- run
sysbench --test=oltp.lua --oltp_tables_count=1 --num-threads=100 --oltp-table-size=500000000 --oltp-read-only=off --report-interval=10 --rand-type=uniform --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=sys --mysql-password=netease --mysql-db=sbtest --max-time=1000 --max-requests=0 run
Special Cases
Data Interpretation running data [10 s] -------------- running time point Threads: 100------100 Threads tps: 378.90 --------- execute 378.9 transactions per second reads: ------------- Number of read requests writes: ------------ Write Request count response time: -- response time errors: ------------- error count reconnects: ------- reconnect count data summary follow
C) cleanup)
- Manually drop tables and databases
- Run the cleanup Command provided by sysbench.
Use sysbench to clear data
sysbench --test=parallel_prepare.lua --oltp_tables_count=1 --rand-init=on --oltp-table-size=500000000 --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=sys --mysql-password=netease --mysql-db=sbtest --max-requests=0 cleanup