1、压测环境
操作系统:MAC电脑上虚拟出两个Linux(centos 7)
配置:2c2g
数据库版本:MySQL 5.7
vm1:安装 MySQL 5.7 数据库
vm2:安装 sysbench
2、压测方法
https://help.aliyun.com/document_detail/53632.html
参考阿里云的帮忙文档,安装并优化操作系统参数,但虚拟机配置较低,
【sudo sh -c 'for x in /sys/class/net/eth0/queues/rx-*; do echo f>$x/rps_cpus; done'】这行参数我做了修改,只写了一个‘f’
2.1生成测试数据
sysbench --db-driver=mysql --mysql-host=172.16.1.10 --mysql-port=3306 --mysql-user=root --mysql-password=123456 --mysql-db=sbtest --table_size=25000 --tables=250 --events=0 --time=600 oltp_read_write prepare
2.2开始压测
8线程压测120秒
sysbench --db-driver=mysql --mysql-host=172.16.1.10 --mysql-port=3306 --mysql-user=root --mysql-password=123456 --mysql-db=sbtest --table_size=25000 --tables=250 --events=0 --time=120 --threads=8 --percentile=95 --report-interval=1 oltp_read_write run
3、压测结果
3.1开启SSL加密结果
SQL statistics:
queries performed:
read: 480130
write: 137180
other: 68590
total: 685900
transactions: 34295 (285.56 per sec.)
queries: 685900 (5711.24 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 120.0947s
total number of events: 34295
Latency (ms):
min: 11.05
avg: 27.99
max: 152.91
95th percentile: 52.89
sum: 959995.88
Threads fairness:
events (avg/stddev): 4286.8750/34.98
execution time (avg/stddev): 119.9995/0.02
3.2关闭SSL加密结果
SQL statistics:
queries performed:
read: 613130
write: 175180
other: 87590
total: 875900
transactions: 43795 (364.79 per sec.)
queries: 875900 (7295.80 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 120.0540s
total number of events: 43795
Latency (ms):
min: 6.73
avg: 21.92
max: 134.68
95th percentile: 44.17
sum: 959923.22
Threads fairness:
events (avg/stddev): 5474.3750/25.90
execution time (avg/stddev): 119.9904/0.02
结论:
TPS | QPS | |
---|---|---|
开启SSL | 285.56 | 5711.24 |
关闭SSL | 364.79 | 7295.80 |
差值 | 79.23 | 1584.56 |
性能下降(%) | 21.7% | 21.7% |
性能下降算法: 差值/关闭SSL