Giter Site home page Giter Site logo

akopytov / sysbench Goto Github PK

View Code? Open in Web Editor NEW
5.8K 178.0 1.1K 4.89 MB

Scriptable database and system performance benchmark

License: GNU General Public License v2.0

Shell 7.05% C 44.47% Lua 8.69% Makefile 1.84% M4 12.87% Perl 24.65% Dockerfile 0.05% Raku 0.38%
benchmark mysql postgresql lua luajit console linux freebsd macos sysbench

sysbench's Introduction

Latest Release Build Status Debian Packages RPM Packages Coverage Status License

Table of Contents

sysbench

sysbench is a scriptable multi-threaded benchmark tool based on LuaJIT. It is most frequently used for database benchmarks, but can also be used to create arbitrarily complex workloads that do not involve a database server.

sysbench comes with the following bundled benchmarks:

  • oltp_*.lua: a collection of OLTP-like database benchmarks
  • fileio: a filesystem-level benchmark
  • cpu: a simple CPU benchmark
  • memory: a memory access benchmark
  • threads: a thread-based scheduler benchmark
  • mutex: a POSIX mutex benchmark

Features

  • extensive statistics about rate and latency is available, including latency percentiles and histograms;
  • low overhead even with thousands of concurrent threads. sysbench is capable of generating and tracking hundreds of millions of events per second;
  • new benchmarks can be easily created by implementing pre-defined hooks in user-provided Lua scripts;
  • can be used as a general-purpose Lua interpreter as well, simply replace #!/usr/bin/lua with #!/usr/bin/sysbench in your script.

Installing from Binary Packages

Linux

The easiest way to download and install sysbench on Linux is using binary package repositories hosted by packagecloud. The repositories are automatically updated on each sysbench release. Currently x86_64, i386 and aarch64 binaries are available.

Multiple methods to download and install sysbench packages are available and described at https://packagecloud.io/akopytov/sysbench/install.

Quick install instructions:

  • Debian/Ubuntu

    curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.deb.sh | sudo bash
    sudo apt -y install sysbench
  • RHEL/CentOS:

    curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash
    sudo yum -y install sysbench
  • Fedora:

    curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash	
    sudo dnf -y install sysbench
  • Arch Linux:

    sudo pacman -Suy sysbench

macOS

On macOS, up-to-date sysbench packages are available from Homebrew:

# Add --with-postgresql if you need PostgreSQL support
brew install sysbench

Windows

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

After installing WSL and getting into he bash prompt on Windows following Debian/Ubuntu installation instructions is sufficient. Alternatively, one can use WSL to build and install sysbench from source, or use an older sysbench release to build a native binary.

Building and Installing From Source

It is recommended to install sysbench from the official binary packages as described in Installing from Binary Packages. Below are instruction for cases when you want to use sysbench on an architecture for which no binary packages are available.

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. fileio, memory, cpu, 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 testname. command 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:

Option Description Default 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.

Option Description Default 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's People

Contributors

abychko avatar akopytov avatar aloyr avatar andrey-malets avatar dillona avatar dveeden avatar elambert avatar emonty avatar fukai-t avatar grooverdan avatar hydrapolic avatar javacruft avatar jaypipes avatar jcfp avatar jeremycole avatar lowercases avatar manzur avatar marc-t avatar mdcallag avatar nanne007 avatar olafdietsche avatar patrickbussmann avatar paulmenzel avatar plusky avatar renecannao avatar robins avatar sectorsize512 avatar t5unamie avatar vadimtk avatar xypron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sysbench's Issues

Make prepare aware of multiple hosts/sockets/ports

Currently one has to manually prepare the schema for a benchmark if
multiple hosts/ports/sockets are used.

It would be more convenient if sysbench prepare could handle it
automatically, i.e. repeat the prepare call for every
host/port/socket.

Make percentile stats optional

Since percentile stats calculation may have a significant overhead (see #54), but percentile stats are not necessarily required in every benchmark (in fact, in most benchmarks users are interested in TPS), there should be an option to disable them.

cannot open oltp on macosx

Encounter following error when run oltp test on macosx 10.9. Looks like lua scripts are not installed properly.

Libtoolized with: libtoolize (GNU libtool) 2.4.2
Automade with: automake (GNU automake) 1.14.1
Configured with: autoconf (GNU Autoconf) 2.69

± |0.5 ✗| → sysbench --test=oltp --db-driver=pgsql --pgsql-user=gpadmin prepare
sysbench 0.5: multi-threaded system evaluation benchmark

PANIC: unprotected error in call to Lua API (cannot open oltp: No such file or directory)

sysbench on windows

Hi,

I want to run sysbench on windows. I dont have visual studio.

Is there any method to do sysbench ?

Implement --oltp-reconnect

sysbench 0.4 had this --oltp-reconnect option to reconnect after each transaction. I never bothered to port it to the Lua version of OLTP test.

There is, however, interest in this option. This is to port that feature to oltp.lua.

Timers and reporting thread should wait for worker threads to be initialized

sysbench makes sure that no worker thread starts executing events before the main threads signals them to do so.

However, the main thread signals worker threads as soon as it's done with spawning all worker threads. That is, it doesn't make sure that all threads have completed initialization and are actually ready to execute events. Which may result in a situation when some threads are already executing events, while other ones are still connecting to the server. The problem manifests itself as a lower number of running threads being reported by --report-interval on benchmark start.

This should be fixed by using a proper barrier requiring all worker threads to complete their initialization before the timers and reporting thread (i.e. the actual benchmark run) are started, or failing with an error after a timeout, when a worker thread gets stuck in the initialization stage.

Sysbench oltp oracle support

I've been struggling in compiling and running sysbench against oracle database because of lack of support and document. But one thing that is really blocking me is that sysbench 0.5 doesn't seems to support oracle driver any more. In common.lua, 'oracle' is no longer a driver option so I can't even run sysbench preparation. Is downgrading to 0.4 the only option for me? Thanks!

max elapsed time overflows

Running sysbench 0.5 circa April 22.
OS: CentOS Linux 6.5 under VirtualBox 4.3.26
Host OS: Max OS X 10.10.3
Hardware: Macbook Pro Mid-2014, Core i7 2.8GHz

The response time max seems to be miscalculated. It wraps around due to unsigned subtraction.

sysbench \
    --test=/usr/share/doc/sysbench/tests/db/insert.lua \
    --oltp-test-mode=complex \
    --max-time=10 \
    --tx-rate=240 run

Running the test with following options:
Number of threads: 4
Target transaction rate: 240/sec
Random number generator seed is 0 and will be ignored

Threads started!

OLTP test statistics:
    queries performed:
        read:                            0
        write:                           2388
        other:                           0
        total:                           2388
    transactions:                        0      (0.00 per sec.)
    read/write requests:                 2388   (238.20 per sec.)
    other operations:                    0      (0.00 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          10.0251s
    total number of events:              2388
    total time taken by event execution: 1.5056s
    response time:
         min:                                  0.04ms
         avg:                                  0.63ms
         max:                            18446744073709.44ms
         approx.  95 percentile:               1.05ms

Threads fairness:
    events (avg/stddev):           597.0000/3.67
    execution time (avg/stddev):   0.3764/0.01

done.

The problem subtraction is in sysbench.c, function runner_thread(), near line 518:

timers[thread_id].queue_time = sb_timer_value(&sb_globals.exec_timer) - queue_start_time;

When queue_start_time is greater than the value of the exec_timer, this causes the result of the subtraction to overflow, and the timer queue_time becomes a huge unsigned value, on the order of 18446744073709.44ms.

The elapsed time is then calculated in sb_timer_update() using the queue_time, which lets the error propagate:

t->elapsed = TIMESPEC_DIFF(t->time_end, t->time_start) + t->queue_time;

I can compensate if I test the queue_start_time first in runner_thread():

unsigned long long exec_timer_time = sb_timer_value(&sb_globals.exec_timer);
if (queue_start_time > exec_timer_time) {
  log_text(LOG_DEBUG, "queue_start_time > exec_timer_time in runner_thread()");
  timers[thread_id].queue_time = 0;
} else {
  timers[thread_id].queue_time = exec_timer_time - queue_start_time;
}

However, I don't know if this is addressing the root cause. How can queue_start_time be greater than the exec_timer?

seqwr deleting test files

test_file's are being removed during the test and thus the test can't be performed.

This issue is NOT observed during any other modes (seqrewr, seqrd, rndrd, rndwr, nor rndrw)

root@pine2:/mnt/sysbench# sysbench --test=fileio --file-total-size=20G prepare
sysbench 0.5:  multi-threaded system evaluation benchmark

128 files, 163840Kb each, 20480Mb total
Creating files for the test...
Extra file open flags: 0
Creating file test_file.0
Reusing existing file test_file.1
Reusing existing file test_file.2
...
Reusing existing file test_file.126
Reusing existing file test_file.127
167772160 bytes written in 5.29 seconds (30.25 MB/sec).

root@pine2:/mnt/sysbench# ls -la | head
total 20971528
drwxr-xr-x 2 root root      4096 May  4 16:56 .
drwxr-xr-x 6 root root      4096 Apr 28 16:08 ..
-rw------- 1 root root 167772160 May  4 16:56 test_file.0
-rw------- 1 root root 167772160 May  4 15:29 test_file.1
-rw------- 1 root root 167772160 May  4 15:29 test_file.10
-rw------- 1 root root 167772160 May  4 15:29 test_file.100
-rw------- 1 root root 167772160 May  4 15:29 test_file.101
-rw------- 1 root root 167772160 May  4 15:29 test_file.102
-rw------- 1 root root 167772160 May  4 15:29 test_file.103

root@pine2:/mnt/sysbench# sysbench --test=fileio --file-total-size=20G --file-test-mode=seqwr --init-rng=on --max-time=1200 --max-requests=0 run
sysbench 0.5:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 1
Random number generator seed is 0 and will be ignored

Extra file open flags: 0
128 files, 160Mb each
20Gb total file size
Block size 16Kb
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing sequential write (creation) test
FATAL: Cannot open file 'test_file.0' errno = 2 (No such file or directory)

Unknown database 'sbtest'

I am running on Ubuntu 1604.
Server1: MariaDb: 10.1.16-MariaDB, the IP is 192.168.4.169

Server2: the IP is 192.168.4.168
sysbench, 0.5, cloned from https://github.com/akopytov/sysbench

1. git clone https://github.com/akopytov/sysbench
2. apt install libtool libmysqlclient-dev -o Acquire::ForceIPv4=true
3. cd sysbench
4. ./autogen.sh && ./configure && make && make install

5. From server2, I can connect to the MariaDb on Server 1 (192.168.4.168) by MySQL client tool and execute sql commands for example, SHOW DATABASES;

The issue:
When run sysbench, error reported:

lisa@ubuntuClient:~/benchmark/mariadb/sysbench/sysbench# sysbench --test=/root/bt/mysql/data  --mysql-user=lisa --mysql-password=lisapassword
sysbench 0.5:  multi-threaded system evaluation benchmark

FATAL: unable to connect to MySQL server, aborting...
FATAL: error 1049: Unknown database 'sbtest'
FATAL: failed to execute function `prepare': ...riadb/sysbench/sysbench/sysbench

The sysbench command is:
sysbench --test=/root/benchmark/mariadb/sysbench/sysbench/sysbench/tests/db/oltp.lua prepare --mysql-host=192.168.4.169 --mysql-user=lisa --mysql-password=lisapassword

FATAL: Failed to read file! file: 24 pos: 14516224 errno = 0 (Success)

version: Branch 1.0 HEAD

./sysbench --file-test-mode=rndrd --test=fileio run

gives an error

FATAL: Failed to read file! file: 24 pos: 14516224 errno = 0 (Success)

Best regards

Heinrich Schuchardt

sysbench 0.9:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time


Extra file open flags: 0
128 files, 16Mb each
2Gb total file size
Block size 16Kb
Number of IO requests: 10000
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random read test
Initializing worker threads...

Threads started!

FATAL: Failed to read file! file: 24 pos: 14516224 errno = 0 (Success)
Operations performed:  0 reads, 0 writes, 0 Other = 0 Total
Read 0b  Written 0b  Total transferred 0b  (0b/sec)
    0.00 Requests/sec executed

General statistics:
    total time:                          0.0005s
    total number of events:              0
    total time taken by event execution: 0.0000s
    response time:
         min:                            18446744073709.55ms
         avg:                                  0.00ms
         max:                                  0.00ms

Threads fairness:
    events (avg/stddev):           0.0000/0.00
    execution time (avg/stddev):   0.0000/0.00

"make install" doesn't copy lua scripts to share dir

Expected behavior: lua scripts contained in sysbench/tests/ to be copied/installed along with primary binary.

git clone https://github.com/akopytov/sysbench
cd sysbench
./autogen.sh
./configure --without-drizzle --without-pgsql --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib
make
make install

root@localhost:/usr/src/sysbench# ls -la /usr/local/share/doc/sysbench/
total 8
drwxr-xr-x 2 root root 4096 Apr 25 17:54 .
drwxr-xr-x 3 root root 4096 Apr 23 21:52 ..
-rw-r--r-- 1 root root    0 Apr 25 17:54 manual.html

Warn about unused/unsupported options

Hello, I tested sysbench 0.5 commit #246 on Windows 7, and seem there is no --oltp-table-size affect:

sysbench --mysql-user=sbuser --mysql-password=mypwd --test=./db/insert.lua --oltp-table-size=20000 --oltp-tables-count=1 --num-threads=5 --report-interval=1 run

... I got result:

OLTP test statistics:
queries performed:
read: 0
write: 10000
other: 0
total: 10000
transactions: 0 (0.00 per sec.)
read/write requests: 10000 (1329.67 per sec.)
other operations: 0 (0.00 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)

General statistics:
total time: 7.5207s
total number of events: 10000
total time taken by event execution: 37.2719s
response time:
min: 1.52ms
avg: 3.73ms
max: 17.34ms
approx. 95 percentile: 8.68ms

Threads fairness:
events (avg/stddev): 2000.0000/1.79
execution time (avg/stddev): 7.4544/0.00

Expected:
SHoud not be here 20000 writes/insertions. reported when running insert.lua ?

Regards
Buke

Logging process to file

Is there a way to put the process into an log file? I ran sysbench --debug --test=threads run > /root/shared/results/benchmark.txt" but that wrote me total garbage into the file.

tests/db/oltp.lua sometimes reports impossible transactions/sec values

Sometimes I see an impossible number of transactions per sec (tps) from sysbench. For example:

[ 11s] threads: 16, tps: 18446842801212211200.00, reads: 18446842801212035072.00, writes: 18446842801212170240.00, response time: 60.10ms (95%), errors: 0.00, reconnects: 0.00

The command I'm running is:

sysbench --test=/usr/share/doc/sysbench/tests/db/oltp.lua --mysql-host=${SERVER_IP:-127.0.0.1} --mysql-port=3306 --mysql-user= --mysql-password= --mysql-db=sbtest --mysql-table-engine=innodb --oltp-test-mode=complex --oltp-read-only=off --oltp-reconnect=on --oltp-tables-count=500 --oltp-table-size=1000000 --max-requests=100000000 --num-threads=16 --report-interval=1 --report-checkpoints=10 --tx-rate=1500 run

Normal data looks like:

[ 12s] threads: 16, tps: 1385.03, reads: 19488.38, writes: 5540.11, response time: 15.76ms (95%), errors: 0.00, reconnects: 0.00

It seems like it only ever comes out after the "OLTP test statistics:" log line. I also run with report-interval=1, so I wonder if that contributes to some race.

default branch

Hi
I wonder if you could change default branch from 0.5 to 1.0.
I think 1.0 is better because many bugs of its are fixed.

Bit vs Byte

The code confuses me concerning bits and bytes:

log_text(LOG_NOTICE, "Read %sb  Written %sb  Total transferred %sb  "
         "(%sb/sec)",
         sb_print_value_size(s1, sizeof(s1), bytes_read),

Please, consistently use B for byte and b for bit.

Best regards

Heinrich Schuchardt

Reduce overhead from percentile stats

Percentile stats calculation has a significant overhead, especially in high concurrency benchmarks. This is to investigate if that overhead can be reduced.

oltp-test-mode=nontrx do not work

I use the following command to mysql oltp benchmark:

./bin/sysbench --test=./share/tests/db/oltp.lua \
--mysql-host=10.0.201.36 --mysql-port=8066 --mysql-user=ecuser --mysql-password=ecuser \
--mysql-db=dbtest1a --oltp-tables-count=10 --oltp-table-size=500000 \
--report-interval=10 --rand-init=on --max-requests=0 \
--oltp-test-mode=nontrx --oltp-nontrx-mode=update_key --oltp-read-only=off \
--max-time=120 --num-threads=128 \
run

After checking general log, I saw no difference between oltp-test-mode=nontrx and oltp-test-mode=complex. Both of them have BGEIN/COMMIT command sent.

I set oltp-nontrx-mode to update_key, but update-non-key queries also show up in the general log. So I search keyword nontrx in the sysbench source code(0.5), no result found.

Maybe I misunderstand the --oltp-test-mode=nontrx --oltp-nontrx-mode=update_key options, would you correct me?

Deprecated syntax for automake

When running with automake 1.15 there is a warning "Unescaped left brace in regex is deprecated".

./autogen.sh: running `libtoolize --copy --force'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'config'.
libtoolize: copying file 'config/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
./autogen.sh: running `aclocal -I m4'
./autogen.sh: running `autoheader'
./autogen.sh: running `automake -c --foreign --add-missing'
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake-1.15 line 3936.
configure.ac:27: installing 'config/ar-lib'
configure.ac:21: installing 'config/compile'
configure.ac:11: installing 'config/config.guess'
configure.ac:11: installing 'config/config.sub'
configure.ac:16: installing 'config/install-sh'
configure.ac:16: installing 'config/missing'
sysbench/Makefile.am: installing 'config/depcomp'
parallel-tests: installing 'config/test-driver'
./autogen.sh: running `autoconf'
Libtoolized with: libtoolize (GNU libtool) 2.4.6
Automade with: Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake-1.15 line 3936.
automake (GNU automake) 1.15
Configured with: autoconf (GNU Autoconf) 2.69

ALERT: Error 1062 Duplicate entry 'xxxx' for key 'PRIMARY'

I use --oltp-skip-trx=on option to avoid BEGIN statement that will start one transaction because I need to do performance test in read-write spilt scenario. But when I set num-threads up to 12, errors ocur:

ALERT: Error 1062 Duplicate entry '38262' for key 'PRIMARY'
FATAL: failed to execute function `event': (null)

My sysbench version: 0.5
Work statement:

sysbench --mysql-host=mysql_host --mysql-port=mysql_port--mysql-user=ecuser --mysql-password=ecuser \
--test=/usr/share/doc/sysbench/tests/db/oltp.lua --report-interval=10 --rand-type=uniform --rand-init=on --max-requests=0 \
 --mysql-db=dbtest1a --oltp_tables_count=5 --oltp-table-size=50000 --oltp-read-only=off --max-time=60 --oltp-skip-trx=on --num-threads=12 run

And does this patch work: ignoreduplicates.patch ?

THANK YOU!

oltp: inserts duplicate keys when using multiple threads

I use sysbench 1.0, and run oltp.lua with the following options:

--max-time=60 --max-requests=1000000 --num-threads=32 --oltp-table-size=1000000 

Sometimes (but not always) I get the following message:

ALERT: mysql_drv_query() returned error 1062 (Duplicate entry '500070' for key 'PRIMARY') for query 'INSERT INTO sbtest1 (id, k, c, pad) VALUES (500070, 502834, '52973511997-35955633476-77867639113-31616279923-77804179716-57875960734-64511142178-43524978742-90538254054-86456664868', '76447610835-89507148237-86713965845-06775351687-05670492505')'
FATAL: failed to execute function `event': 3

This error only appears when I use multiple threads. With just one thread everything works as expected.

In oltp.lua I found this:

i = sb_rand(1, oltp_table_size)
...
rs = db_query("INSERT INTO " .. table_name ..  " (id, k, c, pad) VALUES " .. string.format("(%d, %d, '%s', '%s')",i, sb_rand(1, oltp_table_size) , c_val, pad_val))

From what I understand, each thread creates a random ID, but how do you make sure that they are always unique?

(Disclaimer: I am not using InnoDB but my own storage engine. I have never seen this behaviour with InnoDB. I'm trying to understand what exactly happends so I can figure out if the problem is in my storage engine or in sysbench.)

fileio tests show output in bits but numbers are byte values

For example running the following over a Gibabit link:

sysbench --test=fileio --file-total-size=4G --file-test-mode=seqwr --max-time=240 --max-requests=0 --file-block-size=1M --num-threads=4 --file-fsync-all run

Output:

sysbench 0.4.12:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 4

Extra file open flags: 0
128 files, 32Mb each
4Gb total file size
Block size 1Mb
Calling fsync() after each write operation.
Using synchronous I/O mode
Doing sequential write (creation) test
Threads started!
Done.

Operations performed:  0 Read, 4096 Write, 4096 Other = 8192 Total
Read 0b  Written 4Gb  Total transferred 4Gb  (91.604Mb/sec)
   91.60 Requests/sec executed

Test execution summary:
    total time:                          44.7140s
    total number of events:              4096
    total time taken by event execution: 175.7213
    per-request statistics:
         min:                                 25.53ms
         avg:                                 42.90ms
         max:                                174.82ms
         approx.  95 percentile:              51.47ms

Threads fairness:
    events (avg/stddev):           1024.0000/0.71
    execution time (avg/stddev):   43.9303/0.00

Note that the file sizes are in Mb, Gb, Kb, whereas the numerical values are the actual MB value. Is this a bug in sysbench? Has it been fixed?

Feature request: add option --oltp-conns-per-thread

As far as I know, in sysbench there is a 1:1 mapping between a connection and a thread.
This normally works well for stress testing, but not in all cases.
For example, I would like to simulate a workload where only 1% of the connections are active, while 99% of the connections are idle: this is a pretty common pattern in many workload.
A workaround can be achieved using --oltp-user-delay-min and --oltp-user-delay-max , but isn't really easy to define that only a percentage of connections should be active at any time.
I have a fork where I added this functionality on branch 0.4 : renecannao@8acea27 .
It is an half baked functionality that works in 0.4 only and not even completed (for example doesn't support reconnect), but it is ok for my needs.
It adds a --oltp-conns-per-thread , and each thread will open so many connections, but only 1 connection at the time will be active.
Would be great to have something similar in the main repo.

Thanks,
René

RFC: xml and json output

I've done a fairly invasive set of a patches to output JSON or XML output form for sysbench tests.
It preserves the text format but adds a set of functions to define structured output. Structured results are reused in the text output.

code is here, all changes in the last commit.

https://github.com/grooverdan/sysbench/tree/1.0-report-styles (warning not fully debugged)

I was getting duplicate errors on fclose that wasn't obvious. Feedback welcome on code and I'll get to polishing it off before I do a pull request.

Export db_fetch_row

It would be very handy in writing true tests if we could use the results of a SELECT at later points within the test script.

Megabit vs MeBibit

The prefix M refers to mega defined as 10^6.
The prefix Mi refers to mebi defined as 2^20.

The code has the following constant:
static const double megabyte = 1024.0 * 1024.0;

Please, do not output Mb where you mean Mib.

See IEC 80000-13:200 or read https://en.wikipedia.org/wiki/Binary_prefix.

Best regards

Heinrich Schuchardt

Lua script without DB access crashes sysbench

If a Lua script does not do any DB accesses and thus, does not call db_init(), it does not call sb_percentile_init() neither. However, it will call sb_percentile_update() later on, which results in a crash.

Error during cross compilation using uclibc.

I was getting undefined reference to 'rpl_malloc' during cross compilation with usage of uclibc :
./configure --target=mipsel-linux-uclibc --host=mipsel-linux-uclibc --without-mysql LDFLAGS="-static"(my cross compiler is exported to $PATH).
This is due to lovely autotools while using non-glibc systems (uclibc in my case).
Quick workaround/hack can be to use:

#if HAVE_CONFIG_H
#include <config.h>
#endif
#undef malloc

void *malloc ();

void* rpl_malloc (size_t n)
{
  if (n == 0)
    n = 1;
  return malloc (n);
}

near the line where error occurred. Compilation goes without a problem then, and program is fully usable. In my case it was sysbench.c:1055.

Hope to see, a better (more elegant) solution to this problem.

Cheers!

vcbuild not found in visual studio

there is no vcbuild found in packages vc.

Please provide extra details for following steps: how to build with Relwithdebinfo target?

Open sysbench.sln in Explorer and build Relwithdebinfo target.
Alternatively, from the command line, issue
vcbuild /useenv sysbench.sln "Relwithdebinfo|Win32"

oltp: pgsql query execution failed

When using --test=oltp --db-driver=pgsql and using more than one thread, sysbench-0.4.12 often fails with:

FATAL: query execution failed: 20732896
FATAL: database error, exiting...

I'm able to preproduce this with --num-threads=2 --max-requests=100000:

$ opt_pgsql="--db-driver=pgsql --pgsql-user=osdb --pgsql-password=osdb --pgsql-db=osdb"
$ sysbench --test=oltp $opt_pgsql cleanup && sysbench --test=oltp $opt_pgsql prepare
$ sysbench --test=oltp $opt_pgsql --num-threads=2 --max-requests=100000 run
[...]
FATAL: query execution failed: 32448032
FATAL: database error, exiting...

== postgresql-9.4-main.log
2015-09-21 22:40:16 PDT [26464-1] osdb@osdb ERROR:  deadlock detected
2015-09-21 22:40:16 PDT [26464-2] osdb@osdb DETAIL:  Process 26464 waits for ShareLock on transaction 289602; blocked by process 26463.
        Process 26463 waits for ShareLock on transaction 289601; blocked by process 26464.
        Process 26464: UPDATE sbtest set k=k+1 where id=$1
        Process 26463: UPDATE sbtest set k=k+1 where id=$1
2015-09-21 22:40:16 PDT [26464-3] osdb@osdb HINT:  See server log for query details.
2015-09-21 22:40:16 PDT [26464-4] osdb@osdb CONTEXT:  while updating tuple (562,36) in relation "sbtest"
2015-09-21 22:40:16 PDT [26464-5] osdb@osdb STATEMENT:  UPDATE sbtest set k=k+1 where id=$1

If I increase the thread count, it fails with 500 requests too:

$ sysbench --test=oltp $opt_pgsql --num-threads=32 --max-requests=500 run
[...]
FATAL: query execution failed: 23092832
FATAL: database error, exiting...

== postgresql-9.4-main.log
2015-09-21 22:42:05 PDT [26609-1] osdb@osdb ERROR:  duplicate key value violates unique constraint "sbtest_pkey"
2015-09-21 22:42:05 PDT [26609-2] osdb@osdb DETAIL:  Key (id)=(4973) already exists.
2015-09-21 22:42:05 PDT [26609-3] osdb@osdb STATEMENT:  INSERT INTO sbtest values($1,0,' ','aaaaaaaaaaffffffffffrrrrrrrrrreeeeeeeeeeyyyyyyyyyy')

Running the same tests with --db-driver=mysql works just fine. This is with PostgreSQL 9.4.4 on Debian/8.2 in a x86_64 VM with 2 CPUs.

PS: why were the OLTP tests removed from the 0.5 branch?

FATAL: Worker threads failed to initialize within 30 seconds!

你好(HI)
我在使用sysbench0.5版本,指定参数--num-threads=1000时,有时候能正常运行,有时候则会遇到错误(FATAL: Worker threads failed to initialize within 30 seconds!)。 当--num-threads=400或者200时,都不会有错误。我的理解的,sysbench在初始化线程时,如果超过30秒还没有成功,则会提示上述错误。建议初始化线程的超时时间用参数来控制。
正常来讲,30秒初始化1000个线程,时间足够,但是我没有更多的信息来排查初始失败的原因,仅仅只有“FATAL: Worker threads failed to initialize within 30 seconds!”。建议程序中,可以输出更多信息,用于排查 。
另外,对于这种错误:FATAL: unable to connect to MySQL server, aborting...
(last message repeated 2 times)
FATAL: error 2003: Can't connect to MySQL server on '10.8.192.15' (110)
PANIC: unprotected error in call to Lua API (Failed to connect to the database)
PANIC: unprotected error in call to Lua API (Failed to connect to the database)
也没有更多的信息来排查,为何会连接数库失败。 数据本身也可以正常访问的。

Different results while using parallel_prepare.lua from repo

Hi dear all,
Using parallel_prepare.lua after installing using yum:

[root@ps-pxb-5 PTB]# sysbench --test=/usr/share/doc/sysbench/tests/db/parallel_prepare.lua --mysql-socket=/tmp/mysql_sandbox5713.sock --mysql-user=root --mysql-password=msandbox --oltp-tables-count=16 --oltp-table-size=100000 --num-threads=2 --mysql-table-engine=innodb run
sysbench 0.5:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 2
Random number generator seed is 0 and will be ignored


Initializing worker threads...

thread prepare1
Creating table 'sbtest2'...
thread prepare0
Creating table 'sbtest1'...
Inserting 100000 records into 'sbtest2'
Inserting 100000 records into 'sbtest1'
Creating table 'sbtest4'...
Creating table 'sbtest3'...
Inserting 100000 records into 'sbtest4'
Inserting 100000 records into 'sbtest3'
Creating table 'sbtest6'...
Creating table 'sbtest5'...
Inserting 100000 records into 'sbtest6'
Inserting 100000 records into 'sbtest5'
Creating table 'sbtest8'...
Creating table 'sbtest7'...
Inserting 100000 records into 'sbtest8'
Inserting 100000 records into 'sbtest7'
Creating table 'sbtest10'...
Creating table 'sbtest9'...
Inserting 100000 records into 'sbtest10'
Inserting 100000 records into 'sbtest9'
Creating table 'sbtest12'...
Creating table 'sbtest11'...
Inserting 100000 records into 'sbtest12'
Inserting 100000 records into 'sbtest11'
Creating table 'sbtest14'...
Inserting 100000 records into 'sbtest14'
Creating table 'sbtest13'...
Inserting 100000 records into 'sbtest13'
Creating table 'sbtest16'...
Inserting 100000 records into 'sbtest16'
Creating table 'sbtest15'...
Inserting 100000 records into 'sbtest15'
Threads started!

And using parallel_prepare.lua script from cloned repo:

[root@ps-pxb-5 PTB]# sysbench --test=/mnt/sysbench/sysbench/tests/db/parallel_prepare.lua --mysql-socket=/tmp/mysql_sandbox5713.sock --mysql-user=root --mysql-password=msandbox --oltp-tables-count=16 --oltp-table-size=100000 --num-threads=2 --mysql-table-engine=innodb run
sysbench 0.5:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 2
Random number generator seed is 0 and will be ignored


Initializing worker threads...

thread prepare0
Creating table 'sbtest1'...
Threads started!

thread prepare1
Creating table 'sbtest2'...
Inserting 100000 records into 'sbtest2'
Inserting 100000 records into 'sbtest1'
Creating secondary indexes on 'sbtest1'...
Creating secondary indexes on 'sbtest2'...
Creating table 'sbtest3'...
Creating table 'sbtest4'...
Inserting 100000 records into 'sbtest3'
Inserting 100000 records into 'sbtest4'
Creating secondary indexes on 'sbtest3'...
Creating secondary indexes on 'sbtest4'...
Creating table 'sbtest5'...
Creating table 'sbtest6'...
Inserting 100000 records into 'sbtest5'
Inserting 100000 records into 'sbtest6'
Creating secondary indexes on 'sbtest5'...
Creating secondary indexes on 'sbtest6'...
Creating table 'sbtest7'...
Creating table 'sbtest8'...
Inserting 100000 records into 'sbtest7'
Inserting 100000 records into 'sbtest8'
Creating secondary indexes on 'sbtest8'...
Creating secondary indexes on 'sbtest7'...
Creating table 'sbtest10'...
Creating table 'sbtest9'...
Inserting 100000 records into 'sbtest10'
Inserting 100000 records into 'sbtest9'
Creating secondary indexes on 'sbtest10'...
Creating secondary indexes on 'sbtest9'...
Creating table 'sbtest12'...
Creating table 'sbtest11'...
Inserting 100000 records into 'sbtest12'
Inserting 100000 records into 'sbtest11'
Creating secondary indexes on 'sbtest12'...
Creating secondary indexes on 'sbtest11'...
Creating table 'sbtest14'...
Creating table 'sbtest13'...
Inserting 100000 records into 'sbtest14'
Inserting 100000 records into 'sbtest13'
Creating secondary indexes on 'sbtest14'...
Creating secondary indexes on 'sbtest13'...
Creating table 'sbtest16'...
Creating table 'sbtest15'...
Inserting 100000 records into 'sbtest16'
Inserting 100000 records into 'sbtest15'
Creating secondary indexes on 'sbtest16'...
Creating secondary indexes on 'sbtest15'...
thread prepare1
Creating table 'sbtest2'...
ALERT: mysql_drv_query() returned error 1050 (Table 'sbtest2' already exists) for query 'CREATE TABLE sbtest2 (
id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
k INTEGER UNSIGNED DEFAULT '0' NOT NULL,
c CHAR(120) DEFAULT '' NOT NULL,
pad CHAR(60) DEFAULT '' NOT NULL,
PRIMARY KEY (id)
) /*! ENGINE = innodb MAX_ROWS = 1000000 */ '
FATAL: failed to execute function `event': 3

Provide portable reentrant PRNG

sysbench relies on the C library to generate random numbers, mostly because I tried to follow the "never implement your own PRNG" rule. In practice that causes more problems than it solves (different PRNG behavior across platforms, more portability code to support different generators provided by system libraries).

It would be easier to copy the implementation of *rand48_r() familiy of functions from glibc, since that covers sysbench needs pretty well and solves all portability issues.

Race condition in sb_timer_value()

There is a race condition in sb_timer_value() when it's used on a global timer (i.e. on sb_globals.exec_timer rather than per-thread timers).

The problem is that sb_timer_value() updates the timer state, which can lead to problems with its performed on a shared timer concurrently. I saw some threads exiting prematurely with the "Time limit exceeded" message. This is pretty serious, since it can result in skewed benchmark results.

better error hints for missing help command

I work with Archlinux which is a very light-weight Linux distribution without lua by default. And when I try

sysbench --test=oltp help

nothing useful was printed.
I struggled very hard and then I found some lua scripts in $HomeDir/share/sysbench. Oh, maybe I need lua!
And it was going ok after I installed that.

So, I think it's good to add more nice error hints when lua is not in system for green-hands? Thanks!

the results of the io test when i use sysbench 1.0

this is the results:
ysbench --test=fileio --num-threads=8 --file-total-size=64G --file-test-mode=rndrw run
sysbench 1.0: multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 8
Initializing random number generator from current time

Extra file open flags: 0
128 files, 512MiB each
64GiB total file size
Block size 16KiB
Number of IO requests: 10000
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...

Threads started!

File operations:
reads/s: 8259.22
writes/s: 5499.26
fsyncs/s: 17610.85

Throughput:
read, MiB/s: 129.05
written, MiB/s: 85.93

General statistics:
total time: 0.7268s
total number of events: 10000
total time taken by event execution: 1.7759s
response time:
min: 0.00ms
avg: 0.18ms
max: 1.98ms
approx. 95 percentile: 0.54ms

Threads fairness:
events (avg/stddev): 1250.0000/50.66
execution time (avg/stddev): 0.2220/0.01

it is different from the sysbench 0.5,i want to know how can i get the value of the iops? could you help me?is there any docs?

PATH_MAX / DATA_PATH undefined

Hi Alexey,

I can't compile sysbench in Visual Studio 2015 since this commit 16ba868

PATH_MAX and DATA_PATH are undefined.

How can we keep compatibility with M$ ?

Thank you

sysbench scaling issue

It can be run by both limiting request or run time.
Run command for sysbench by limiting requests:
./sysbench --test=tests/db/oltp.lua --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=mysql --oltp-test-mode=complex --oltp-read-only=off --oltp-reconnect=on --max-requests=10000--num-threads=256 run

Hi,
I am trying to setup sysbench for one of our server with 256 cores.
However, it does not scale up. The more threads I add, the lesser is transactions per sec.

It's not a server scaling issue as other benchmarks such as TPCC/hackbench scale properly.

Here are things I tried

Run command for sysbench by limiting requests:
./sysbench --test=tests/db/oltp.lua --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=mysql --oltp-test-mode=complex --oltp-read-only=off --oltp-reconnect=on --max-requests=10000--num-threads=64 run

Run command for sysbench by limiting time:
./sysbench --test=tests/db/oltp.lua --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=mysql --oltp-test-mode=complex --oltp-read-only=off --oltp-reconnect=on --max-time=60 --max-requests=0--num-threads=64 run*

--max-time=60
Threads
16 transactions: 89778 (1496.01 per sec.)
32 transactions: 81403 (1356.09 per sec.)
64 transactions: 63868 (1063.43 per sec.)

--max-requests=10000

Threads
32 transactions: 10002 (1113.30 per sec.)
128 transactions: 10000 (300.74 per sec.)
256 transactions: 10000 (201.37 per sec.)

Can you please point out what's wrong ? Do I need to enable something in the compiler ?

Here are my gcc version:
gcc version 4.4.7 20120313 (Red Hat 4.4.7-4.0.16) (GCC)

Regards,
Atish

oracle 0.4 compile issues

Hi There,

I am having the following issue.

I am using ubuntu 14.04 LTS

I noted i ticket #8 that you stopped support for oracle in 0.5 So backing to 0.5

So I checked out 0.4 to build and did the following.

apt-get update
apt-get -y install automake libtool git libmysqlclient15-dev make
git clone https://github.com/akopytov/sysbench.git
cd sysbench
git checkout 0.4
./autogen.sh
./configure --with-oracle
make

However make gives the following error.
make[3]: Entering directory/opt/sysbench/sysbench/drivers/oracle'
gcc -DHAVE_CONFIG_H -I. -I../../../config -Iyes/rdbms/demo -Iyes/rdbms/public -I../../../sysbench -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -W -Wall -Wextra -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wnested-externs -Winline -funroll-loops -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wcast-align -pthread -O2 -ggdb3 -MT libsboracle_a-drv_oracle.o -MD -MP -MF .deps/libsboracle_a-drv_oracle.Tpo -c -o libsboracle_a-drv_oracle.o test -f 'drv_oracle.c' || echo './'drv_oracle.c
drv_oracle.c:32:17: fatal error: oci.h: No such file or directory
#include <oci.h>
^
compilation terminated.
make[3]: *** [libsboracle_a-drv_oracle.o] Error 1
make[3]: Leaving directory /opt/sysbench/sysbench/drivers/oracle' make[2]: *** [install-recursive] Error 1 make[2]: Leaving directory/opt/sysbench/sysbench/drivers'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory /opt/sysbench/sysbench' make: *** [install-recursive] Error 1
I am a little stuck.

Can't use solaris as per this guide - https://blogs.oracle.com/titan/entry/running_sysbench_for_oracle_benchmarks

Tried installing the client as per this guide - https://help.ubuntu.com/community/Oracle%20Instant%20Client

Guidance would be helpful.

Runtime segmentation fault with the latest version as of 2015/04/22

It seems that the segmentation fault is coming from
7a0e384

OS: Ubuntu 14.04 x86_64 kernel 3.13.0-49
DB in test: MariaDB 5.5
Command to run:

sysbench --test=tests/db/oltp.lua prepare
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
sysbench 0.5:  multi-threaded system evaluation benchmark

[New Thread 0x7ffff639b700 (LWP 26654)]
[Thread 0x7ffff639b700 (LWP 26654) exited]
Creating table 'sbtest1'...

Program received signal SIGSEGV, Segmentation fault.
mysql_drv_query (sb_conn=0x8a7aa0, 
    query=0x8acf68 "CREATE TABLE sbtest1 (\nid INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\nk INTEGER UNSIGNED DEFAULT '0' NOT NULL,\nc CHAR(120) DEFAULT '' NOT      NULL,\npad CHAR(60) DEFAULT '' NOT NULL,\nPRIMARY KEY (id)\n) /*! E"..., rs=<optimized out>) at drv_mysql.c:799
799   MYSQL *con = db_mysql_con->mysql;
(gdb) bt
#0  mysql_drv_query (sb_conn=0x8a7aa0, 
    query=0x8acf68 "CREATE TABLE sbtest1 (\nid INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\nk INTEGER UNSIGNED DEFAULT '0' NOT NULL,\nc CHAR(120) DEFAULT '' NOT NULL,\npad CHAR(60) DEFAULT '' NOT NULL,\nPRIMARY KEY (id)\n) /*! E"..., rs=<optimized out>) at drv_mysql.c:799
#1  0x000000000040a178 in db_query (con=0x8a7aa0, 
    query=0x8acf68 "CREATE TABLE sbtest1 (\nid INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\nk INTEGER UNSIGNED DEFAULT '0' NOT NULL,\nc CHAR(120) DEFAULT '' NOT NULL,\npad CHAR(60) DEFAULT '' NOT NULL,\nPRIMARY KEY (id)\n) /*! E"...) at db_driver.c:473
#2  0x0000000000410d12 in sb_lua_db_query (L=0x89d910) at script_lua.c:610
#3  0x0000000000418005 in luaD_precall (L=L@entry=0x89d910, func=func@entry=0x8a7c80, nresults=nresults@entry=0) at ldo.c:319
#4  0x0000000000426fbf in luaV_execute (L=L@entry=0x89d910, nexeccalls=2, nexeccalls@entry=1) at lvm.c:587
#5  0x000000000041897d in luaD_call (L=0x89d910, func=0x89dd50, nResults=<optimized out>) at ldo.c:377
#6  0x00000000004171b9 in luaD_rawrunprotected (L=L@entry=0x89d910, f=f@entry=0x413c70 <f_call>, ud=ud@entry=0x7fffffffdd80)
    at ldo.c:116
#7  0x0000000000418aba in luaD_pcall (L=L@entry=0x89d910, func=func@entry=0x413c70 <f_call>, u=u@entry=0x7fffffffdd80, old_top=128, 
    ef=<optimized out>) at ldo.c:461
#8  0x000000000041569b in lua_pcall (L=0x89d910, nargs=nargs@entry=0, nresults=nresults@entry=1, errfunc=errfunc@entry=0) at lapi.c:817
#9  0x00000000004110df in sb_lua_cmd_prepare () at script_lua.c:511
#10 0x0000000000404a0c in main (argc=<optimized out>, argv=<optimized out>) at sysbench.c:1199

lrand48() is not thread-safe

sysbench uses lrand48() as its RNG on most platforms, which is actually not thread-safe, as documented in the Linux manual page.

The impact of using it in a multi-threaded context depends on the platform.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.