ALB vs HAProxy to Load Balance Shards

Hi there,

Has anyone successfully used an AWS Application Load Balancer instead of HAProxy to load balance traffic between two Jitsi Meet shards?

My understanding is with HAProxy you need to use stick-tables tracking on the “room=” query string to make sure participants in the same room are directed to the appropriate shard.

I don’t see a way to replicate that specifically with an ALB but maybe something similar can be done with Application-based stickiness and custom cookies. I wanted to see if anyone had any experience with this before I go too far down the rabbit-hole.


You would be able to do it with just ALB if you use a custom cookie for stickiness and ensure the cookie is set to the room name (or something derived from it) before the XMPP connection is initiated. But it would require some small modifications to Jitsi Meet to set the cookies.

Another way using only AWS services is to put CloudFront in front (yes, it does support WebSocket) and use CloudFront Functions or Lambda@Edge to direct room names to shards. CF Functions is lighterweight but can’t access any state, so you could only hash the room names to pick shards, which might result in unbalanced load (depending on your room names). Lambda@Edge can access other AWS services, so you could keep a table and balance rooms evenly.