sysbench is an open source multi-threaded performance test tool that can perform performance tests on CPU/memory/threads/IO/databases.
The database currently supports MySQL/Oracle/PostgreSQL. This article only briefly demonstrates the usage of several tests, and then prepares to use sysbench to conduct a series of tests on MySQL. Some specific parameter settings need to be adjusted according to different test requirements.
sysbench is an open source, modular, cross-platform multi-threaded performance testing tool that can be used to perform performance testing of CPU, memory, disk I/O, threads, and databases. Currently supported databases are MySQL, Oracle and PostgreSQL. The system parameters that the current function allows to test are:
file I/O performance
scheduler performance
memory allocation and transfer speed
POSIX threads implementation performance
database server performance (OLTP benchmark)
sysbench supports the following test modes:
1. CPU performance
2. Disk IO performance
3. Scheduler performance
4. Memory allocation and transfer speed
5. POSIX thread performance
6. Database performance (OLTP benchmark)
At present, sysbench mainly supports mysql, drizzle, pgsql, oracle and other databases.
sysbench [general-options]... --test=<test-name> [test-options]... command
General options: #General options
--num-threads=N number of threads to use [1] #Create the number of test threads. Default is 1.
--max-requests=N limit for total number of requests [10000] #The maximum number of requests. The default is 10000, 0 means no limit.
--max-time=N limit for total execution time in seconds [0] #Maximum execution time, in s. The default is 0, no limit.
--forced-shutdown=STRING amount of time to wait after --max-time before forcing shutdown [off] #Forcing shutdown after max-time is exceeded. Default is off.
--thread-stack-size=SIZE size of stack per thread [32K] #Stack size of each thread. The default is 32K.
--init-rng=[on|off] initialize random number generator [off] # Whether to initialize the random number generator at the beginning of the test. Default is off.
--test=STRING test to run #Specify the test project name.
--debug=[on|off] print more debugging info [off] #Whether to display more debugging information. Default is off.
--validate=[on|off] perform validation checks where possible [off] #Perform validation checks where possible. Default is off.
--help=[on|off] print help and exit #Help information.
--version=[on|off] print version and exit #version information.
Usage:
sysbench [options]... [testname] [command]
Commands implemented by most tests: prepare run cleanup help
General options:
--threads=N number of threads to use [1]
--events=N limit for total number of events [0]
--time=N limit for total execution time in seconds [10]
--warmup-time=N execute events for this many seconds with statistics disabled before the actual benchmark run with statistics enabled [0]
--forced-shutdown=STRING number of seconds to wait after the --time limit before forcing shutdown, or 'off' to disable [off]
--thread-stack-size=SIZE size of stack per thread [64K]
--thread-init-timeout=N wait time in seconds for worker threads to initialize [30]
--rate=N average transactions rate. 0 for unlimited rate [0]
--report-interval=N periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0]
--report-checkpoints=[LIST,...] dump full statistics and reset all counters at specified points in time. The argument is a list of comma-separated values representing the amount of time in seconds elapsed from start of test when report checkpoint(s) must be performed. Report checkpoints are off by default. []
--debug[=on|off] print more debugging info [off]
--validate[=on|off] perform validation checks where possible [off]
--help[=on|off] print help and exit [off]
--version[=on|off] print version and exit [off]
--config-file=FILENAME File containing command line options
--luajit-cmd=STRING perform LuaJIT control command. This option is equivalent to 'luajit -j'. See LuaJIT documentation for more information
--tx-rate=N deprecated alias for --rate [0]
--max-requests=N deprecated alias for --events [0]
--max-time=N deprecated alias for --time [0]
--num-threads=N deprecated alias for --threads [1]
Pseudo-Random Numbers Generator options:
--rand-type=STRING random numbers distribution {uniform,gaussian,special,pareto} [special]
--rand-spec-iter=N number of iterations used for numbers generation [12]
--rand-spec-pct=N percentage of values to be treated as 'special' (for special distribution) [1]
--rand-spec-res=N percentage of 'special' values to use (for special distribution) [75]
--rand-seed=N seed for random number generator. When 0, the current time is used as a RNG seed. [0]
--rand-pareto-h=N parameter h for pareto distribution [0.2]
Log options:
--verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3]
--percentile=N percentile to calculate in latency statistics (1-100). Use the special value of 0 to disable percentile calculations [95]
--histogram[=on|off] print latency histogram in report [off]
General database options:
--db-driver=STRING specifies database driver to use ('help' to get list of available drivers)
--db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto]
--db-debug[=on|off] print database-specific debug information [off]
Compiled-in database drivers:
mysql - MySQL driver
mysql options:
--mysql-host=[LIST,...] MySQL server host [localhost]
--mysql-port=[LIST,...] MySQL server port [3306]
--mysql-socket=[LIST,...] MySQL socket
--mysql-user=STRING MySQL user [sbtest]
--mysql-password=STRING MySQL password []
--mysql-db=STRING MySQL database name [sbtest]
--mysql-ssl[=on|off] use SSL connections, if available in the client library [off]
--mysql-ssl-cipher=STRING use specific cipher for SSL connections []
--mysql-compression[=on|off] use compression, if available in the client library [off]
--mysql-debug[=on|off] trace all client library calls [off]
--mysql-ignore-errors=[LIST,...] list of errors to ignore, or "all" [1213,1020,1205]
--mysql-dry-run[=on|off] Dry run, pretend that all MySQL client API calls are successful without executing them [off]
Compiled-in tests:
fileio - File I / O test
cpu - CPU performance test
memory - Memory functions speed test
threads - Threads subsystem performance test
mutex - Mutex performance test
See 'sysbench <testname> help' for a list of options for each test.