简体   繁体   中英

AWS ALB custom stickiness to EC2 instance

I am trying to design a one-to-many broadcasting application and horizontally scale servers. Basically, a broadcaster can start hosting, and others can join the video live streaming. It is working fine with a single server but fails when there are multiple servers behind a load balancer in AWS.

For example, I have 3 EC2 instances behind a load balancer let's say: Instance 1, Instance 2, and Instance 3

So, when a broadcaster starts hosting a live stream then let's say AWS ALB(load balancer) sends the broadcaster to instance 2. So when a client(another user) wants to join the live streaming they can join only when AWS ALB sends them to Instance 2 and fails to join if they are sent to Instance 1 or Instance 3 by ALB.

How can I send all the clients to a specific instance, stickiness feature provided by AWS won't work. Can I achieve this? If not, what's the better way to design this system?

Stickiness-based approaches won't scale even if you manage to achieve it technically. The number of users watching a stream would be limited by the capacity of an instance, or even lower if you consider the scenario where more than one popular broadcaster end up on the same instance.

I would look into CloudFront's live streaming support: https://aws.amazon.com/cloudfront/streaming/ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM