9

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.

Kyungsu Stanley Kim
  • 195
  • 1
  • 1
  • 10

2 Answers2

21

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

Al.G.
  • 4,327
  • 6
  • 31
  • 56
Pintu Kumar
  • 731
  • 8
  • 6
  • Glad you provide the location of lua script! I have no idea why it is so hard to find the location of the very lua scrip. – cwhsu Jan 13 '18 at 09:04
3

The dpkg tool is handy to show where files for an installed package are stored on the system. I used it when locating the test scripts for sysbench 1.0.14. See the man page for more options

# dpkg --listfiles sysbench
...
/usr/share/sysbench/bulk_insert.lua
/usr/share/sysbench/select_random_ranges.lua
/usr/share/sysbench/oltp_update_non_index.lua
/usr/share/sysbench/oltp_delete.lua
/usr/share/sysbench/oltp_update_index.lua
/usr/share/sysbench/oltp_read_write.lua
/usr/share/sysbench/oltp_point_select.lua
...
Hman
  • 106
  • 6