World generator not using all available cpu resources

Discussion in 'Spigot Plugin Development' started by jl97, Jun 8, 2017.

  1. Hi,

    I'm currently working on a custom world generator using the bukkit api. This generator in particular is very cpu heavy and unoptimized at the moment. While generating new chunks my world generator uses all resources available to the jvm, causing the entire server to be occupied with just generating new chunks, causing the game to be unplayable. While you'd think this would cause the jvm to use all available cpu power of my workstation, it doesn't appear to do so.

    Bukkits world generator api appears to be using all available threads of my cpu, but it barely reaches 60% at its peaks in windows taskmanager.

    Could anyone explain to me why, while the jvm is completely occupied with just generating new chunks, my cpu seems to be having plenty of resources left to increase server performance if they were assigned to the jvm.

    The lag caused by chunk generation is not an issue for me as im planning to pre-generate any world im going to use, i'd just like generation to go faster if it could :p.

    Thanks for helping out!
    Knipsel.PNG
     
  2. electronicboy

    IRC Staff

    if you wanna see what the JVM is doing, attach a profiler.
    but, minecraft is mostly single threaded, so pretty much all work such as chunk generation is done on the main thread. beyond that, other cores will be doing stuff such as netty and async plugin tasks, as well as jvm tasks such as handling GC (which, during chunk generation is going to be having to clean up all of the chunk and block objects and other stuff that is being created and thrown into the heap).
     
    • Agree Agree x 1
    • Informative Informative x 1
  3. Thanks for your reply, ill take a look at profilers, it might be time to start optimizing my code if its thats only way to speed up the process.