This topic provides guidelines for new users to test the performance of an ApsaraDB RDS for MySQL instance and submit a test report. After you submit a test report, you can receive additional discounts for instance renewal. If your test report is rated excellent, you are offered with substantial incentives from Alibaba Cloud.
Prerequisites
An ApsaraDB RDS for MySQL instance is created in the ApsaraDB for RDS console. For more information, see Create an ApsaraDB RDS for MySQL instance.
An ECS instance is created. For more information, see Create an instance with Custom Launch.
Background information
The following performance metrics are tested:
Transactions per second (TPS)
The number of transactions that are executed by the RDS instance per second. A transaction is executed only after it is committed.
Use SysBench to test the performance of online transactional processing (OLTP) for executing a read/write transaction that consists of 18 read and write SQL statements.
Use SysBench to test the performance of OLTP for executing a read-only transaction that consists of 14 read SQL statements: 10 SQL statements are used to query data based on primary keys and 4 SQL statements are used to query data based on specified ranges.
Use SysBench to test the performance of OLTP for executing a write-only transaction that consists of four write SQL statements: two UPDATE statements, one DETELE statement, and one INSERT statement.
Queries per second (QPS)
The number of SQL statements that are executed by the RDS instance per second. These SQL statements include INSERT, SELECT, UPDATE, DETELE, and COMMIT.
SysBench parameters
Parameter | Description |
db-driver | The database engine that the RDS instance runs. |
mysql-host | The endpoint used to connect to the RDS instance. |
mysql-port | The port used to connect to the RDS instance. |
mysql-user | The username of the account used to manage the RDS instance. |
mysql-password | The password of the account used to manage the RDS instance. |
mysql-db | The name of the RDS instance |
table_size | The size of tables used for the test. |
tables | The number of tables used for the test. |
events | The number of requests sent for the test. |
time | The time taken for the test. |
threads | The number of threads invoked for the test. |
percentile | The percentage of execution durations that you want to analyze for the test to obtain an average execution duration. The default value is 95%. It allows you to obtain the average time that is required to execute a request for 95% of all the scenarios. |
report-interval | The time interval at which you want to generate a test progress report. The value 0 specifies not to generate test progress reports but only to generate a final test report. |
rand-type | Random number distribution type. Default value: special. In this test, uniform is used. |
Test procedure
Log on to your ECS instance and run the following commands to install SysBench:
sudo yum install gcc gcc-c++ autoconf automake make libtool mysql-devel git mysql git clone https://github.com/akopytov/sysbench.git ## Download the SysBench software package from GitHub. cd sysbench ## Open the SysBench installation directory. git checkout 1.0.18 ## Switch to SysBench 1.0.18. ./autogen.sh ## Execute the autogen.sh script. ./configure --prefix=/usr --mandir=/usr/share/man make ## Compile SysBench. make installTest the performance of OLTP for executing read/write, read-only, and write-only transactions.
Test the performance of OLTP for executing read/write transactions.
Run the following commands to perform the test (for more information, see SysBench parameters):
##Prepare the data used for the test. sysbench --db-driver=mysql --mysql-host=XXX --mysql-port=XXX --mysql-user=XXX --mysql-password=XXX --mysql-db=sbtest --table_size=25000 --tables=100 --events=0 --time=300 --threads=XXX oltp_read_write prepare ##Run your workload. sysbench --db-driver=mysql --mysql-host=XXX --mysql-port=XXX --mysql-user=XXX --mysql-password=XXX --mysql-db=sbtest --table_size=25000 --tables=100 --events=0 --time=300 --threads=XXX --percentile=95 --rand-type="uniform" --report-interval=1 oltp_read_write run ##Delete the data used for the test. sysbench --db-driver=mysql --mysql-host=XXX --mysql-port=XXX --mysql-user=XXX --mysql-password=XXX --mysql-db=sbtest --table_size=25000 --tables=100 --events=0 --time=300 --threads=XXX --percentile=95 oltp_read_write cleanupSample test results:
QPS: 23869.32
TPS: 1193.47
Response time (RT): 36.89 ms
[ 55s ] thds: 16 tps: 1238.00 qps: 24720.98 (r/w/o: 17294.99/4951.00/2475.00) lat (ms,95%): 35.59 err/s: 0.00 reconn/s: 0.00 [ 56s ] thds: 16 tps: 1195.00 qps: 23924.02 (r/w/o: 16752.01/4782.00/2390.00) lat (ms,95%): 36.24 err/s: 0.00 reconn/s: 0.00 [ 57s ] thds: 16 tps: 1235.00 qps: 24714.10 (r/w/o: 17308.07/4935.02/2471.01) lat (ms,95%): 36.24 err/s: 0.00 reconn/s: 0.00 [ 58s ] thds: 16 tps: 1230.99 qps: 24594.83 (r/w/o: 17205.88/4926.97/2461.98) lat (ms,95%): 36.24 err/s: 0.00 reconn/s: 0.00 [ 59s ] thds: 16 tps: 1187.00 qps: 23786.05 (r/w/o: 16655.03/4757.01/2374.00) lat (ms,95%): 36.89 err/s: 0.00 reconn/s: 0.00 [ 60s ] thds: 16 tps: 1212.00 qps: 24252.93 (r/w/o: 16964.95/4863.99/2423.99) lat (ms,95%): 36.24 err/s: 0.00 reconn/s: 0.00 SQL statistics: queries performed: read: 1003268 write: 286648 other: 143324 total: 1433240 transactions: 71662 (1193.47 per sec.) queries: 1433240 (23869.32 per sec.) ignored errors: 0 (0.00 per sec.) reconnects: 0 (0.00 per sec.) General statistics: total time: 60.0439s total number of events: 71662 Latency (ms): min: 4.48 avg: 13.40 max: 142.82 95th percentile: 36.89 sum: 960169.64 Threads fairness: events (avg/stddev): 4478.8750/88.00 execution time (avg/stddev): 60.0106/0.00Test the performance of OLTP for executing read-only transactions.
Run the following commands to perform the test (for more information, see SysBench parameters):
NoteWe recommend that you purchase instances in the recommended zone on the buy page for testing.
##Prepare the data used for the test. sysbench --db-driver=mysql --mysql-host=XXX --mysql-port=XXX --mysql-user=XXX --mysql-password=XXX --mysql-db=sbtest --table_size=25000 --tables=100 --events=0 --time=300 --threads=XXX oltp_read_only prepare ##Run your workload. sysbench --db-driver=mysql --mysql-host=XXX --mysql-port=XXX --mysql-user=XXX --mysql-password=XXX --mysql-db=sbtest --table_size=25000 --tables=100 --events=0 --time=300 --threads=XXX --percentile=95 --rand-type="uniform" --report-interval=1 oltp_read_only run ##Delete the data used for the test. sysbench --db-driver=mysql --mysql-host=XXX --mysql-port=XXX --mysql-user=XXX --mysql-password=XXX --mysql-db=sbtest --table_size=25000 --tables=100 --events=0 --time=300 --threads=XXX --percentile=95 oltp_read_only cleanupSample test results:
QPS: 26130.73
RT: 33.72 ms
[ 55s ] thds: 16 tps: 1881.00 qps: 26417.97 (r/w/o: 26417.97/0.00/0.00) lat (ms,95%): 33.72 err/s: 0.00 reconn/s: 0.00 [ 56s ] thds: 16 tps: 1831.01 qps: 25564.09 (r/w/o: 25564.09/0.00/0.00) lat (ms,95%): 34.33 err/s: 0.00 reconn/s: 0.00 [ 57s ] thds: 16 tps: 1914.99 qps: 26829.90 (r/w/o: 26829.90/0.00/0.00) lat (ms,95%): 33.12 err/s: 0.00 reconn/s: 0.00 [ 58s ] thds: 16 tps: 1930.00 qps: 27013.02 (r/w/o: 27013.02/0.00/0.00) lat (ms,95%): 33.12 err/s: 0.00 reconn/s: 0.00 [ 59s ] thds: 16 tps: 1901.00 qps: 26569.06 (r/w/o: 26569.06/0.00/0.00) lat (ms,95%): 33.72 err/s: 0.00 reconn/s: 0.00 [ 60s ] thds: 16 tps: 1933.99 qps: 27157.92 (r/w/o: 27157.92/0.00/0.00) lat (ms,95%): 33.12 err/s: 0.00 reconn/s: 0.00 SQL statistics: queries performed: read: 1568952 write: 0 other: 0 total: 1568952 transactions: 112068 (1866.48 per sec.) queries: 1568952 (26130.73 per sec.) ignored errors: 0 (0.00 per sec.) reconnects: 0 (0.00 per sec.) General statistics: total time: 60.0410s total number of events: 112068 Latency (ms): min: 3.03 avg: 8.57 max: 84.14 95th percentile: 33.72 sum: 960237.13 Threads fairness: events (avg/stddev): 7004.2500/96.69 execution time (avg/stddev): 60.0148/0.01Test the performance of OLTP for executing write-only transactions.
Run the following commands to perform the test (for more information, see SysBench parameters):
##Prepare the data used for the test. sysbench --db-driver=mysql --mysql-host=XXX --mysql-port=XXX --mysql-user=XXX --mysql-password=XXX --mysql-db=sbtest --table_size=25000 --tables=100 --events=0 --time=300 --threads=XXX oltp_write_only prepare ##Run your workload. sysbench --db-driver=mysql --mysql-host=XXX --mysql-port=XXX --mysql-user=XXX --mysql-password=XXX --mysql-db=sbtest --table_size=25000 --tables=100 --events=0 --time=300 --threads=XXX --percentile=95 --rand-type="uniform" --report-interval=1 oltp_write_only run ##Delete the data used for the test. sysbench --db-driver=mysql --mysql-host=XXX --mysql-port=XXX --mysql-user=XXX --mysql-password=XXX --mysql-db=sbtest --table_size=25000 --tables=100 --events=0 --time=300 --threads=XXX --percentile=95 oltp_write_only cleanupSample test results:
TPS: 4255.01
RT: 16.71 ms
[ 56s ] thds: 16 tps: 4458.17 qps: 26789.02 (r/w/o: 0.00/17871.68/8917.34) lat (ms,95%): 14.21 err/s: 0.00 reconn/s: 0.00 [ 57s ] thds: 16 tps: 4416.02 qps: 26472.15 (r/w/o: 0.00/17640.10/8832.05) lat (ms,95%): 16.41 err/s: 0.00 reconn/s: 0.00 [ 58s ] thds: 16 tps: 3919.11 qps: 23508.64 (r/w/o: 0.00/15670.43/7838.21) lat (ms,95%): 17.63 err/s: 0.00 reconn/s: 0.00 [ 59s ] thds: 16 tps: 4089.00 qps: 24559.02 (r/w/o: 0.00/16381.01/8178.01) lat (ms,95%): 18.28 err/s: 0.00 reconn/s: 0.00 [ 60s ] thds: 16 tps: 4353.28 qps: 26100.68 (r/w/o: 0.00/17394.12/8706.56) lat (ms,95%): 19.65 err/s: 0.00 reconn/s: 0.00 SQL statistics: queries performed: read: 0 write: 1021552 other: 510776 total: 1532328 transactions: 255388 (4255.01 per sec.) queries: 1532328 (25530.04 per sec.) ignored errors: 0 (0.00 per sec.) reconnects: 0 (0.00 per sec.) General statistics: total time: 60.0192s total number of events: 255388 Latency (ms): min: 1.28 avg: 3.76 max: 182.50 95th percentile: 16.71 sum: 959762.69 Threads fairness: events (avg/stddev): 15961.7500/525.08 execution time (avg/stddev): 59.9852/0.00
NoteSysBench provides multiple standard benchmark models. You can select an appropriate model based on your business scenarios.