Database Performance

sysbench MySQL Benchmarking: OLTP Workloads and Performance Baselines

Benchmark MySQL with sysbench OLTP workloads. Covers setup, read/write and read-only suites, interpreting TPS and 95th percentile latency, and comparing before/after changes.

JusDB Team
August 13, 2025
5 min read
186 views

sysbench is the standard benchmarking tool for MySQL performance testing. It simulates OLTP workloads and helps validate configuration changes, hardware upgrades, and tuning decisions.

Installation

bash
# Ubuntu/Debian
apt-get install sysbench

# macOS
brew install sysbench

Prepare Test Data

bash
sysbench oltp_read_write \
  --mysql-host=localhost \
  --mysql-user=root \
  --mysql-password=secret \
  --mysql-db=sysbench_test \
  --tables=10 \
  --table-size=1000000 \
  prepare

Run Read/Write Benchmark

bash
sysbench oltp_read_write \
  --mysql-host=localhost \
  --mysql-user=root \
  --mysql-password=secret \
  --mysql-db=sysbench_test \
  --tables=10 \
  --table-size=1000000 \
  --threads=16 \
  --time=120 \
  --report-interval=10 \
  run

Read Key Metrics

text
SQL statistics:
    queries performed:
        read:   2,847,291
        write:    812,083
        other:    162,416
        total:  3,821,790
    transactions:    190,623 (1588.52 per sec.)
    queries:       3,821,790 (31861.55 per sec.)

Latency (ms):
    min:    4.92
    avg:   10.07
    max:  143.21
    95th percentile: 19.65

Available Test Suites

bash
sysbench oltp_read_only   # read-only SELECT workload
sysbench oltp_write_only  # insert/update/delete only
sysbench oltp_read_write  # mixed workload (default OLTP)
sysbench oltp_point_select # primary key lookups
sysbench oltp_update_index # indexed UPDATE workload
sysbench fileio           # disk I/O benchmark
sysbench memory           # memory throughput

Cleanup

bash
sysbench oltp_read_write \
  --mysql-host=localhost --mysql-user=root --mysql-password=secret \
  --mysql-db=sysbench_test --tables=10 \
  cleanup

Key Takeaways

  • Use --table-size=1000000 or larger to ensure data exceeds the buffer pool
  • Run for at least 120 seconds to get past the warm-up period
  • Focus on 95th percentile latency, not just average — it reflects real user experience
  • Use oltp_read_only to isolate read performance from write contention

JusDB Can Help

Benchmarking MySQL before and after changes is the only way to know if you improved things. JusDB can design and run benchmarks that reflect your actual production workload.

Share this article

JusDB Team

Official JusDB content team