# sysbench --test=mutex --num-threads=1500 --max-requests=2000 --mutex-num=10240 --mutex-locks=100000 --mutex-loops=15000 run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 1500
Doing mutex performance test
Threads started!
Done.
Test execution summary:
total time: 26.3937s
total number of events: 1500
total time taken by event execution: 37270.9321
per-request statistics:
min: 19545.19ms
avg: 24847.29ms
max: 26349.79ms
approx. 95 percentile: 26145.33ms
Threads fairness:
events (avg/stddev): 1.0000/0.00
execution time (avg/stddev): 24.8473/1.27
6、MySQL数据库测试
首先需要创建默认的sbtest数据库,或者使用--mysql-db指定一个已经存在的数据库
生成测试数据,引擎为myisam,表大小为1000000条记录
# sysbench --test=oltp --mysql-table-engine=myisam --oltp-table-size=1000000 --mysql-user=root --mysql-socket=/var/run/mysqld/mysql5.socket prepare
sysbench 0.4.12: multi-threaded system evaluation benchmark
No DB drivers specified, using mysql
Creating table 'sbtest'...
Creating 1000000 records in table 'sbtest'...
# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14087
Server version: 5.5.20-ndb-7.2.5-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> desc sbtest.sbtest;
+-------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| k | int(10) unsigned | NO | MUL | 0 | |
| c | char(120) | NO | | | |
| pad | char(60) | NO | | | |
+-------+------------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)
mysql>
执行测试à
# sysbench --test=oltp --mysql-table-engine=myisam --oltp-table-size=1000000 --mysql-user=root --mysql-socket=/var/run/mysqld/mysql5.socket runsysbench
sysbench 0.4.12: multi-threaded system evaluation benchmark
No DB drivers specified, using mysql
Running the test with following options:
Number of threads: 1
Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "LOCK TABLES WRITE" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 10000
Threads started!
Done.
OLTP test statistics:
queries performed:
read: 140000
write: 50000
other: 20000
total: 210000
transactions: 10000 (534.56 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 190000 (10156.56 per sec.)
other operations: 20000 (1069.11 per sec.)
—-事务数总计,每秒的事务处理量
Test execution summary:
total time: 18.7071s
total number of events: 10000
total time taken by event execution: 18.6649
per-request statistics:
min: 1.68ms
avg: 1.87ms
max: 2.64ms
approx. 95 percentile: 1.95ms
--每个请求的统计信息
Threads fairness: --线程权重信息,工作负荷如何被均匀分配
events (avg/stddev): 10000.0000/0.00
execution time (avg/stddev): 18.6649/0.00
清理现场à
# sysbench --test=oltp --mysql-table-engine=myisam --oltp-table-size=1000000 --mysql-user=root --mysql-socket=/var/run/mysqld/mysql5.socket cleanup
sysbench 0.4.12: multi-threaded system evaluation benchmark
No DB drivers specified, using mysql
Dropping table 'sbtest'...
Done.