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 specification | Number of nodes |
|---|---|
| 4C32G | 2 |
| 4C32G | 4 |
| 8C64G | 2 |
| 8C64G | 4 |
Benchmark executor
| Configuration | Value |
|---|---|
| ECS instance type | ecs.g7ne.8xlarge |
| CPU | 32 vCPUs |
| Memory | 128 GB |
| Sysbench version | 1.1.0 |
Test dataset
| Setting | Value |
|---|---|
| Tables | 16 |
| Rows per table | 10,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
Create a PolarDB-X instance with the MySQL 5.7 or MySQL 8.0 engine. See Create a PolarDB-X instance.
Create a database named
sbtestin 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.
Set the following parameters via the console. See Parameter settings.
Parameter Value ENABLE_COROUTINEtrueXPROTO_MAX_DN_CONCURRENT4000XPROTO_MAX_DN_WAIT_CONNECTION4000Connect 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
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.
Install dependencies, then compile and install:
yum -y install make automake libtool pkgconfig libaio-devel mysql-devel ./autogen.sh ./configure make -j make installVerify the installation:
sysbench --versionExpected 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=uniformReplace the connection placeholders with your actual values:
| Placeholder | Description |
|---|---|
<HOST> | PolarDB-X instance endpoint |
<PORT> | Connection port |
<USER> | Database username |
<PASSWORD> | Database password |
The remaining parameters control test behavior:
| Parameter | Description |
|---|---|
percentile | Percentile used to sample response time |
histogram | Whether to display the response time distribution histogram |
report-interval | Interval for real-time output, in seconds |
time | Test duration, in seconds |
rand-type | Distribution 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| Parameter | Description |
|---|---|
config-file | Path to the common configuration file |
create-table-options | Table creation mode |
tables | Number of tables to create |
table-size | Number of rows per table |
threads | Number of concurrent threads used to load data |
auto_inc | Whether 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> runFor 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> runSupported workloads: oltp_point_select, oltp_read_only, oltp_read_write, oltp_update_index, oltp_update_non_index, oltp_write_only.
| Parameter | Description |
|---|---|
db-ps-mode | Whether to use prepared statement mode |
mysql-ignore-errors | MySQL error codes to ignore (for example, errors from lock conflicts) |
range-size | Row 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

| Instance specification | Concurrent threads | QPS |
|---|---|---|
| 4C32G*2 | 1000 | 194,921.53 |
| 4C32G*4 | 1000 | 355,299.81 |
| 8C64G*2 | 1000 | 304,538.44 |
| 8C64G*4 | 2000 | 618,634.19 |
read_only

| Instance specification | Concurrent threads | QPS |
|---|---|---|
| 4C32G*2 | 600 | 191,075.61 |
| 4C32G*4 | 1000 | 308,160.47 |
| 8C64G*2 | 1000 | 308,352.62 |
| 8C64G*4 | 2000 | 598,847.81 |
read_write

| Instance specification | Concurrent threads | QPS |
|---|---|---|
| 4C32G*2 | 600 | 102,279.28 |
| 4C32G*4 | 600 | 161,648.89 |
| 8C64G*2 | 600 | 142,095.41 |
| 8C64G*4 | 600 | 243,955.73 |
update_index

| Instance specification | Concurrent threads | QPS |
|---|---|---|
| 4C32G*2 | 600 | 50,092.01 |
| 4C32G*4 | 600 | 89,559.24 |
| 8C64G*2 | 600 | 65,857.40 |
| 8C64G*4 | 1000 | 130,311.38 |
update_non_index

| Instance specification | Concurrent threads | QPS |
|---|---|---|
| 4C32G*2 | 400 | 50,393.43 |
| 4C32G*4 | 1000 | 92,495.24 |
| 8C64G*2 | 1000 | 69,030.37 |
| 8C64G*4 | 1000 | 138,283.81 |
write_only

| Instance specification | Concurrent threads | QPS |
|---|---|---|
| 4C32G*2 | 400 | 52,322.07 |
| 4C32G*4 | 600 | 81,170.89 |
| 8C64G*2 | 600 | 69,120.16 |
| 8C64G*4 | 600 | 114,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

| Instance specification | Concurrent threads | QPS |
|---|---|---|
| 4C32G*2 | 1000 | 165,611.83 |
| 4C32G*4 | 1000 | 309,981.94 |
| 8C64G*2 | 1000 | 345,505.50 |
| 8C64G*4 | 2000 | 618,638.91 |
read_only

| Instance specification | Concurrent threads | QPS |
|---|---|---|
| 4C32G*2 | 600 | 167,945.12 |
| 4C32G*4 | 1000 | 296,882.66 |
| 8C64G*2 | 1000 | 301,085.34 |
| 8C64G*4 | 2000 | 534,553.26 |
read_write

| Instance specification | Concurrent threads | QPS |
|---|---|---|
| 4C32G*2 | 600 | 78,310.00 |
| 4C32G*4 | 600 | 113,646.43 |
| 8C64G*2 | 600 | 119,788.57 |
| 8C64G*4 | 600 | 179,227.38 |
update_index

| Instance specification | Concurrent threads | QPS |
|---|---|---|
| 4C32G*2 | 600 | 38,220.55 |
| 4C32G*4 | 600 | 63,354.87 |
| 8C64G*2 | 600 | 55,573.63 |
| 8C64G*4 | 1000 | 90,181.68 |
update_non_index

| Instance specification | Concurrent threads | QPS |
|---|---|---|
| 4C32G*2 | 400 | 37,439.38 |
| 4C32G*4 | 1000 | 66,362.21 |
| 8C64G*2 | 1000 | 63,527.22 |
| 8C64G*4 | 1000 | 92,856.59 |
write_only

| Instance specification | Concurrent threads | QPS |
|---|---|---|
| 4C32G*2 | 400 | 37,884.63 |
| 4C32G*4 | 600 | 52,481.99 |
| 8C64G*2 | 600 | 58,711.55 |
| 8C64G*4 | 600 | 74,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, andXPROTO_MAX_DN_WAIT_CONNECTIONare set to the values in Step 3. Run theset globalSQL 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.