I am running sysbench on a RHEL 5.6 server running MySQL 5.5.16 using the following setup:

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

This creates the default sbench table like so:

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`)
1 row in set (0.04 sec)

Running a 16 thread innodb read/write test on 1,000,000 rows:

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

results in the following error

[1319136662] sysbench 0.4.12:  multi-threaded system evaluation benchmark

[1319136663] Running the test with following options:
[1319136663] Number of threads: 16
[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.

I'm fairly new to using sysbench, but is this a bug, or did I misconfigure something to make it insert duplicate primary keys?


Nevermind, I think I found it.

I was setting up the test with --oltp-table-size=1000000 (1m), then running a test with --oltp-table-size=100000 (100k)

Ran it with the right number (1m) and 16 threads finished successfully.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.