All Products
Search
Document Center

PolarDB:Sysbench tests

Last Updated:Mar 28, 2026

This document covers how to run Sysbench benchmarks against PolarDB-X and interpret the results. Use this as a reference when evaluating PolarDB-X performance before selecting an instance specification.

Test environment

PolarDB-X instance specifications

Instance specificationNumber of nodes
4C32G2
4C32G4
8C64G2
8C64G4

Benchmark executor

ConfigurationValue
ECS instance typeecs.g7ne.8xlarge
CPU32 vCPUs
Memory128 GB
Sysbench version1.1.0

Test dataset

SettingValue
Tables16
Rows per table10,000,000 (10 million)

Test scenarios

All tests use the standard Sysbench OLTP workloads: point_select, read_only, read_write, update_index, update_non_index, and write_only. Results are measured in QPS (queries per second).

Run Sysbench tests

Step 1: Create an ECS instance

Create an ECS instance with 32 vCPUs and 128 GB of memory. This capacity prevents the benchmark executor from becoming a bottleneck when testing high-specification PolarDB-X instances.

Deploy the ECS instance in a virtual private cloud (VPC). Record the VPC name and ID. All database instances created in subsequent steps must reside in the same VPC.

Step 2: Create a PolarDB-X instance

  1. Create a PolarDB-X instance with the MySQL 5.7 or MySQL 8.0 engine. See Create a PolarDB-X instance.

  2. Create a database named sbtest in the instance. See Create a database.

    CREATE DATABASE sbtest MODE = 'auto';

Step 3: Configure instance parameters

Modify these parameters on the compute nodes to achieve optimal stress test performance.
  1. Set the following parameters via the console. See Parameter settings.

    ParameterValue
    ENABLE_COROUTINEtrue
    XPROTO_MAX_DN_CONCURRENT4000
    XPROTO_MAX_DN_WAIT_CONNECTION4000
  2. Connect to the instance with a command-line client and run the following SQL statements in the same session to disable logging and CPU statistical sampling:

    set global RECORD_SQL=false;
    set global MPP_METRIC_LEVEL=0;
    set global ENABLE_CPU_PROFILE=false;
    set global ENABLE_TRANS_LOG=false;

Step 4: Install Sysbench

  1. Download and extract the Sysbench package:

    tar xzvf sysbench.tar.gz
    cd sysbench/

    Download link: sysbench.tar.gz Alternatively, build from source at sysbench on GitHub.

  2. Install dependencies, then compile and install:

    yum -y install make automake libtool pkgconfig libaio-devel mysql-devel
    ./autogen.sh
    ./configure
    make -j
    make install
  3. Verify the installation:

    sysbench --version

    Expected output: sysbench 1.1.0

Step 5: Configure Sysbench

Create a configuration file named sysb.conf with your PolarDB-X connection details:

mysql-host=<HOST>
mysql-port=<PORT>
mysql-user=<USER>
mysql-password=<PASSWORD>
mysql-db=sbtest
db-driver=mysql
percentile=95
histogram=on
report-interval=1
time=60
rand-type=uniform

Replace the connection placeholders with your actual values:

PlaceholderDescription
<HOST>PolarDB-X instance endpoint
<PORT>Connection port
<USER>Database username
<PASSWORD>Database password

The remaining parameters control test behavior:

ParameterDescription
percentilePercentile used to sample response time
histogramWhether to display the response time distribution histogram
report-intervalInterval for real-time output, in seconds
timeTest duration, in seconds
rand-typeDistribution type for random number generation

Step 6: Load test data

sysbench --config-file=sysb.conf \
  --create-table-options='single locality="balance_single_table=on"' \
  --tables=16 \
  --table-size=10000000 \
  --threads=16 \
  --auto_inc=off \
  oltp_point_select prepare
ParameterDescription
config-filePath to the common configuration file
create-table-optionsTable creation mode
tablesNumber of tables to create
table-sizeNumber of rows per table
threadsNumber of concurrent threads used to load data
auto_incWhether to use auto-increment for primary keys

Step 7: Run the tests

Use the following command template. Replace <WORKLOAD> with the scenario name and <THREADS> with the number of concurrent threads.

sysbench --config-file=sysb.conf \
  --db-ps-mode=disable \
  --mysql-ignore-errors=all \
  --tables=16 \
  --table-size=10000000 \
  --threads=<THREADS> \
  <WORKLOAD> run

For read_only and read_write, add --range-size=5:

sysbench --config-file=sysb.conf \
  --db-ps-mode=disable \
  --mysql-ignore-errors=all \
  --tables=16 \
  --table-size=10000000 \
  --range-size=5 \
  --threads=<THREADS> \
  <WORKLOAD> run

Supported workloads: oltp_point_select, oltp_read_only, oltp_read_write, oltp_update_index, oltp_update_non_index, oltp_write_only.

ParameterDescription
db-ps-modeWhether to use prepared statement mode
mysql-ignore-errorsMySQL error codes to ignore (for example, errors from lock conflicts)
range-sizeRow range for range queries (used in read_only and read_write)

Run the first stress test with an extended duration to let the database reach a stable state before recording results.

Test results

MySQL 5.7

PolarDB-X version: polardb-2.4.0_5.4.19-20240610_xcluster5.4.19-20240527. For version details, see Release notes.

point_select

image
Instance specificationConcurrent threadsQPS
4C32G*21000194,921.53
4C32G*41000355,299.81
8C64G*21000304,538.44
8C64G*42000618,634.19

read_only

image
Instance specificationConcurrent threadsQPS
4C32G*2600191,075.61
4C32G*41000308,160.47
8C64G*21000308,352.62
8C64G*42000598,847.81

read_write

image
Instance specificationConcurrent threadsQPS
4C32G*2600102,279.28
4C32G*4600161,648.89
8C64G*2600142,095.41
8C64G*4600243,955.73

update_index

image
Instance specificationConcurrent threadsQPS
4C32G*260050,092.01
4C32G*460089,559.24
8C64G*260065,857.40
8C64G*41000130,311.38

update_non_index

image
Instance specificationConcurrent threadsQPS
4C32G*240050,393.43
4C32G*4100092,495.24
8C64G*2100069,030.37
8C64G*41000138,283.81

write_only

image
Instance specificationConcurrent threadsQPS
4C32G*240052,322.07
4C32G*460081,170.89
8C64G*260069,120.16
8C64G*4600114,337.76

MySQL 8.0

PolarDB-X version: polardb-2.4.0_5.4.19-20240610_xcluster8.4.19-20240523. For version details, see Release notes.

point_select

image
Instance specificationConcurrent threadsQPS
4C32G*21000165,611.83
4C32G*41000309,981.94
8C64G*21000345,505.50
8C64G*42000618,638.91

read_only

image
Instance specificationConcurrent threadsQPS
4C32G*2600167,945.12
4C32G*41000296,882.66
8C64G*21000301,085.34
8C64G*42000534,553.26

read_write

image
Instance specificationConcurrent threadsQPS
4C32G*260078,310.00
4C32G*4600113,646.43
8C64G*2600119,788.57
8C64G*4600179,227.38

update_index

image
Instance specificationConcurrent threadsQPS
4C32G*260038,220.55
4C32G*460063,354.87
8C64G*260055,573.63
8C64G*4100090,181.68

update_non_index

image
Instance specificationConcurrent threadsQPS
4C32G*240037,439.38
4C32G*4100066,362.21
8C64G*2100063,527.22
8C64G*4100092,856.59

write_only

image
Instance specificationConcurrent threadsQPS
4C32G*240037,884.63
4C32G*460052,481.99
8C64G*260058,711.55
8C64G*460074,967.45

Common issues

Performance is lower than expected

If your test results are significantly lower than the reference QPS values in this document, check the following:

  • Parameter tuning not applied: Confirm that ENABLE_COROUTINE, XPROTO_MAX_DN_CONCURRENT, and XPROTO_MAX_DN_WAIT_CONNECTION are set to the values in Step 3. Run the set global SQL statements in the same session after connecting.

  • ECS bottleneck: If your ECS instance does not meet the recommended specification of 32 vCPUs and 128 GB of memory, the benchmark executor itself may be the limiting factor, not the database.

  • Database not warmed up: Run the first stress test with an extended duration to let the database reach a stable state. Results from a cold start are not representative.

  • Network latency: Confirm that the ECS instance and the PolarDB-X instance are in the same VPC.

The sysbench --version command returns an error

The version check command is sysbench --version, not synben --version. If the command is not found, the installation did not complete successfully. Rerun the dependency installation and compilation steps.