2
\$\begingroup\$

Recently I've been searching for VPSes that allow Minecraft servers to be hosted, and surprisingly very few do. Most allow for games - but Minecraft in specific is disallowed by many.

Now it's fairly obvious why this is - it's very CPU intensive, and fairly ram hungry... But why? The answer I've gotten a lot through googling is "It's written in Java", or "Java's memory management is bad", but those aren't really answers - they're cheap cop outs.

What I really want to know, what I want to track down - is what exactly is eating up so much processing power? And given the desire to do so, what could be done to fix those issues.

I'm not looking to start a discussion on the merits of Java, or how well written Minecraft is - I'm curious if there's an actual answer, actual sections of code or ways things are done that are causing such high CPU usage, and ideally what could, theoretically, be done to fix them.

\$\endgroup\$
  • 1
    \$\begingroup\$ A lot of processing power used is loading chunks, etc. If a chunk has about 128 blocks in it, those are 128 that it needs to store in memory and serve. \$\endgroup\$ – Static May 28 '15 at 10:20
  • \$\begingroup\$ This is an open ended discussion. If this was an open source game, there might be answers that are more than just speculation (but still too broad). \$\endgroup\$ – MichaelHouse May 28 '15 at 13:44
  • 1
    \$\begingroup\$ I disagree. Minecraft's source is known, as is the technology behind it - we understand how the world is created, maintained, loaded into memory, etc. and as such answers can be derived from that. \$\endgroup\$ – Jon May 28 '15 at 15:23
2
\$\begingroup\$

I'm not looking to start a discussion on the merits of Java

Neither do I, but Fact is that Java uses all the objects by reference, nothing is used by value, the memory management is Java is good, but with puting everything in the heap, performance is low, and the program uses a lot more memory.

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Just think about it, what the server has to do. In Singleplayer needs to know and simulate the world around the player. The world is made out of voxels, which naturally needs a lot more memory than just working with heights. Doing stuff procedurally also needs more CPU power, because you can't optimize and precalculate some stuff (like culling, pathfinding etc). In Multiplayer the server should simulate the world around a lot of players who can be anywhere. In worst case you need to simulate 32 times as much on a 32 player server than in Singleplayer

|improve this answer|||||
\$\endgroup\$

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