我使用以下设置在运行MySQL 5.5.16的RHEL5.6服务器上运行sysbench:
sysbench --test=oltp --db-driver=mysql --mysql-user=sbench \
--mysql-socket=/var/lib/mysql/mysql.sock --mysql-db=sbench \
--mysql-table-engine=innodb --oltp-table-size=1000000 prepare这将创建默认的工作台表,如下所示:
mysql> SHOW CREATE TABLE sbench.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=latin1
1 row in set (0.04 sec)对1,000,000行运行16个线程innodb读/写测试:
sysbench --num-threads=16 --test=oltp --db-driver=mysql --mysql-user=sbench \
--mysql-socket=/var/lib/mysql/mysql.sock --mysql-db=sbench \
--mysql-table-engine=innodb --oltp-table-size=100000 \
--oltp-reconnect-mode=query --batch --batch-delay=5 run结果出现以下错误
[1319136662] sysbench 0.4.12: multi-threaded system evaluation benchmark
[1319136663] Running the test with following options:
[1319136663] Number of threads: 16
[1319136663]
[1319136663] Doing OLTP test.
[1319136663] Running mixed OLTP test
[1319136663] Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
[1319136663] Using "BEGIN" for starting transactions
[1319136663] Using auto_inc on the id column
[1319136663] Maximum number of requests for OLTP test is limited to 10000
[1319136663] Threads started!
[1319136668] min: 0.2181 avg: 0.2484 max: 0.3025 percentile: 0.2715
[1319136673] min: 0.2181 avg: 0.2454 max: 0.3025 percentile: 0.2646
[1319136678] min: 0.2173 avg: 0.2441 max: 0.3115 percentile: 0.2646
[1319136683] min: 0.2173 avg: 0.2435 max: 0.3115 percentile: 0.2648
[1319136688] min: 0.2173 avg: 0.2440 max: 0.3115 percentile: 0.2663
ALERT: [1319136690] failed to execute mysql_stmt_execute(): Err1062 Duplicate entry '49616' for key 'PRIMARY'
FATAL: [1319136690] database error, exiting...
[1319136691] Done.我对使用sysbench相当陌生,但这是一个错误吗,还是我配置错了什么东西使它插入重复的主键?
发布于 2011-10-20 20:16:31
不介意,我想我找到了。
我将测试设置为-oltp-table-size=1000000 (1m),然后使用-oltp-table-size=100000(100 K)运行测试。
使用正确的数字(1m)运行它,16个线程成功完成。
https://serverfault.com/questions/323264
复制相似问题