I have deployed self-hosted livekit on a digital o...
# self-hosting
s
I have deployed self-hosted livekit on a digital ocean kubernetes, The issue is that when pod resources gets increases(as a result of more users in room) , it creates a new pod in a new node due to auto-scaling ..my question is that will my new users coming in a new node will join the same room present in first node?? I saw in docs the room can only be run on a single node. What is the solution for this issue in self hosted version?
@narrow-cricket-87449 can you guide me about this query?
n
A room can only run on one LiveKit server, meaning if the size of room is larger then what your server could handle it's going to cause issues, you can't really avoid this
you can however load balance the rooms between the server and that is what would happen in the case that you writing
so webrtc (LiveKit) load balacing is very different from traditional load balancing that you might have experience with (e.g. HTTP servers)
so the signalling part in LiveKit is actually very similar: you can just put a cloud load balancer in front of the WS API of LiveKit, no matter which server your users will hit, they will get the same result which is this
they want to join a room which is bounded to a LiveKit server: so they start the WebRTC peer connection phase with that exact server using ICE (diretly connect to that server, or using STUN/TURN), which is very different traffic flow
if you have a server running, but you start to autoscale, you have another server, but the original room(s) will stay on the original server
any new user will join and use the "old" server, no matter if they hit the new one via the load balancer (since that is just signalling traffic, the actual media traffic will be going to the original server)
but the LiveKit control plane is clever enough that if you make a new room that will go to the least busy server, therefor new rooms will be created on the new server, until their load balances out
but that won't save you if users keep joining to "old" rooms located on the original server
so long story short: you should start your autoscaling a bit earlier not to overload the original server
and still: if rooms keep growing they gonna hit the limit of that particilar server, and currently in the open source project there's no way to avoid this behavior
but LiveKit does scale quite well, so you can easily handle 1000s of session on one server
so the other question is: will you have rooms that have more then a few 1000s participants at the same time? what is that usecase is for?
if your rooms are smaller then this number you will be good to go with this regular autoscaling