Arqade is a question and answer site for passionate videogamers on all platforms. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?
share|improve this question
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
up vote 10 down vote accepted

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

share|improve this answer
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

Is it possible to set the number of cores the server uses?

  • Yes, it is possible, but not through a method you might be considering.

Everything runs through a process on the Task Manager, so you are able to see how much CPU power (in %) the process is taking, which cores it is applicable to use, and how much RAM (memory) the particular process (program) is using.

I have not touched Bukkit much, so I cannot tell you exactly what you'll need to do, but if you were to do this via Vanilla (the original MC server application) methods, you can find the process it is under (e.g. Minecraft itself uses the process 'javaw.exe') and right-click the specific task and choose "Set Affinity..." This will allow you to choose which cores you would like to run the server. I'm not sure if it works with multiple processors (as what I'm seeing your situation is). I feel that will need to be a "see for yourself" kind of thing.

How do I do it - via start-up options, or other methods?

  • The method I am describing to you is:

    1. Go to Task Manager (any means: Ctrl+Alt+Del, Start > Run > taskmgr.exe, etc...)

    2. Find the process your server application is running, (there are various ways to do this as well, I'm not familiar with an "easy way" aside from right-clicking the program inside of Task Manager's 'Applications' tab and clicking on "Go To Process")

    3. Once you have located the process, right-click it and you will see near the bottom of the window, "Set Affinity..."

    4. Change the cores and which processors you would like your server program to use.

Is it really worth it and would it make that much of a difference with a lot of players?

  • From my understanding, Minecraft uses the CPU to load the world, and utilizes RAM for anything player-based (mixing CPU and RAM for world interactions), so I would say that your best bet is to have powerful processors and a lot of RAM. RAM will get you farther for more players than CPU will, but a better CPU will support more world interactions from the players, and keep your world from generating "clunky chunks" (half of a mountain abruptly into plains, etc) as you have more people explore the world at once and interact with it.

If anyone finds something wrong about my post, feel free to correct me. I'm only going from my assumptions and experience from running my own server for approx. half of a year.

share|improve this answer
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
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
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

protected by Community Mar 24 '14 at 19:49

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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