nginx+tomcat cluster construction
But 502 bad Gateway always starts to appear at 7 or 8 o'clock every day.
Can someone help me analyze the reasons for various situations?
error.log record
2014/10/07 07:59:47 [error] 7783#0:
*90920 connect() failed (111: Connection refused) while connecting to upstream, client: 124.133.28.7, server: xx.com, request: "GET / HTTP/1.1", upstream: "http://127.0.1.1: 8888/", host: "xx.com"
Access directly on the server through http://127.0.1.1:8888/ to see if the site is available, and then determine whether there is an nginx configuration problem.
Have you added keepalive configuration to your upstream?
Establish a long connection between nginx and backend to avoid repeatedly creating tcp connections when a large number of requests are made, otherwise 502 will easily occur
I think your situation is related to the specific time period. It is probably caused by the large number of concurrent requests during this time period
In addition, check the memory and CPU usage of your application server during this period. It is also possible that a code bug causes the application server to be unable to respond to more connections
Maybe there is a problem with the tomcat server or there is a bug in the code
Look at the tomcat log, there may be relevant information
When the tomcat server is inaccessible, ngnix will report 502