Question

We are looking into using AWS for our hosting environment and have setup a test VPC. We runs rails app using Unicorn behind nginx at the moment. While attempting to setup our servers behind an ELB, they kept getting kicked out due to "failed health checks".

However, the health checks are returning status 200 and will shortly return to active status after the required number of 200 status. As soon as requests start hitting the server, the ELB will drop the server again. As near as I can tell, this is due to the fact that unicorn doesn't keep connections open and will close the connection after the request is complete. ELBs don't like this apparently from there troubleshooting page: http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/ts-elb-healthcheck.html

Am I correct that this is the issue? Is there a way to work around this without setting up additional nginx servers? Do any of the Unicorn alternatives play nice with Amazon ELB?

Was it helpful?

Solution

I just spent a day in tears trying to get gunicorn (python based) to work behind the ELB. I looks like it works fine behind nginx (fingers crossed). Make sure the elb health check is not going directly to the unicorn. It should go though nginx.

It is my understanding the the unicorn style is to get a request, handle it, then move on. The ELBs want to keep the connection open to improve efficiency. Nginx can handle many connections sticking around without any problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top