Scripts2026年5月26日·1 分钟阅读

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 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
sysbench Overview
直接安装命令
npx -y tokrepo@latest install 6d525004-5920-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

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

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产