1.8.8 On demand servers

Discussion in 'Spigot Plugin Development' started by Isto, Mar 8, 2020.

  1. Hi,

    I want to create an on-demand server system (as part of a mini-game server) before creating the mini-games themselves (it would be useless).

    Only, I've seen very few people asking for help or sharing leads to exploit.

    In the idea I see that it should be either:
    - Create multiple servers yourself and start them when you need to.
    - Create and start servers via the program when needed (which would require more CPU/RAM).

    Now in practice, I'm almost a novice in file handling. I'm not here to pick up a piece of code but to be oriented on how I should do this or that thing.

    Thanks in advance,
    All help is good to take
    • Funny Funny x 1
  2. That's beyond Bukkit/Spigot capabilities.

    As I understood, you want to start and stop servers for minigames? I think that's not a good practice, but ok...

    You have to make a standalone Java (or any language) application, wich monitors the current running servers, starts up servers if needed,m stop them, etc.
    You also have to communicate with the servers in order to know when to start / stop etc. This could be done with writing a plugin, and then communicating trough any protocol, or using Minecraft RCON to send commands to the specified server.

    (There might be a complete or a better solution for that, but I haven't searched for it)
  3. The existing server implementations aren't really that geared towards on-demand startup and shutdown I'd say, given the amount of time necessary to read the world, load plugins, establish db connections, etc. .

    You could do this by simply copying a "template" folder, changing the listen port and just starting it up, but I don't think this is a great solution. Mostly because this would require a pretty beefy server and at that point you might as well just keep the minecraft server instances running and just reset the worlds. Starting and stopping the server programs won't actually help you save resources; the server suddenly doesn't change cost because you use less of its cpu.

    There are alternatives, but most of them are geared towards entities serving many more users and applications and have the complexity to match. One of them would be to boot up a cloud instance on demand. That would mean a complete vm, including it's guest os and everything that belongs to that, and only then the minecraft server program. You can image that this will take a bit to start. This is for most web pages or similar, because they can prematurely start these so the once they have finished booting before an actual demand was there. The other alternative would be to use containers (or similar) to create a more lightweight version (since you don't really care about isolation I assume), as this doesn't require a guest os to boot. Containers alone obviously won't help much, since you'd be stuck on one host, so you need something to distribute the containers to multiple servers. Those things obviously aren't usually geared for this kind of small operation (in comparison to what the "big" companies do) and thus are hugely complex to setup and manage. You can look at kubernetes, docker swarm or any of the alternatives to these two. They are cool and fancy but I doubt it'll be much of a happy path for you if you chose to go this route.

    Sooooo yeah ... probably not worth. I'd just start as many separate servers as you can handle and keep it at that.
    • Agree Agree x 1