9

sysbench – Linux Test Bench


Posted by Artem Russakovskii on October 12th, 2007 in Databases, Linux
Share

Updated: October 22nd, 2011

sysbench – Linux test bench. Easy as pie to test CPU, memory, threads, mysql, and disk performance.

Full description is available here: http://sysbench.sourceforge.net/docs/

install mysql, mysql-devel
wget http://downloads.sourceforge.net/project/sysbench/sysbench/0.4.12/sysbench-0.4.12.tar.gz
tar xvzf sysbench*gz
cd sysbench*
./configure && make install

mysql tests

This will run 10 separate consecutive mysql tests using an InnoDB table type, each with 100 mysql threads, doing a total of 1000 various SQL operations per test. Then it will print the total time they took to finish:

sysbench --test=oltp --mysql-user=USER --mysql-password=PASS --mysql-db=test \
  --mysql-host='HOST' --mysql-table-engine=innodb prepare
 
time perl -e "foreach(1..10){print \`sysbench --max-requests=1000 --test=oltp \
  --mysql-user=USER --mysql-password=PASS --mysql-db=test --mysql-host='HOST' \
  --mysql-table-engine=innodb --num-threads=100 run\`}"
 
sysbench --test=oltp --mysql-user=USER --mysql-password=PASS --mysql-db=test \
  --mysql-host='HOST' cleanup

● ● ●

Artem Russakovskii is a San Francisco programmer, blogger, and future millionaire (that last part is in the works). Follow Artem on Twitter (@ArtemR) or subscribe to the RSS feed.

In the meantime, if you found this article useful, feel free to buy me a cup of coffee below.



Share
  • demien

    can anyone tell me why i cant connect to mysql database through sysbench and i m getting the out put is like follow…

    [root@localhost Download]# sysbench –test=oltp –mysql-password=moshi –mysql-db=test–mysql-host='192.168.2.103' –mysql-table-engine=innodb preparesysbench v0.4.8: multi-threaded system evaluation benchmark

    No DB drivers specified, using mysql
    FATAL: unable to connect to MySQL server, aborting…
    FATAL: error 1045: Access denied for user 'sbtest'@'localhost' (using password: YES)
    FATAL: failed to connect to database server!
    [root@localhost Download]#

  • http://beerpla.net Artem Russakovskii

    demien, you're using the wrong credentials to log in. Check that your user has proper permissions and you're typing in the right password. Note that if you're logging into localhost, you need to make sure your mysql user has localhost as allowed hostname. Simply user@% is not enough.

  • kunal

    demien,

    You didn't mention –mysql-user=user thats why its giving you an error

  • Ken

    Can someone tell me what the heck everyone is talking about

  • Vishal Gupta

    One thing to mention that sysbench does not create the database for you, you have to do that manually. So first run this:
    $create database test;

    and then the commands above. That should work.

    • Jamsheer Ak

      Mr Vishal Gupta can u tell me how to create database for sysbech running in shell
      because i use the mysql cmd to create database as follows
      sudo mysqladmin -h localhost -u root -pjamshy27 create Person;
      after that
      mysql -h localhost -u root -pjamshy
      it came like
      mysql> use person
      batabase changed
      mysql> create table employee(…………) like
      i am asking can we do same thing in to perform sysbench? can give more clarification for me?

  • Jamsheer Ak

    can anyone help me to fix the following error
    root@jamsheer-laptop:/home/jamsheer# sudo sysbench –test=oltp –db-driver=mysql –mysql-table-engine=innodb –num-threads=32 –mysql-user=root –max-time=10 –max-requests=0 –oltp-read-only=on –oltp-table-size=100 run
    sysbench v0.4.8: multi-threaded system evaluation benchmark

    FATAL: unable to connect to MySQL server, aborting…
    FATAL: error 1045: Access denied for user 'root'@'localhost' (using password: NO)
    ALERT: Error: failed to determine table 'sbtest' type!
    ALERT: MySQL error: Access denied for user 'root'@'localhost' (using password: NO)
    FATAL: failed to get database capabilities!

  • Anant

    Hi Jamsheer,
    You have to give two more arguments that is:
    –mysql-user=root –mysql-password=Your_root_password

    then only it will access your db and mind well before running this test you have to create database bydefault it will search for 'sbtest' db…

  • justin

    thanks. Turned out that I needed –db-driver=mysql in order to run the program.