Minecraft – How to run a Minecraft Server on multiple CPU cores

hostingminecraft-bukkitminecraft-java-editionminecraft-java-edition-server

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?

Best Answer

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.