MySQL基准测试

MySQL基准测试工具

mysqlslap、sysbench、Super Smack

mysqlslap的使用MySQL官网给出了介绍

Super Smack是服务器压力测试强有力的工具

sysbench是MySQL基准测试工具了

 

sysbench安装

直接yum安装

 

测试环境

mysql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 5.1.73    |
+-----------+
1 row in set (0.00 sec)

  

1:测试CPU

[root@10-4-5-9 ~]# sysbench --test=cpu --cpu-max-prime=1500 run

2:测试fileio

首先生成文件用于测试(默认生成128个单个16M共2G的文件)

[root@10-4-5-9 ~]# sysbench --test=fileio prepare

MySQL基准测试

读写文件测试

[root@10-4-5-9 ~]# sysbench --test=fileio --file-test-mode=rndrw run

MySQL基准测试

MySQL基准测试

每秒请求数:Requests/sec  1841.10

总体吞吐量:28.767Mb/sec

删除测试数据:

[root@10-4-5-9 ~]# sysbench --test=fileio cleanup

  

3:测试oltp(主要用来测试多线程事务处理)

首先创建数据库和测试表

mysql> CREATE DATABASE gechong;
Query OK, 1 row affected (0.00 sec)

mysql> CREATE TABLE test_oltp
    -> SELECT * FROM mysql.user;
ERROR 1046 (3D000): No database selected
mysql> USE gechong;
Database changed
mysql> CREATE TABLE test_oltp SELECT * FROM mysql.user;
Query OK, 3 rows affected (0.01 sec)
Records: 3  Duplicates: 0  Warnings: 0

  

[root@10-4-5-9 ~]# sysbench --test=oltp --oltp-table-size=2000000 --oltp-table-name=test_oltp --mysql-db=gechong --mysql-user=root  --msyql-password=gechong prepare
Unknown option: --msyql-password.

  

提示创建失败了。

查看下帮助

sysbench [general-options]... --test=<test-name> [test-options] ... command

General options:

--num-threads=N number of threads to use [1]
--max-requests=N limit for total number of requests [10000]
--max-time=N limit for total execution time in seconds [0]
--forced-shutdown=STRING amount of time to wait after --max-time before forcing shutdown [off]
--thread-stack-size=SIZE size of stack per thread [32K]
--init-rng=[on|off] initialize random number generator [off]
--test=STRING test to run
--debug=[on|off] print more debugging info [off]
--validate=[on|off] perform validation checks where possible [off]
--help=[on|off] print help and exit
--version=[on|off] print version and exit

 

Compiled-in tests:
fileio - File I/O test
cpu - CPU performance test
memory - Memory functions speed test
threads - Threads subsystem performance test
mutex - Mutex performance test
oltp - OLTP test

 

command

prepare/run/cleanup/help/version

 

查看帮助

[root@10-4-5-9 ~]# sysbench --help=on --test=<oltp> help

  

 

MySQL基准测试

上一篇:Mysql InnoDB锁


下一篇:plsql游标最后一行重复的问题