[转帖]sysbench的用法

sysbench,用法 · 浏览次数 : 0

小编点评

**Sure, here is the summary of the requirements for building sysbench on Windows:** **Prerequisites:** * Windows 10 * Xcode (or Xcode Command Line Tools) * Homebrew **Building Sysbench:** 1. Install the following packages on Windows using WSL: * make * automake * libtool * pkgconfig * libaio-dev 2. Download the latest version of sysbench from the official website (release for Windows is not supported). 3. Extract the downloaded archive and run the `autogen.sh` script to configure the build. 4. Build the `sysbench` binary by running the `make` command in the extracted directory. **Using Sysbench:** 1. Run the `sysbench` executable with the desired options. 2. Use the `help` option for more information on usage. 3. To specify a percentile rank for query execution times, use the `--percentiles` option. **Random Numbers:** * `--rand-type` option controls the type of random numbers generated (uniform, Gaussian, special, pareto, Zipfian). * `--rand-seed` option sets a specific seed for the random number generator. * `--rand-spec` options specify the probability distribution and percentage of the range for the special distribution. * `--rand-pareto-hshape` and `--rand-zipfian-expshape` options set specific parameters for the Pareto and Zipfian distributions, respectively.

正文

Build Requirements

Windows

As of sysbench 1.0 support for native Windows builds was dropped. It may be re-introduced in later versions. Currently, the recommended way to build sysbench on Windows is using Windows Subsystem for Linux available in Windows 10.

After installing WSL and getting into bash prompt on Windows, following Debian/Ubuntu build instructions is sufficient. Alternatively, one can build and use an older 0.5 release on Windows.

Debian/Ubuntu

    apt -y install make automake libtool pkg-config libaio-dev
    # For MySQL support
    apt -y install libmysqlclient-dev libssl-dev
    # For PostgreSQL support
    apt -y install libpq-dev

RHEL/CentOS

    yum -y install make automake libtool pkgconfig libaio-devel
    # For MySQL support, replace with mysql-devel on RHEL/CentOS 5
    yum -y install mariadb-devel openssl-devel
    # For PostgreSQL support
    yum -y install postgresql-devel

Fedora

    dnf -y install make automake libtool pkgconfig libaio-devel
    # For MySQL support
    dnf -y install mariadb-devel openssl-devel
    # For PostgreSQL support
    dnf -y install postgresql-devel

macOS

Assuming you have Xcode (or Xcode Command Line Tools) and Homebrew installed:

    brew install automake libtool openssl pkg-config
    # For MySQL support
    brew install mysql
    # For PostgreSQL support
    brew install postgresql
    # openssl is not linked by Homebrew, this is to avoid "ld: library not found for -lssl"
    export LDFLAGS=-L/usr/local/opt/openssl/lib 

Build and Install

    ./autogen.sh
    # Add --with-pgsql to build with PostgreSQL support
    ./configure
    make -j
    make install

The above will build sysbench with MySQL support by default. If you have MySQL headers and libraries in non-standard locations (and no mysql_config can be found in the PATH), you can specify them explicitly with --with-mysql-includes and --with-mysql-libs options to ./configure.

To compile sysbench without MySQL support, use --without-mysql. If no database drivers are available database-related scripts will not work, but other benchmarks will be functional.

Usage

General Syntax

The general command line syntax for sysbench is:

	  sysbench [options]... [testname] [command] 
  • testname is an optional name of a built-in test (e.g. fileiomemorycpu, etc.), or a name of one of the bundled Lua scripts (e.g. oltp_read_only), or a path to a custom Lua script. If no test name is specified on the command line (and thus, there is no command too, as in that case it would be parsed as a testname), or the test name is a dash ("-"), then sysbench expects a Lua script to execute on its standard input.

  • command is an optional argument that will be passed by sysbench to the built-in test or script specified with testnamecommand defines the action that must be performed by the test. The list of available commands depends on a particular test. Some tests also implement their own custom commands.

    Below is a description of typical test commands and their purpose:

    • prepare: performs preparative actions for those tests which need them, e.g. creating the necessary files on disk for the fileio test, or filling the test database for database benchmarks.
    • run: runs the actual test specified with the testname argument. This command is provided by all tests.
    • cleanup: removes temporary data after the test run in those tests which create one.
    • help: displays usage information for the test specified with the testname argument. This includes the full list of commands provided by the test, so it should be used to get the available commands.
  • options is a list of zero or more command line options starting with '--'. As with commands, the sysbench testname help command should be used to describe available options provided by a particular test.

    See General command line options for a description of general options provided by sysbench itself.

You can use sysbench --help to display the general command line syntax and options.

General Command Line Options

The table below lists the supported common options, their descriptions and default values:

OptionDescriptionDefault value
--threads The total number of worker threads to create 1
--events Limit for total number of requests. 0 (the default) means no limit 0
--time Limit for total execution time in seconds. 0 means no limit 10
--warmup-time Execute events for this many seconds with statistics disabled before the actual benchmark run with statistics enabled. This is useful when you want to exclude the initial period of a benchmark run from statistics. In many benchmarks, the initial period is not representative because CPU/database/page and other caches need some time to warm up 0
--rate Average transactions rate. The number specifies how many events (transactions) per seconds should be executed by all threads on average. 0 (default) means unlimited rate, i.e. events are executed as fast as possible 0
--thread-init-timeout Wait time in seconds for worker threads to initialize 30
--thread-stack-size Size of stack for each thread 32K
--report-interval Periodically report intermediate statistics with a specified interval in seconds. Note that statistics produced by this option is per-interval rather than cumulative. 0 disables intermediate reports 0
--debug Print more debug info off
--validate Perform validation of test results where possible off
--help Print help on general syntax or on a specified test, and exit off
--verbosity Verbosity level (0 - only critical messages, 5 - debug) 4
--percentile sysbench measures execution times for all processed requests to display statistical information like minimal, average and maximum execution time. For most benchmarks it is also useful to know a request execution time value matching some percentile (e.g. 95% percentile means we should drop 5% of the most long requests and choose the maximal value from the remaining ones). This option allows to specify a percentile rank of query execution times to count 95
--luajit-cmd perform a LuaJIT control command. This option is equivalent to luajit -j. See LuaJIT documentation for more information  

Note that numerical values for all size options (like --thread-stack-size in this table) may be specified by appending the corresponding multiplicative suffix (K for kilobytes, M for megabytes, G for gigabytes and T for terabytes).

Random Numbers Options

sysbench provides a number of algorithms to generate random numbers that are distributed according to a given probability distribution. The table below lists options that can be used to control those algorithms.

OptionDescriptionDefault value
--rand-type random numbers distribution {uniform, gaussian, special, pareto, zipfian} to use by default. Benchmark scripts may choose to use either the default distribution, or specify it explictly, i.e. override the default. special
--rand-seed seed for random number generator. When 0, the current time is used as an RNG seed. 0
--rand-spec-iter number of iterations for the special distribution 12
--rand-spec-pct percentage of the entire range where 'special' values will fall in the special distribution 1
--rand-spec-res percentage of 'special' values to use for the special distribution 75
--rand-pareto-h shape parameter for the Pareto distribution 0.2
--rand-zipfian-exp shape parameter (theta) for the Zipfian distribution 0.8

Versioning

For transparency and insight into its release cycle, and for striving to maintain backward compatibility, sysbench will be maintained under the Semantic Versioning guidelines as much as possible.

Releases will be numbered with the following format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

  • Breaking backward compatibility bumps the major (and resets the minor and patch)
  • New additions without breaking backward compatibility bumps the minor (and resets the patch)
  • Bug fixes and misc changes bumps the patch

For more information on SemVer, please visit http://semver.org/.

与[转帖]sysbench的用法相似的内容:

[转帖]sysbench的用法

Build Requirements Windows As of sysbench 1.0 support for native Windows builds was dropped. It may be re-introduced in later versions. Currently, the

[转帖]sysbench安装

https://www.jianshu.com/p/1948beb6699e sysbench是一个多线程的基准测试工具,一般用来评估不同系统参数下的数据库负载情况如果你的环境上如下依赖包都没装上,需要先安装如下这些依赖包,使用yum install更便利 image.png 如果使用源码安装(在网

[转帖]sysbench安装

https://www.jianshu.com/p/1948beb6699e sysbench是一个多线程的基准测试工具,一般用来评估不同系统参数下的数据库负载情况如果你的环境上如下依赖包都没装上,需要先安装如下这些依赖包,使用yum install更便利 image.png 如果使用源码安装(在网

[转帖]Sysbench - 一种系统性能benchmark

SysBench是一款开源的、跨平台的、模块化的、多线程的性能测试工具,通过高负载地运行在数据库上,可以执行CPU/内存/线程/IO/数据库等方面的性能测试。用于评估操作系统的性能参数。 1 sysbench简介 Sysbench使得我们无需采用真正的复杂的数据库benchmark而获取系统的性能概

[转帖]用sysbench进行数据库OLTP基准测试

https://www.cnblogs.com/ariesblog/p/13847740.html 基于TPC-C的OLTP基准测试,对比Mysql和PostgreSQL的性能 一、什么是TPC-C和tpmC 1、TPC-C TPC-C是一种旨在衡量联机事务处理(OLTP)系统性能与可伸缩性的行业标

[转帖]测试工具 sysbench (Centos 7.x) for DM数据库

1、简单介绍 sysbench是一个开源,模块化的多线程性能测试工具,可以用来进行硬件环境性能测试,也可进行数据库的性能测试。但是由于需要支持DM测试,所以我们一般使用源码进行编译。 2、运行方法 sysbench通过运行lua脚本进行数据库测试。而每次测试都分为prepare、run、cleanu

[转帖]测试工具 sysbench (Centos 7.x) for DM数据库

1、简单介绍 sysbench是一个开源,模块化的多线程性能测试工具,可以用来进行硬件环境性能测试,也可进行数据库的性能测试。但是由于需要支持DM测试,所以我们一般使用源码进行编译。 2、运行方法 sysbench通过运行lua脚本进行数据库测试。而每次测试都分为prepare、run、cleanu

[转帖]使用sysbench对MySQL进行压力测试

使用sysbench对MySQL进行压力测试 https://cloud.tencent.com/developer/article/2073561 1.背景 ​出自percona公司,是一款多线程系统压测工具,可以根据影响数据库服务器性能的各种因素来评估系统的性能。例如,可以用来测试文件IO,操作

[转帖]tidb-系统内核调优及对比

一、背景 验证系统调优对性能的影响,用sysbench做了一些简单的测试,具体调整方法可见官方文档 二、特殊说明 1.透明大页查看 # 查看透明大页是否开启,[]在always处表示开启,[]在never处表示关闭 cat /sys/kernel/mm/transparent_hugepage/en

[转帖]基准测试工具

https://www.cnblogs.com/wade-luffy/p/6344097.html 目录 sysbench mysql-tpcc 基准测试工具可以用来对数据库或者操作系统调优后的性能进行对比。MySQL数据库本身提供了一些比较优秀的工具,这里介绍另外两款更优秀、更常用的工具:sysb