1、压测方案概述
在硬件完全相同的情况下,模拟线上数据量,插入370万条订单,横向对比改造前、sharding-jdbc方案、mysql分区表三者的效率。
压测接口:/order/create
数据表:order_info、order_detail
索引情况:order_info.AK_ORDER_INFO、order_info .IN_ORDER_INFO_UPDATE_TIME、order_detail.IN_ORDER_DETAIL_UPDATE_TIME
Sharding-jdbc分表方案:根据orderId的前8位,按日期进行路由。预期:拆分后的两张表数据量基本相当,效率有明显提升。
2、改造前压测结果
数据量:370w
线程数:30
压测客户机:win10 16G内存
应用服务器:win10 16G内存
应用日志:ERROR
数据库服务器: centos7 4c 16G内存 mysql5.7
耗时:00:54:05
汇总报告:
# Samples | Average | Min | Max | Std. Dev. | Error % | Throughput | Received KB/sec | Sent KB/sec | Avg. Bytes |
3703680 | 26 | 5 | 731 | 25.58 | 0.00% | 1141.21859 | 277.5 | 1679.51 | 249 |
3703680 | 26 | 5 | 731 | 25.58 | 0.00% | 1141.21859 | 277.5 | 1679.51 | 249 |
聚合报告:
# Samples | Average | Median | 90% Line | 95% Line | 99% Line | Min | Max | Error % | Throughput | Received KB/sec | Sent KB/sec |
3703680 | 26 | 22 | 31 | 40 | 164 | 5 | 731 | 0.00% | 1141.219 | 277.5 | 1679.51 |
3703680 | 26 | 22 | 31 | 40 | 164 | 5 | 731 | 0.00% | 1141.219 | 277.5 | 1679.51 |
3、Sharding-jdbc方案压测结果
数据量:370w
线程数:30
压测客户机:win10 16G内存
应用服务器:win10 16G内存
应用日志:ERROR
数据库服务器: centos7 4c 16G内存 mysql5.7
耗时:00:49:41
汇总报告:
# Samples | Average | Min | Max | Std. Dev. | Error % | Throughput | Received KB/sec | Sent KB/sec | Avg. Bytes |
3703680 | 24 | 5 | 745 | 22.88 | 0.00% | 1242.077 | 302.04 | 1827.94 | 249 |
3703680 | 24 | 5 | 745 | 22.88 | 0.00% | 1242.077 | 302.04 | 1827.94 | 249 |
聚合报告:
# Samples | Average | Median | 90% Line | 95% Line | 99% Line | Min | Max | Error % | Throughput | Received KB/sec | Sent KB/sec |
3703680 | 24 | 20 | 31 | 40 | 139 | 5 | 745 | 0.00% | 1242.077 | 302.04 | 1827.94 |
3703680 | 24 | 20 | 31 | 40 | 139 | 5 | 745 | 0.00% | 1242.077 | 302.04 | 1827.94 |
4、效率对比
4.1 对比结果
Sharding-jdbc方案:
吞吐量(Throughput)提升8.84%
90%用户的响应时间(90% Line)提升15.24%
响应时间中位数(Median)提升:9.09%