Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS ELB throwing 5XX but the registered instances are not throwing 5XX errors

I am using AWS ELB. After seeing graph of ELB, there were few 5XX erros. I enabled the logs and came to know that one of the api call to registered instances was getting timed out as the error on ELB logs was 504. I again monitored the registered instances if it is throwing any 5XX response, but it wasn't. The nginx keep-alive timeout is set to 15s and the timeout of ELB is 60s. So if the request is really getting timed out than it should have timed out at instance level rather than on ELB level. Can anybody suggests what could be the possible scenario of error?

like image 962
drishti ahuja Avatar asked Jun 16 '16 22:06

drishti ahuja


People also ask

What causes ELB 5xx?

ELB 5XX errors HTTP 5XX error codes are generated when there is an issue either with your load balancer or in your back-end instance. Troubleshoot these errors by configuring the optimal application idle timeout and also by ensuring there are enough healthy EC2 instances registered to the availability zone.

What happens to instances that are not functioning properly in an ELB?

If one EC2 instance fails, Elastic Load Balancing automatically reroutes the traffic to the remaining running EC2 instances. If the failed EC2 instance is restored, Elastic Load Balancing restores the traffic to that instance.

How do I fix error code 5xx?

If you encounter a 5xx response on your own webpage or site, first try these two things to remedy the issue: When the error appears, wait for a moment, and then try reloading the page to ensure that the problem was not just a momentary issue. Check the error log for the website that's returning the error.

Why am I getting a 5xx server error?

A 5xx code occurs when a server does not support the functionality required to process a visitor's request. Simply put, it means that there's an error caused by the server. In many cases, a chain of servers is handling an HTTP request, so keep in mind that it may not be your server that's causing the issue.


1 Answers

The 504 is not being returned by nginx to the ELB. The ELB is returning a 504 because it times out waiting for a response from the API instance, which also means that nginx can't return an HTTP status code on a query that it hasn't finished serving. As this doc says, for one thing, your instance's keep-alive time should be at least the size of the ELB timeout. http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/ts-elb-error-message.html#ts-elb-errorcodes-http504

like image 168
Karen B Avatar answered Nov 18 '22 03:11

Karen B