'...
root@db2:~# sysbench --num-threads=16 --test=oltp --mysql-table-engine=innodb --mysql-host=192.168.x.x --mysql-db=rep_test --oltp-table-size=1000000 --mysql-user=root --mysql-password=123456 run
sysbench 0.4.12: multi-threaded system eva luation benchmark
No DB drivers specified, using mysql
Running the test with following options:
Number of threads: 16
Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "BEGIN" 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 (356.98 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 190000 (6782.56 per sec.)
other operations: 20000 (713.95 per sec.)
Test execution summary:
total time: 28.0130s
total number of events: 10000
total time taken by event execution: 447.7731
per-request statistics:
min: 3.91ms
avg: 44.78ms
max: 207.61ms
approx. 95 percentile: 76.48ms
Threads fairness:
events (avg/stddev): 625.0000/22.96
execution time (avg/stddev): 27.9858/0.01
root@db2:~# sysbench --num-threads=16 --test=oltp --mysql-table-engine=innodb --mysql-host=192.168.x.x --mysql-db=rep_test --oltp-table-size=1000000 --mysql-user=root --mysql-password=123456 cleanup
sysbench 0.4.12: multi-threaded system eva luation benchmark
No DB drivers specified, using mysql
Dropping table 'sbtest'...
Done.
测试表信息:
mysql> desc 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.01 sec)
mysql> show create table sbtest\G;
*************************** 1. row ***************************
Table: sbtest
Create Table: CREATE TABLE `sbtest` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`k` int(10) unsigned NOT NULL DEFAULT '0',
`c` char(120) NOT NULL DEFAULT '',
`pad` char(60) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `k` (`k`)
) ENGINE=InnoDB AUTO_INCREMENT=1000001 DEFAULT CHARSET=utf8
1 row in set (0.01 sec)
ERROR:
No query specified
mysql> select count(*) from sbtest;
+----------+
| count(*) |
+----------+
| 1000000 |
+----------+
1 row in set (0.30 sec)
mysql> desc sbtest;
ERROR 1146 (42S02): Table 'rep_test.sbtest' doesn't exist
可以用这个测试:
sysbench --num-threads=4 --test=oltp --oltp-reconnect-mode=random --mysql-table-engine=innodb --mysql-host=192.168.200.201 --mysql-db=rep_test --ol
tp-table-size=500000 --mysql-user=zjy --mysql-password=1234#
###################################更新2016-07-27
今天使用sysbench的时候,发现0.5版本已经没有 --test=oltp的参数,现在就更新说明下0.5版本的sysbench 如何使用oltp的测试。
① 安装:通过apt-get install sysbench
root@t22:~# sysbench --test=oltp help
sysbench 0.5: multi-threaded system eva luation benchmark
PANIC: unp