Question

I'm planning a server environment on AWS with auto scaling over VPC.

My application has some process that is done in several steps on server, and the user should stick to the same server by using ELB's sticky session.

The problem is, that when the auto scaling group suppose to shut down server, some users may be in the middle of the process (the process takes multiple request - for example - 1. create an album 2. upload photos to the album each at a time 3. convert photos to movie and delete photos 4. store movie on S3)

Is it possible to configure the ELB to stop passing NEW users to the server that is about to shut down, while still passing previous users (that has the sticky session set)?, and - is it possible to tell the server to wait for, let's say, 10 min. after the shutdown rule applied before it actually shut down?

Thank you very much

Was it helpful?

Solution

This feature hasn't been available in Elastic Load Balancing at the time of your question, however, AWS has meanwhile addressed the main part of your question by adding ELB Connection Draining to avoid breaking open network connections while taking an instance out of service, updating its software, or replacing it with a fresh instance that contains updated software.

Please not that you still need to specify a sufficiently large timeout based on the maximum time you expect users to finish their activity, see Connection Draining:

When you enable connection draining for your load balancer, you can set a maximum time for the load balancer to continue serving in-flight requests to the deregistering instance before the load balancer closes the connection. The load balancer forcibly closes connections to the deregistering instance when the maximum time limit is reached.

[...]

If your instances are part of an Auto Scaling group and if connection draining is enabled for your load balancer, Auto Scaling will wait for the in-flight requests to complete or for the maximum timeout to expire, whichever comes first, before terminating instances due to a scaling event or health check replacement. [...] [emphasis mine]

The emphasized part confirms that it is not possible to specify an additional timeout that only applies after the last connection has been drained.

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