Specific load balancer
Good afternoon.
I have a task to write a load balancer for an online game where clients establish websocket connections with servers, and each new game should start on a less-loaded server.
My idea of a balancer: a regular L7/L4 balancer passes traffic through itself, which can be a bottleneck when there is a huge amount of traffic. That's why I decided to make a balancer, which clients will access each time they create a new game session (match), to get the IP address of the less-loaded server. The logic of determining the less-loaded server I want to write myself. Updating information about less-loaded servers should be instantaneous. The DNS balancer will not work here because DNS has a huge number of caches, which will prevent instant definition of a less-loaded server. Also, in the DNS balancer, there may be problems with connection of the real-time algorithm of definition of a less-loaded server. In general, my balancer should work in a similar way to DNS, but through its own protocol that is not cached by most computer systems like DNS.
The main profit of my load balancer is give ability for load balancer to handle a much more clients ( and traffic)
This is a text description of how my load balancer should work in steps:
- Servers periodically report their load information to a load balancer.
- The load balancer calculates the least-loaded server based on the reported information.
- When a client needs to create a game match, it requests the load balancer for the IP address of the least loaded server.
- The load balancer responds with the IP address of the least-loaded server.
- The client then connects directly to the provided IP address.
Please advise. Are there any ready-made solutions or a common name for the type of load balancer I described. Do you see any obvious disadvantages in this approach compared to L4/L7 load balancer?
4 Replies
Doubt this exists yet, but shouldn't be particularly difficult to make
@Vaal two things:
- I don't get why you want the servers to inform the Proxy about their load in periodic intervals. The proxy should ask the servers instead only when a new game is started. There is no benefit in knowing all the time the server with least load information, only when you need to start a game on one of your servers and choose on which server is when you need this information, so ask then and only then.
- Can your Proxy not just redirect the client directly instead of returning him an ip and letting him connect to that?
Thank you for your responses!
@Florian Voß
The idea of reactive polling is interesting, it seems to me that it can create a slight lag in the request, but if you create a fast-living cache, then this problem should be solved.
I don't know if it's possible to redirect a websocket connection, but I'll definitely look for information about it. Thank you!
that depends on how often games start and how often the server load changes