AWS documentation mentions the following:

To ensure that the load balancer is responsible for closing the connections to your instance, make sure that the value you set for the HTTP keep-alive time is greater than the idle timeout setting on your load balancer.

I am facing an issue where my ELB is firing ~40 requests (js,css,img) with each having KeepAlive enabled, it uses up all of my worker threads and blocks them for KeepAliveTimeout (which I set to be higher than ELB Timeout as suggested).

However, ELB doesn't close the connections when the page is done loading - they just sit there blocking the workers until they time out.

So here I am facing with 2 questions:

  1. Why ELB fires 40 different connections and doesn't just reuse the same one?
  2. Why doesn't ELB clean up the connections when it's done with them?

Are you enabling Sticky Sessions at the EC2 level or the ELB-level? Is Stickiness enabled? What's the deregistration time? Is Connection Draining Enabled?

  1. ELB will fire up new sessions if Sticky Sessions is not enabled typically.
  2. If you enable Sticky Sessions on the ELB, you are awaiting for the connection at the ELB-level. It is recommended to enable Sticky Sessions at the EC2 level in the case of a EC2 instances failing, auto-scaling will be forced to spin up a new instance. This eliminates "What if a session is alive but my EC2 instance died?"

"Amazon ELB currently timeouts persistent socket connections @ 60 seconds if it is kept idle. This condition will be a problem for use cases which generate large files (PDF, reports) at back end EC2, send them as response back and keep connections idle during the entire generation process."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.