itzg / mc-router

Routes Minecraft client connections to backend servers based upon the requested server address

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sleeping Start enhancement

sfxworks opened this issue · comments

Similar to https://github.com/vincss/mcsleepingserverstarter

Since this router is also aware of service definitions, and service definitions contain references to deployment or statefulset object via label, it would be cool if the router could pick up and hold incoming connections and automatically scale the stateful set up from 0 to 1 and 1 to 0 when it knows that there have been no active connections for some time.

Or maybe a better pattern would be to wrap that project around https://github.com/itzg/docker-minecraft-server and replace the minecraftCommand with your wrapper script? With the caviat of then requiring spigot to stop the server when no one is online. Though that would still make k8s scheduling a nightmare since one would have to keep that max memory into account.

Yeah, I really like the idea of mc-router influencing the replica count of a server's statefulset. My only concern would be the amount of time in between and attempted connection and when the destination server would be up and ready to serve connections.

To combat startup time sleeping start server just says "come back later" to the client until it's up. Also on a ceph NVMe cluster I've seen startup times as fast as 5 seconds for vanilla

I'm exploring this in master...vorburger:issue-11_autoscale-2 and much to my own huge surprise 😈 actually do seem to be making reasonable progress towards teaching mc-router this trick, to be able to "auto-scale" the replica count of a server's statefulset...

I now have a a working MVP on the branch linked above, and will that contribute it as a PR, once I've further cleaned up the code. But as was suspected above, the "user experience" is not really all that great (yet, with my initial PR) - because you at first get disconnected, and then have to manually re-connect a moment later, once the server has actually spun up and is ready to accept connections... it works, and sure beats manually having to k scale statefulset test --replicas=1 - but it would of course be much nicer if the connection was kept "hanging", until the server is ready. But rome wasn't built in one day, so let's chip away at this step by step. Perhaps someone else wants to later implement such an improvment, on top of my (upcoming) basic PR for this.