error.log 中出现大量以下日志:
2013/11/13 11:26:10 [info] 18382#0: *2799 client closed connection while waiting for request, client: 127.0.0.1, server: 0.0.0.0:80
请求量很小,一分钟也才3、4百个,远不到之前压力测试的阀值。上面的 client 很多 127.0.0.1 的,偶尔有个其他 IP 的。尝试过开关 keep-alive 均没能起到作用,可能的问题出在哪呢?
Look at the error log level of your nginx and see if it is set to the info level.
I encountered similar information when I turned on the info level log. It should be that the client has set the HTTP request timeout. For example, it times out after 1 second. At this time, a packet is sent to the server to close the TCP connection, and Nginx detects it. After the client closes the connection, such a log will be recorded, and at this time, the status code 499 is recorded in the nginx access log.
When this problem occurs, it may usually be because the response time of your interface is too long and exceeds the timeout setting set by the client. It is recommended to record the $upstreamresponsetime $request_time two times in the nginx access log. See What is the typical request response time? If it does take a long time, then optimize the code.