How to Temporarily Stop Traffic to a WebSocket Instance?

0
0
Asked By TechWhiz42 On

I'm managing a service with long-lived WebSocket connections, and I'm facing a challenge. Once I reach my configured capacity, I'd like to stop my Application Load Balancer (ALB) from routing new traffic to one of my instances. I've attempted to use separate live and ready endpoints, but when the ready endpoint indicates degraded performance, it gets drained and rescheduled, which isn't ideal. Has anyone implemented a solution for handling traffic routing like this?

4 Answers

Answered By LoadBalancerPro On

Another route could be using the "Least outstanding requests" routing algorithm in your target group. This way, requests go to the instances that have the lowest number of in-progress requests. But remember, this mainly benefits initial connections, not ongoing WebSocket connections.

Answered By CloudGuru99 On

You might want to consider just having the properly sized instances for your traffic needs. If you must implement a temporary stop, one option could be for the instance to remove itself from the target group when it hits capacity and then reinsert itself when it's ready again.

Answered By LambdaNinja On

Why not utilize a Lambda function to manage your ALB security group? By adding or removing ports, you could stop traffic from being routed without terminating existing connections.

Answered By ServerSage On

You could also set up your ALB health checks to fail when you reach capacity and pass when below capacity. This should work fine with EC2 instances and would effectively stop new traffic.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.