AWS ALB Connection Draining not Closing Connections after Deregistration Delay

amazon ec2amazon-albamazon-elbamazon-web-services

I have three instances configured as targets in an ALB. Connection draining is disabled (deregistration delay set to 0 seconds). Sticky sessions are enabled for 5 minutes.

I get stuck to one web server and start a long running (45s) request to it. I immediately remove the server from the target group. After 45 seconds, the request completes.

Two questions:

  1. Is it normal for an in-flight request to an instance to complete if connection draining is disabled?

  2. If so, how is that any different than using connection draining?

After testing this extensively, it appears that the target deregisters about 12 seconds after I complete the steps to remove it from the target group. But this still leaves about 30 seconds during which the ALB should forcibly terminate the connection to the instance.

Best Answer

  1. Yes, your open connections should complete because the backend instance is still functioning and the traffic has already been directed to it(sticky). Terminate this instance and things will change dramatically.

  2. The Load balancer will cease delivering traffic for new sessions to the now removed instance, but until all the existing sessions expire (5 min) those that are supposed to be sticky will remain so.

Related Topic