MCMT

MCMT

95.3k Downloads

Reduce max threads used by JMT-MCMT

PaintNinja opened this issue ยท 5 comments

commented

When doing a stress test to see how the mod would behave when the maximum amount of threads are being used, I noticed an issue with framerate. I believe this is due to too many threads being spawned, causing the render thread to have trouble running often enough and therefore tanking framerates.

A possible solution could be to set the max amount of threads to be something like this (psuedocode):

if (integratedServer) {
    Math.max(availableThreads - 2, 2);
    // use a minimum of 2 threads but a maximum of (CPU threads - 2) so that the
    // render thread, OS, JVM's JIT and GC have room to breathe.
} else {
    Math.max(availableThreads - 1, 2);
    // servers don't have a render thread and not many cores, they also usually have
    // a headless OS, so only deduct 1 from the available CPU threads to make better
    // use of the HW while still giving GC, OS, JIT and plugins room to breathe.
}

Entity MT enabled:
MCMT entities enabled

Entity MT disabled:
MCMT entities disabled

By the way, thank you for your efforts on this mod - it's impressive how this mod manages to achieve so much more server-side performance compared to Vanilla with a decent amount of cores!

commented

If i remeber correctly this has been discussed in this mod curse forge page.

commented

I'll look into it

I've currently been deep diving into trying to make patching away fast util less of a pain

And I think I've finally done it, which is good

Capping the threadcount is super easy so I'll try doing that next week

And thanks for the positive feedback

commented

This is fixed as of 0.18.60

There is a config option that bounds the maximum thread count

While writing this I just noticed I didn't change the name of the config option correctly so I'll fix that in a subrelease

commented

Thanks! Could you also add a dynamic max thread count for modpacks? With the latest release, the thread count has to be manually changed on each PC depending on the CPU, the option to say "availableThreads - configurableAmount" would allow for the same config to be used on different PCs.

I saw that you're having trouble testing MCMT due to problems with your hardware. I have a spare laptop I haven't touched in years that I'm willing to donate to you if it helps? Or I have some spare modern desktop parts I can donate? :)

commented

This functionality is implemented with paraMaxMode; so I'm closing this issue

Unless I've goof'd in which case someone re-open this or open a new one