mysqldatabasebenchmarkingoltpsysbench

Cannot Find oltp test on sysbench


I'm trying to run benchmark on mySQL database using sysbench. However, it says it cannot find built-in test oltp.

Detail: I've installed mySQL, and sysbench on my local machine. Also, I've created database dbtest inside the mySQL. And then I executed following instruction.

sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=dbtest --mysql-user=root --mysql-password=<password> prepare

But then this error message occured.

WARNING: the --test option is deprecated. You can pass a script 
name or path on the command line without any options.
sysbench 1.0.8 (using bundled LuaJIT 2.1.0-beta2)

FATAL: Cannot find benchmark 'oltp': no such built-in test, file or module

sysbench worked fine with other test such as

sysbench --test=cpu --cpu-max-prime=20000 run

I think the problem is that sysbench can't find pre-defined test called oltp but I don't know how to figure it out.

Thank you for reading.


Solution

  • From the output, it looks like you have installed latest sysbench 1.0. So, you can try prepare command as below -

    sysbench --db-driver=mysql --mysql-user=root --mysql-password=<pwd> \
      --mysql-socket=<mysql.sock path> --mysql-db=foo --range_size=100 \
      --table_size=10000 --tables=2 --threads=1 --events=0 --time=60 \
      --rand-type=uniform /usr/share/sysbench/oltp_read_only.lua prepare
    

    Before running the prepare command, open the mysql console and create a database foo - create database foo. If you have mysql installation is in standard location, path of mysql.sock is not required.

    8 tables are created inside database foo using the above command, you can check them on mysql console using following command - use database foo, show tables etc.

    Then you can run the benchmark as follows -

    sysbench --db-driver=mysql --mysql-user=root --mysql-password=<pwd> \
      --mysql-socket=<mysql.sock path> --mysql-db=foo --range_size=100 \
      --table_size=10000 --tables=2 --threads=1 --events=0 --time=60 \
      --rand-type=uniform /usr/share/sysbench/oltp_read_only.lua run
    

    Note: there are many workload inside share folder of sysbench, apart from oltp_read_only, you can play around them. There is enough documentation provide on the github link - https://github.com/akopytov/sysbench