2

I run a small game server hosting business for a niche game, and I rent dedicated servers to keep costs down, each of which runs many game server instances. Game servers can be created and deleted at any time, and I need to decide which machine the game server is going to be installed on when its created. After a server gets created, it can be transferred to another machine if the admin wishes.

I'm working on improving the backend, and the main concern I have is with allocating game servers to machines. I currently use a naive algorithm:

I assign a weight to each machine, roughly proportional to the amount of CPU/RAM.

In order to very roughly approximate resources used by each game server, I assign each game server a weight depending on the max number of players that can possibly be playing on that server.

Whenever somebody creates a game server, or requests to transfer their existing game server to another machine, I calculate the following for each machine:

(sum of the weights of the game servers on the machine) / (weight of the machine)

and I allocate the game server to the machine with the lowest result.

My main concern here is with calculation of the weights for each game server. There are many different factors that determine resource usage, such as the number of players currently online, mods installed, server settings, etc. As a result, I don't think it's possible to assign an accurate weight based on server properties, even if I made a more complex formula compared to what I'm currently doing with the max number of players.

I think it would be more efficient to allocate servers based on empirical data of resource usage, either with some form of load balancing software or with a custom-built solution. But I'm not sure how to do this, and I also realize that there may be completely different approaches I haven't considered, so any tips would be greatly appreciated!

1 Answers1

0

You could standardize on a node getting a fixed number of different sized games, and cloning that node many times. However, that only works if your usage patterns are relatively constant.

Cluster software with placing based on utilization exist. For un-isolated application programs, for container instances, or for full VMs. You haven't mentioned containers or anything, so I assume those are not in use. You also haven't mentioned operating system platform, so assume Linux.

Take for example Pacemaker clusters like in RHEL HA. Resources in such a cluster can have defined resource utilization. So your big and small servers have different CPU and memory requirements, and are placed appropriately. As a bonus, you can recover from node failure and migrate resources to another node. On the minus slide, HA clusters are tricky to build and need testing to ensure they do the correct thing.

If you had a container to deploy, Kubernetes could mange it in a cluster. Again, quite a bit of complexity to get those features.

You could reconsider the bare-metal node approach, and give every server its own VM. The hypervisor could be run by you, or by some cloud provider. In either case, find the vCPU and vRAM counts optimal for the different sizes. Placement on nodes is either done for you in the cloud, with a product like VMware DRS, or manual.

John Mahowald
  • 30,009
  • 1
  • 17
  • 32
  • Thanks for your advice! However, usage patterns are not constant due to players constantly logging on and off. You're correct that I'm using the bare-metal approach, and Linux. But I'm confused by how the defined resource utilization would work. Since it's hard to know what is a "big" and "small" server, and I can't move servers between machines on the fly since players would be kicked out and they wouldn't know what IP to connect back to, how would I determine what cluster to place a server in upon creation? – CoffeeCrisp Oct 13 '18 at 22:30