sysbench出错mysql mysql的OLTPtesting

我在使用以下设置运行MySQL 5.5.16的RHEL 5.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 

这将创build默认的sbench表,如下所示:

 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读/写testing:

 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,但是这是一个错误,或者我错误configuration的东西,使其插入重复主键?

没关系,我想我find了。

我正在用–oltp-table-size = 1000000(1m)设置testing,然后用–oltp-table-size = 100000(100k)运行testing。

然后用正确的数字(1m)和16个线程成功完成。