Today I just wanted to discuss a few changes to our server to increase performance, as many of you are aware Minecraft is written in Java but what you may not know is that the Minecraft server software is also written in Java.
The idea behind Java is “write once, run everywhere” this means you write the software once and gain the ability to execute your software on different operating systems. For example Windows, Linux and Mac OS X. That is the strength of Java.
To get that capability it uses virtualization. Java does this by means of a JVM or ‘Java Virtual Machine’ it sits between your operating system and the Java application you want to run and facilitates the software to work regardless of the operating system it’s being run on.
But it has some drawbacks. Although Sun (and now Oracle) try very hard to optimize the JVM to work on all operating systems and hardware they are also trying to make Java work on the lowest common denominator. Afterall they need software developers to reach the largest audience and this can result in situations where people with very fast or very new hardware (like us on our server) have resources that aren’t being best utilised by the JVM or the software it is running.
So this brings me back to the title of this post. A new JVM. So what’s different? – First of all we are using the more resource intensive Server version of the JVM this has better hardware utilization as it cares less about other programs running on the server. To put it another way the Server version is more greedy but this is a good thing because it’s this greed that will increase our Java software performance.
I’ve also switched us to a Multi-Threaded garbage collector. Just to explain that quickly: In the background Garbage Collection continually releases unused resources back to the system after they have ceased to be used by the program that originally requested them, this is important if performance is to stay linear the longer that the software runs and previously running Garbage Collection in a single thread with Minecraft can cause slow-downs.
And finally I’ve altered our memory heap size so that the game has a larger portion of memory to grow in to as it needs it slowing down the amount of I/O load on the disk (although our disk is also virtualized in Memory this still has an effect on performance) – Our Low and Optimum Heap utilization sizes have also been tweaked so that our Minecraft server is less concerned with low memory usage and more concerned with maintaining an acceptable lag-free experience for players connected to the server.
I hope this post was insightful and goes a way to explain what I’m doing to improve our servers performance. Understanding the issues of running a server from every angle is important and it requires knowledge, skill and dedication.
Thanks for reading and have a great new year!Read More