我们确实有一个奇怪的nginx超时生产问题.超时说明如下:
"upstream timed out(110: Connection timed out)"
Run Code Online (Sandbox Code Playgroud)
这里,上游服务器正在jetty运行nginx的同一主机上运行.Jetty正在运行8080nginx的端口上运行443.
检查了上述错误后,我验证了jetty日志和nginx日志的日志.虽然jetty在不到一秒的时间内就会返回响应,但是发送给nginx的响应正在delayed接近60 secs.并且nginx正在使用http响应代码在60秒后触发timedout警报504.这种情况正在发生intermittently.
以下是jetty和nginx的日志,用于超时请求.
码头日志:
{ "EVT":1494519426927 "intelId": "50", "intelSeq":112506 "intelVer": "1", "时间": "2017-05-11T16:17:06.927Z", "uiCorrelationIdV1": "SUI-1494519425839-42047","threadName":"qtp754853679-357","wResource":" http://m.xxx.com/search/facet/women/womens-handbags-9780510203/shoulder/_/N -53f3Z7hk9Z1z0roil ","wMethod":"GET","wStatus":200,"wDurationMicros":1087801,"wJlpLocation":"","wFwdFor":" NADA ","wHostHdr":"m.xxxx.com" ,"wReferer":" https://m.xxxx.com/search/facet/women/womens-handbags-9780510203/_/N-53f3Z7hk9?search-term=Bags&sortBy=priceLow&facet=Handbag%20Style ","wHttpVer" :"HTTP/1.0","wWsgClientIp":"80.192.191.2","wSrcIP":"127.0.0.1","wUserAgent":"Mozilla/5.0(iPhone; CPU iPhone OS 10_3_1,如Mac OS X)AppleWebKit/603.1 .30(KHTML,与Gecko一样)Version/10.0 Mobile/14E304 Safari/602.1","intelCropped":false,"intelLength":834}
Nginx日志:
2017-05-11T17:18:09 + 01:00 intelId ="56"intelVer ="2"wMethod ="GET"wResource ="/ search/facet/women/womens-handbags-9780510203/across-body/shoulder// N-53f3Z7hk9Z1z0roq4Z1z0roil?search-term = Bags&sortBy = priceLow&facet = Handbag%20Style"wStatus ="504"wCacheStatus ="MISS"wSrcIP ="172.17.233.135"wSize ="176"wDurationSeconds ="60.001"wHostHdr ="m.xxx .com"wReferer ="https://m.xxxx.com/search/facet/women/womens-handbags-9780510203/shoulder//N-53f3Z7hk9Z1z0roil?search-term = Bags&sortBy = priceLow&facet = Handbag%20Style"wSSL =" on"wSSLver ="771"wSSLciph ="TLS1.2-ECDHE-RSA-AES256-GCM-SHA384"wWsgClientIp ="80.192.191.2"wFwdFor =" - "wJlpLocation =" - "wProtocol ="HTTP/1.1"wUpstreamAddr = "127.0.0.1:8080"wPort = 443 s_vi ="[CS] v1 | 2B4D4CA80501261B-600001064000B11D [CE]"s_ppv ="jl%253Asearch%2C14%2C100%2C5789%2C414%2C628%2C414%2C736%2C3%2CP" recognisedUser ="true"wUiCorrelationIdV1 =" - "wUserAgent ="Mozilla/5.0(iPhone; CPU iPhone OS 10_3_1与Mac OS X一样)AppleWebKit/603.1.30(KHTML,与Gecko一样)Version/10.0 Mobile/14 E304 Safari/602.1"deviceType ="mobile"
从上面的两个日志中,我们可以推断出码头返回了200响应2017-05-11T16:17:06.927Z,但它是由nginx收到的2017-05-11T17:18:09+01:00.这60多秒导致超时.它有点奇怪,因为nginx和jetty都托管在同一台主机上.
如果有人可以帮助我们调试问题或提供建议,那就太棒了.
提前谢谢了.
您需要进行设置proxy_http_version以使您的保活设置相关。此外,该keepalive设置应该位于您的上游块中。
例如将其添加到您的配置中
proxy_http_version 1.1;
proxy_set_header Connection "";
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
570 次 |
| 最近记录: |