ScriptsMay 26, 2026·3 min read

sysbench — Multi-Threaded System Benchmark Tool

sysbench is a scriptable multi-threaded benchmark tool for evaluating CPU, memory, file I/O, mutex, and database performance under configurable workloads.

Agent ready

Ready-to-run agent install

This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
sysbench Overview
Direct install command
npx -y tokrepo@latest install 6d525004-5920-11f1-9bc6-00163e2b0d79 --target codex

Run after dry-run confirms the install plan.

Introduction

sysbench is a cross-platform command-line tool for running configurable benchmarks against CPUs, memory subsystems, file I/O, threading primitives, and relational databases. It is commonly used to compare hardware, validate database tuning, and establish performance baselines before and after infrastructure changes.

What sysbench Does

  • Runs CPU, memory, file I/O, and mutex contention benchmarks
  • Provides built-in OLTP workloads for MySQL and PostgreSQL
  • Supports custom Lua scripts to define arbitrary benchmark scenarios
  • Scales workloads across configurable thread counts to test concurrency
  • Reports latency percentiles, throughput, and event rates in real time

Architecture Overview

sysbench is a C application that spawns a pool of worker threads, each executing a test-specific event loop. Built-in tests (cpu, memory, fileio, mutex) are compiled into the binary. Database and custom tests are defined as Lua scripts loaded at runtime. The reporting engine collects per-thread statistics and aggregates them into latency histograms and throughput summaries.

Self-Hosting & Configuration

  • Install via system package manager or compile from source with make && make install
  • No daemon or configuration file needed — all options are CLI flags
  • Database benchmarks require a target MySQL or PostgreSQL instance
  • Use prepare, run, and cleanup subcommands to manage test data lifecycle
  • Write custom Lua scripts in the sysbench.hooks API for specialized workloads

Key Features

  • Built-in tests for CPU, memory, file I/O, mutex, and OLTP database workloads
  • Scriptable via Lua for custom benchmark scenarios beyond the defaults
  • Thread-scalable from 1 to thousands of concurrent workers
  • Reports latency distributions at p50, p95, p99 and beyond
  • Cross-platform support for Linux, macOS, and FreeBSD

Comparison with Similar Tools

  • fio — Focused exclusively on storage I/O with deeper tuning knobs
  • pgbench — PostgreSQL-specific TPC-B benchmark, no CPU or I/O tests
  • HammerDB — GUI-based database benchmark with TPC-C and TPC-H workloads
  • stress-ng — Kernel and hardware stress testing, not database-aware
  • YCSB — Yahoo Cloud Serving Benchmark for NoSQL and key-value stores

FAQ

Q: Which databases does sysbench support? A: MySQL (and compatible forks like MariaDB and Percona) and PostgreSQL via built-in OLTP Lua scripts.

Q: Can I benchmark networked services other than databases? A: Yes. Write a custom Lua script using the sysbench API to drive any TCP or HTTP workload.

Q: How do I get reproducible results? A: Pin thread count, test duration, and table size. Disable CPU frequency scaling and run multiple iterations to average out variance.

Q: Is sysbench suitable for production load testing? A: It is designed for synthetic benchmarks. For realistic production traffic replay, consider tools like Percona Playback or tcpreplay.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets