Will bukkit support multible cpu's?

Discussion in 'Bukkit Help' started by EvilDevil59NL, Jul 29, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    EvilDevil59NL

    Hello everyone,

    Simple question, how well does bukkit support multi cpu's? Im asking this cause i've got my hands on a hp proliant dl360 server, with 4 quad cores = 16 cores.
    Thanks!
     
  2. Offline

    Bobcat00

    It doesn't. Everything basically will run in one core.
     
  3. Offline

    tanveergt5

    multi threading? no idea probally not?
     
  4. Offline

    obscurehero

    EvilDevil59NL

    There's a lot on the internet about this. Basically, no. I believe you can run one per thread and utilize your power that way, but you cannot bring the full power of that CPU to bear on one server instance.

    Here's this for reference (https://mojang.atlassian.net/browse/MCAPI-104). You can just google 'multithread and minecraft' or 'multicore minecraft'...etc
     
  5. Offline

    garbagemule

    Simple question, perhaps...

    To understand why your question may be vague, you have to understand what it means for a computer to have multiple cores, and how software can exploit it or not...

    Historically, a processing unit was capable of only a single thread of execution. Without any kind of scheduler, starting a program would thus cause the entire system to "lock up" while that program was running. This is the case for "batch systems" which are basically given a batch (hence the name) of programs/inputs to process, and these kinds of systems serve no other purpose and thus the "locking up" doesn't really matter. If your computer worked the same way, you wouldn't be able to open up your Windows Calculator without your UI freezing until it was done loading. A scheduler, often implemented at the kernel level of operating systems, allows multiple threads of execution to happen on a single core by interleaving the threads (or "weaving" them together), such that one thread, e.g. the UI thread, is given a time slice of 20 milliseconds to re-draw the entire screen and the current position of your mouse cursor, and then another thread, e.g. the Calculator, is given 20 milliseconds to execute its startup code. If a thread of execution doesn't finish its job within the given time slice, it'll be interrupted and "put on hold" until the next time the scheduler decides to give it a time slice (there are many different scheduling strategies, and different operating systems use different strategies). This basic idea of threading is what allows you to "multitask" with your computer, but note that if the UI-thread and the Calculator-thread both require 60 milliseconds to finish their current jobs, the actual time of execution will be 120 milliseconds (plus the time it takes to (re)store thread states).

    Enter multicore setups...

    The nice thing about a multicore setup is that the UI-thread and the Calculator-thread can be assigned to different cores, and thus, assuming no other processes are executed on the two cores, the actual time of execution will be around the 60 milliseconds both of the threads require. That's twice as fast as before!

    However, a single program may not be able to utilize as many cores as you have in your system. There could be several reasons for this, e.g. the job doesn't warrant a threaded setup (calculate the sum of two integers), or the job is sequential in nature (modal dialogues, game loops, etc.). At any rate, the only way a single program can fully utilize sixteen cores is if it can create sixteen or more threads of execution and distribute them over all of the cores uniformly.

    Back to Minecraft...

    The Minecraft server is single-threaded, and game loops historically are, because they can be quite performance-heavy and require that the workload be spread over several ticks to not introduce stuttering, but also because some of the logic is sequential in nature (collision detection). Some things, like reading a file from disk or querying a database can be extremely slow compared to simply adding two integers, and so those kinds of jobs are oftenasynchronous, meaning once the job is started, its response will happen "at some time in the future", but the show must go on to avoid stuttering/lag. There are definitely some (if not many) things in the Minecraft server that could benefit from a threaded setup, but with multithreading comes a significant hit to testability, and a great increase in complexity. Single-threaded programs are just easier, and unless the given job has a parallel computing nature, additional threads of execution will often offer performance increases of highly diminishing returns.

    Back to Bukkit...

    Bukkit is "vanilla with a twist", and as such there aren't that many dramatic changes to the vanilla Minecraft server in Craftbukkit itself. With that in mind, I think your question should instead be "Will the Minecraft server ever switch from being single-threaded to being multi-threaded?", and the answer is "Ask Mojang". Note, however, that many plugins that deal with file systems, databases or other network communications do in fact handle such jobs asynchronously, so there is some (if only a tiny bit of) benefit to having more than one core in your system.

    I won't tell you that sixteen cores is overkill for a single server (but it is), but it would definitely allow you to run multiple servers on one machine, given you have enough memory and a dedicated disk for each server instance (to prevent the disks from being more of a bottleneck than they already are), and the server instances are set up to run their main threads on different cores.
     
    obscurehero and EvilDevil59NL like this.
  6. Offline

    EvilDevil59NL

    Thanks for your reply! Indeed, i'm aware of the fact that 16 cores is without a doubt pure overkill, and i'll look further into the option of hosting multiple servers. Thanks for the explanation!
     
Thread Status:
Not open for further replies.

Share This Page