I am working on setting up a Minecraft server on a machine I have at home. This particular machine has two quad-core CPUs running at 2.0Ghz so I would like to take advantage of the number of cores and run a server with 4 or 6 of the cores. My server of choice is CraftBukkit, the latest version of which is craftbukkit-1.4.7-R1.0 and launched with a start-up script of:

"C:\Program Files\Java\jre7\bin\java.exe" -Xms1G -Xmx8G -jar craftbukkit-1.4.7-R1.0.jar"

The Minecraft Wiki says:

Minecraft servers, as of 1.1.0, can use multiple cores, so now they will not sit idle.

but does not really expand on this.

My questions, then:

  • Is it possible to set the number of cores the server uses?
  • How do I do it - via start-up options, or other methods?
  • Is it really worth it and would it make that much of a difference with a lot of players?
  • 1
    I believe as of 1.1.0 it spawn threads for various things, which will naturally be spread across multiple cores. I don't believe there's any way to ask it to use more cores, as it's not otherwise written for parallel execution. – SevenSidedDie Feb 12 '13 at 23:08

If you use the JDK instead of the JRE then you can use the following command line to force the JDK to use all available cores for optimising Java itself (source):

-server -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=7 -XX:+AggressiveOpts -Xms1G -Xmx8G -jar craftbukkit-1.4.7-R1.0.jar

As you are clearly using Windows, have you considered YAMS? (Full disclosure: I made it). YAMS will do all this for you.

  • This is the first time I've heard of using YAMS - is it a control panel like McMyAdmin and Multicraft, or something that would run alongside it, or something else? – tombull89 Feb 15 '13 at 9:00
  • @tombull89 It's probably closest to McMyAdmin (never used it), but YAMS runs as a service and does web and telnet interfaces. It's all on the website, don't want to appear spammy! – Richard Benson Feb 15 '13 at 12:39
  • Sounds good, I'll certainly look at that (running Minecraft as a service was one of the things I would be after at some point). – tombull89 Feb 15 '13 at 12:41
  • A simple "minecraft server as a service" implementation written in C#? I like it. – Michael Richardson Mar 10 '15 at 2:37
  • "craftbukkit-1.4.7-R1.0.jar" this should just be the jar file, correct – Topcode Dec 28 '20 at 3:12

Thanks for trying man, but a process in java needs specific triggers for a thread to split - it has to be coded that way.

You can get some practical examples here : https://beginnersbook.com/2013/03/multithreading-in-java/

While Minecraft has a decently robust developed multicore support on the client side, it lacks it on the serverside. Anything above 3 cores won't be used, unless new itterations introduces a command blockchain with automatical threadsplitting - making the dedicated server code more scalable than it's been since release.

  • 1
    What is your experience of the performance difference from setting affinity? Affinity just allows you to dedicate processing power, which should give a small boost, but no matter how many cores are given affinity with a program, it can still only use as many cores as it has threads. This method won't make a program use any extra cores it has been given affinity with unless it's already multithreaded. – SevenSidedDie Feb 13 '13 at 18:01
  • 3
    What you wrote about CPU and RAM seems to be misleading. CPU processes data (e.g. block updates, redstone, mob AI) and RAM stores data (e.g. loaded chunks, entity location and speed). Basically they do completely different things. – Alvin Wong Feb 14 '13 at 12:33
  • Thank you for catching my mistakes. I might not have said this, but my experience is sadly very limited. I apologize for misleading anyone, though. – Evan Feb 18 '13 at 19:19
  • 1
    Processor Affinity defaults to All Cores. In my opinion, it's best to leave it as the default & let the kernel decide which cores to run threads on. You're right about memory though - I'd argue memory is much more important than CPU in this case because Java is a pig. :D – nevelis Jan 26 '14 at 8:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.