1.17.x Creating a duplicate of a world without lag

Discussion in 'Spigot Plugin Development' started by weedsnorkeler, Jul 17, 2021.

  1. i made a map system that creates a duplicate of a world from a maps folder and sends all players in a minigame to be teleported to the new world, but creating the world lags the entire server for about 2 seconds. im wondering if there is any way to stop or decrease this lag without having to set up multiple servers. i have autoSave and keepSpawnInMemory set to false
     
  2. There is no way I can think of that will fix the 1-2 second lag spike as creating worlds uses a lot of memory, the absolute best way is multiple servers or having one very beefy server machine
     
  3. ok thank u ill try looking into multiple servers
     
  4. bungee cord is your best option to do that
     
    • Like Like x 1
    • Like Like x 1
  5. SWM has its downsides though. From my personal experience, having a lot of worlds loaded on one server instance will cause lags so you will be better off spreading those worlds across different server instances (one world consumed 2.x ms of a tick without anything actually happening in it so you may not wanna have 100 of them loaded concurrently on a single server instance). As well as since they support in-memory worlds it will consume quite a lot of memory. So depending on how many worlds there will be loaded concurrently you may wanna reconsider letting them run on only one server instance. Also if your goal is to create a minigame-ish server you will be better off having one server instance per match/lobby etc anyways.
     
    #7 Sxlver_, Jul 18, 2021
    Last edited: Jul 18, 2021
  6. Then don't load 100s of worlds at once.... That seems like never a good idea. You can load/unload as needed.

    Yes it does use more RAM, but it saves a lot of processing with CPU of loading and unloading and disables a lot of features that aren't needed for mini games. Though the RAM usage, if you are using SWM for its intended use is not much.

    For Mini Games, SWM is a lot more effective. This is why Hypixel uses the slime format. Hypixel Slime Format Post

    Here are also listed advantages on the plugin page:
    upload_2021-7-18_15-44-5.png


    Overall, if you are using SlimeWorldManager in the correct and intended use, you will be saving space, processing, and lag.

    From my personal experience, using it on a Skyblock server, it had no problem handling a large amount of worlds.
     
  7. I know hypixel uses SWM. Although they have several machines running several server instances with like 10 worlds on each instance if I remember correctly so they still split worlds across different server instances (which is only logical). however, if you have the option to spread load across different server instances, why not do so? If you are having a ton of worlds (Let's take skyblock as an example where you might have one world for each island) it is still very advisable to split them across multiple instances as it would drastically decrease load and keep TPS way more stable. IMO this is not a good use case for SWM as multiple server instances would be simpler to work with and way more performant.
     
  8. this is my first attempt at a custom minigame so i dont expect more than a few worlds at once at least for right now. ill keep this in mind though having multiple servers is definitely something i wanna do at some point
     
    • Like Like x 1