在用ab做nginx的高并发测试的时候,/var/log/nginx/error.log报出了一下的错误
客户端ab命令:
ab -n 20000 -c 20000 "http://192.168.10.12:9390/newton/login?
content=%7B%22ak%22%3A%22BEQhCcSWA0ouaD193QkafgAKJKbVt3l3T8OTOCTUfnKkWrWjVkD41FMxToFaUb8
BK7PUHg1ev%2BdMtC1QZlbg9iggqa2M3ILq8HpvugIa%2FM6C6OVmTTioqE25UeDU%22%2C%22ct%22%3A%22hUX
6qQ40tVJc5a7wmET%2BzOOoYpTT0kb0BrmTDajNT%2Bk2H9Von3rL%2FZjvBtZSw5Em2hAE5Nagx2e%2F0Kjc9pC
2sxmMY0l5Z3EaAq3GPP%2BKKl4%2FqKbHvgdbysvoIqCK5GoxW5Uvas8QTCvTRKtAM%2FxAVA%3D%3D%22%7D"
报错信息如下:
2018/08/02 13:45:22 [error] 28904#28904: *1842468 upstream timed out (110: Connection
timed out) while connecting to upstream, client: 192.168.10.11, server: localhost,
request: "GET /newton/login?
content=%7B%22ak%22%3A%22BEQhCcSWA0ouaD193QkafgAKJKbVt3l3T8OTOCTUfnKkWrWjVkD41FMxToFaUb8
BK7PUHg1ev%2BdMtC1QZlbg9iggqa2M3ILq8HpvugIa%2FM6C6OVmTTioqE25UeDU%22%2C%22ct%22%3A%22hUX
6qQ40tVJc5a7wmET%2BzOOoYpTT0kb0BrmTDajNT%2Bk2H9Von3rL%2FZjvBtZSw5Em2hAE5Nagx2e%2F0Kjc9pC
2sxmMY0l5Z3EaAq3GPP%2BKKl4%2FqKbHvgdbysvoIqCK5GoxW5Uvas8QTCvTRKtAM%2FxAVA%3D%3D%22%7D
HTTP/1.0", upstream: "http://192.168.9.12:9380/newton/login?
content=%7B%22ak%22%3A%22BEQhCcSWA0ouaD193QkafgAKJKbVt3l3T8OTOCTUfnKkWrWjVkD41FMxToFaUb8
BK7PUHg1ev%2BdMtC1QZlbg9iggqa2M3ILq8HpvugIa%2FM6C6OVmTTioqE25UeDU%22%2C%22ct%22%3A%22hUX
6qQ40tVJc5a7wmET%2BzOOoYpTT0kb0BrmTDajNT%2Bk2H9Von3rL%2FZjvBtZSw5Em2hAE5Nagx2e%2F0Kjc9pC
2sxmMY0l5Z3EaAq3GPP%2BKKl4%2FqKbHvgdbysvoIqCK5GoxW5Uvas8QTCvTRKtAM%2FxAVA%3D%3D%22%7D",
host: "192.168.10.12:9390"
这时候,ab客户端会显示一部分请求失败:
Server Software: nginx/1.12.2
Server Hostname: 192.168.10.12
Server Port: 9390
Document Path: /newton/login?content=%7B%22ak%22%3A%22BEQhCcSWA0ouaD193QkafgAKJKbVt3l3T8OTOCTUfnKkWrWjVkD41FMxToFaUb8BK7PUHg1ev%2BdMtC1QZlbg9iggqa2M3ILq8HpvugIa%2FM6C6OVmTTioqE25UeDU%22%2C%22ct%22%3A%22hUX6qQ40tVJc5a7wmET%2BzOOoYpTT0kb0BrmTDajNT%2Bk2H9Von3rL%2FZjvBtZSw5Em2hAE5Nagx2e%2F0Kjc9pC2sxmMY0l5Z3EaAq3GPP%2BKKl4%2FqKbHvgdbysvoIqCK5GoxW5Uvas8QTCvTRKtAM%2FxAVA%3D%3D%22%7D
Document Length: 251 bytes
Concurrency Level: 20000
Time taken for tests: 60.313 seconds
Complete requests: 20000
Failed requests: 4116
(Connect: 0, Receive: 0, Length: 4116, Exceptions: 0)
Non-2xx responses: 4116
Total transferred: 10094851 bytes
HTML transferred: 6197176 bytes
Requests per second: 331.60 [#/sec] (mean)
Time per request: 60312.903 [ms] (mean)
Time per request: 3.016 [ms] (mean, across all concurrent requests)
Transfer rate: 163.45 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 387 1196.8 47 7019
Processing: 97 15956 23258.1 2592 60130
Waiting: 97 15956 23258.1 2592 60130
Total: 97 16343 23111.3 3231 60197
Percentage of the requests served within a certain time (ms)
50% 3231
66% 9468
75% 15875
80% 60173
90% 60180
95% 60188
98% 60192
99% 60193
100% 60197 (longest request)
解决方案:
还未找到!