I have the next case: Let’s say I have ~5k users that want to join a voice chat and with first join, we must spin up the media stack and with last one left close everything down.
Users came and leave in huge bursts, let’s say they come all within one second and leave the same way.
To detect the start/end of a call I have two keys: one for the total number (
counter) of users and one is a flag if the voice has been
Starting a call is very easy - just check if
started is false and then schedule work to the media server. If 100 users jump on call it would ‘only’ cost 199 transaction iterations. But when leaving we have to have read conflict with total counter meaning that we need to wait for each other to leave chat and execute every transaction sequently until the counter reaches zero. In my simple tests, it takes ~578 retries for 100 users to leave the chat.
I am wrapping my head for a long time with this issue. Is there any simple solution to avoid this conflicts?