Why would AWS ELB (Elastic Load Balancer) sometimes returns 504 (gateway timeout) right away?

5.6k views Asked by At

ELB occasionally returns 504 to our clients right away (under 1 seconds). Problem is, it's totally random, when we repeat the request right away, it works as it should be.

Anyone have same issue or any idea on this?

1

There are 1 answers

5
Adam Ocsvari On

Does this answers for your quiestion:

Troubleshooting Elastic Load Balancing: HTTP Errors

HTTP 504: Gateway Timeout

Description: Indicates that the load balancer closed a connection because a request did not complete within the idle timeout period.

Cause: The application takes longer to respond than the configured idle timeout.

Solution: Monitor the HTTPCode_ELB_5XX and Latency CloudWatch metrics. If there is an increase in these metrics, it could be due to the application not responding within the idle timeout period. For details about the requests that are timing out, enable access logs on the load balancer and review the 504 response codes in the logs that are generated by Elastic Load Balancing. If necessary, you can increase your back-end capacity or increase the configured idle timeout so that lengthy operations (such as uploading a large file) can complete.

Or this: 504 gateway timeout LB and EC2