1 申请到的ECS资源,场景中使用这个ECS对serverless RDS进行压测
2 申请及配置serverless RDS实例
1) 创建数据库
2)创建账号
创建一个普通账号,授予上面创建数据库的ddl+DML权限
3)在白名单中添加申请的ECS弹性地址
3 在ECS中对serverless RDS进行压测
1) 准备数据
[root@iZbp125mswa4preafkipgyZ ~]# sysbench --threads=64 --time=60 --mysql_host=rm-bp17h406ii8i78zx8ro.mysql.rds.aliyuncs.com --mysql-port=3306 --mysql-db=serverless --mysql-user=test_user --mysql-password=Password123 /usr/share/sysbench/oltp_read_write.lua --tables=10 --table_size=10000 prepare
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Initializing worker threads...
Creating table 'sbtest8'...
Creating table 'sbtest9'...
Creating table 'sbtest6'...
Creating table 'sbtest5'...
Creating table 'sbtest4'...
Creating table 'sbtest3'...
Inserting 10000 records into 'sbtest8'
Inserting 10000 records into 'sbtest6'
Inserting 10000 records into 'sbtest9'
Inserting 10000 records into 'sbtest5'
Inserting 10000 records into 'sbtest4'
Inserting 10000 records into 'sbtest3'
Creating table 'sbtest7'...
Creating table 'sbtest10'...
Creating table 'sbtest2'...
Creating table 'sbtest1'...Inserting 10000 records into 'sbtest7'
Inserting 10000 records into 'sbtest10'
Inserting 10000 records into 'sbtest2'
Inserting 10000 records into 'sbtest1'
Creating a secondary index on 'sbtest3'...
Creating a secondary index on 'sbtest8'...
Creating a secondary index on 'sbtest9'...
Creating a secondary index on 'sbtest4'...
Creating a secondary index on 'sbtest5'...
Creating a secondary index on 'sbtest7'...
Creating a secondary index on 'sbtest2'...
Creating a secondary index on 'sbtest6'...
Creating a secondary index on 'sbtest10'...
Creating a secondary index on 'sbtest1'...
2) 进行压测
sysbench --threads=64 --time=60 --histogram=on --mysql_host=rm-bp17h406ii8i78zx8ro.mysql.rds.aliyuncs.com --mysql-port=3306 --mysql-db=serverless --mysql-user=test_user --mysql-password=Password123 /usr/share/sysbench/oltp_read_write.lua --report-interval=1 --tables=10 --table_size=10000 run
SQL statistics:
queries performed:
read: 247646
write: 70756
other: 35378
total: 353780
transactions: 17689 (292.85 per sec.)
queries: 353780 (5857.06 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 60.4007s
total number of events: 17689
Latency (ms):
min: 23.54
avg: 217.59
max: 1734.93
95th percentile: 669.89
sum: 3848877.70
Threads fairness:
events (avg/stddev): 276.3906/25.39
execution time (avg/stddev): 60.1387/0.09
压测过程中的截图
4 查看压测过程中serverless RDS资源的变化
可以看到压测过程中serverless调整了资源,压测完毕后资源又恢复到了调整之前的水平。