Thursday, 24 October 2013

504 Gateway Timeout Error

Problem: My load balancer machine is giving me 504 Gateway Timeout Error.

HTTP request flow :

Browser <-> nginx(load balaencer on port 80) <-> Apache ( reverse proxy on port 85) <-> haproxy (load balaencer on 7070) <-> Tomcat ( Servlet Enginge 8080)


When I am accessing resource http://www.mydomain.com/helloworld/hello.jsp I receive 504 Gateway Timeout Error gateway time out. I am clue less which server is sending this error. I verified the logs of ngnix,apache,haproxy,tomcat none of them revel evident root cause.

Approach Taken to solve the Problem:

Let’s access the resource from bottom to top


http://tomcat-ip:8080 /helloworld/hello.jsp  (Resource is served in  5min. No time out)
http://Apache-ip:8585 /helloworld/hello.jsp (Received 504 Gateway time out)
http://nginx:80 /helloworld/hello.jsp (Received 504 Gateway time out)

We identified the root cause for this problem is haproxy and we need to increase the load_balancer time out of it.

Solution:

  • Stop haproxy .  ( I  greped for process id and killed the process)
  • Edit  /etc/haproxy/haproxy.cfg
  • Increase the value of
  •        clitimeout              9930000
  •         contimeout              9930000
  •         srvtimeout              9930000
  • Start haproxy  (./haproxy-1.4.24 -f /etc/haproxy/haproxy.cfg)



No comments:

Post a Comment