Containers are stateless. Online games must have states. When the states of multiple users are in multiple containers, adding or subtracting containers will cause game interruption. How can this situation ensure the continuous connection of websocket?
Is there a solution if you use the container orchestration tool kubernetes and others? Or from a business logic point of view?
- The link is maintained through front-end load balancing, and the back-end processing logic can solve the problem.
- Before the container is killed, broadcast is initiated to the application inside the container, the load balance at the front end does not forward the new request to the internal container, then the internal application initiates a request to relink to the client, the client creates a second socket request after receiving the request, and disconnects the old socket after the initiation is successful
I haven’t done any related content, only for reference.