thing thong
This commit is contained in:
parent
b3d92709bf
commit
98cc80102d
6 changed files with 33 additions and 7 deletions
34
public/posts/Putting hungry minecraft servers to sleep.md
Normal file
34
public/posts/Putting hungry minecraft servers to sleep.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
2
|
||||
Minecraft Rust Async Networking Proxy CRIU
|
||||
# Minecraft servers are HUNGRY
|
||||
They hunger for your ram and your cpu. This makes it either expensive or laggy to try and host multiple servers at once.
|
||||
This was something I encountered when my friend built a homeserver out of spare computer parts that was barely powerful enough to run a minecraft server.
|
||||
The problem was that soon multiple people wanted a minecraft server hosted by him, including ourselves with modded experiences.
|
||||
|
||||
It was a hassle to ssh into the server and start and stop the various servers depending on who wanted to play,
|
||||
especially since a lot of people only played very rarily.
|
||||
|
||||
I remembered that I'd seen [a project](https://github.com/gekware/minecraft-server-hibernation) that claimed to be able to hibernate a minecraft server if nobody was playing on it.
|
||||
This worked by starting and stopping the server, leading to noticeable join delays when joining modded servers.
|
||||
|
||||
Another nice-to-have was being able to join through a subdomain. After having messed around with nginx to help my friend set up various services like nextcloud
|
||||
on subdomains we wanted to do the same for the minecraft servers.
|
||||
|
||||
Being able to join the vanilla server through `vanilla.domain.com` and the modded through `modded.domain.com` would simply be really cool.
|
||||
|
||||
# Minecraft Server Hibernation Proxy Manager Rs (Name WIP)
|
||||
|
||||
I ended up writing [a Rust program](https://gitlab.com/SpoodyTheOne/minecraft-server-hibernation-proxy-rust) that could do this and more. It listens on the default minecraft server port of `25565` and parses any incoming data as minecraft packets.
|
||||
If the data contains a url that matches `*.domain.com` then it uses the subdomain to look up a configured server, and if found redirects all future traffic to that port.
|
||||
|
||||

|
||||
|
||||
If the server is stopped or hibernating then the command to start it is automatically run. Likewise if all players leave a configurable countdown is started.
|
||||
Once it reaches 0 the server is hibenated using CRIU, which writes the entire memory and all open file descriptors of the server program to disk.
|
||||
|
||||

|
||||
|
||||
This means that joining a hibernated server only takes a few seconds, and any server currently hibernating will only take up disk space.
|
||||
It can also be restored even after system restarts, so it would be possible to halt systemd shutdowns until all servers are hibernated.
|
||||
|
||||
<marquee style="font-size: 20em">Marq**WEE**</marquee>
|
Loading…
Add table
Add a link
Reference in a new issue