问题描述
当我们使用以下命令在龙卷风服务器上进行负载测试时:
ab -n 500 -c 100 http://<hostname>/api/stats/?events=691
在前400个请求(以200 rps的速度)之后-后100个请求花费大量时间。
我们在日志中得到以下结果:
[I 140314 12:25:19 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 12.92ms
[I 140314 12:25:19 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 21.22ms
[I 140314 12:25:19 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 28.75ms
[I 140314 12:25:20 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 3021.00ms
[I 140314 12:25:24 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 6403.66ms
[I 140314 12:25:24 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 6411.02ms
[I 140314 12:25:24 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 6417.97ms
[I 140314 12:25:24 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 6420.90ms
[I 140314 12:25:24 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 6426.83ms
[I 140314 12:25:24 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 6439.17ms
[I 140314 12:25:24 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 6442.40ms
[I 140314 12:25:24 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 6445.59ms
[I 140314 12:25:24 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 6449.05ms
[I 140314 12:25:24 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 6445.53ms
[I 140314 12:25:30 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 12985.94ms
[I 140314 12:25:30 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 12871.76ms
[I 140314 12:25:30 web:1462] 200 GET /api/stats/?events=691 (127.0.0.1) 12760.86ms
Momoko具有以下连接设置:
db_min_con = 5
db_max_con = 70
我们将postgresql的连接数限制为300个,对pgpool的限制也相同。
为什么测试结束时响应时间会增加? 在哪里挖?
1楼
您是否尝试使用纯同步psycopg2
重新创建此问题?
也许这个会提供提示吗?