[英]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.
它在单个服务器上运行良好,但当 AWS 中的负载均衡器后面有多个服务器时会失败。
For example, I have 3 EC2 instances behind a load balancer let's say: Instance 1, Instance 2, and Instance 3例如,我在负载均衡器后面有 3 个 EC2 实例,比如说:实例 1、实例 2 和实例 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.因此,当广播公司开始托管实时流时,假设 AWS ALB(负载均衡器)将广播器发送到实例 2。因此,当客户端(另一个用户)想要加入实时流时,只有当 AWS ALB 将它们发送到时,他们才能加入实例 2,如果它们被 ALB 发送到实例 1 或实例 3,则无法加入。
How can I send all the clients to a specific instance, stickiness feature provided by AWS won't work.如何将所有客户端发送到特定实例,AWS 提供的粘性功能将不起作用。 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/ .我会研究 CloudFront 的实时流媒体支持: https : //aws.amazon.com/cloudfront/streaming/ 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.