Continuing the series of articles against something against something, we finally look at something useful, namely the Minecraft server. Consider which operating system and which Java is still better in order to host the best game of mankind. For comparison, Ubuntu 18.04 LTS and Server Core 2019 were taken. OpenJDK was installed on Ubuntu, and Oracle Java and AdoptOpenJDK were installed on Windows.
As in all other comparative tests, virtual machines did not have neighbors; only one VM was always running on the host.
Servers started with arguments:
The Windows Defender component was removed on Windows Server Core, as in our image with Windows VDS for 99 rubles. In comparison, this is what you lose when you leave it turned on.
Round number 1, the generation of the world
In this test, we generate the world. The generator was Geographicraft with Biomes’O’Plenty, Dynamic Trees, PVG, worley caves, IC and BC installed.
The world is by no means a classic and is generated noticeably slower than usual.
A world of 2,704 chunks was generated:
Windows with AdoptOpenJDK breaks away from its competitors for 5 seconds.
Round number 2, server start
The measurement took place in three passes for each virtual machine. Each time, each of the servers completed the download of the world second per second compared to the previous result.
OpenJDK on Windows and OpenJDK on Linux show the same results.
Round number 3, occupied memory
The process begins to consume the more memory, the more cores are installed on it. Below is a table of the occupied memory of an empty server process without the world loaded on it.
Oracle JRE consumed an average of 80-100 megabytes more on an even number of cores. The same goes for AdoptOpenJDK, only on an odd number of cores.
Linux did not show such weirdness.
Round No. 4, 32 chicken in a 2 by 2 box
The scene is a calculation of the collision of 32 hens in a 2 by 2 box. The scene was prepared in advance and the same world was scattered around the servers so that everything was honest.
One core was installed for this test, and the process was set to real-time priority.
The OpenJDK working set in this scene was 40 megabytes more than its rivals.
The average processor consumption for Oracle and AdoptOpenJDK is the same, but Oracle garbage collects more often and more intensively, which often leads to bursts of processor activity.
To extrapolate how many such scenes we can process, let’s just increase the server tick rate.
In the high-load test, Ubuntu c OpenJDK caught up with Windows c AdoptOpenJDk, and Oracle is catching up.
Under a higher load, OpenJDK on Windows gave better results than on Ubuntu.
The OpenJDK server on Ubuntu stood idle and the scene froze. Windows was a little worse on the same OpenJDK. Oracle, however, handled the best with the least number of freezes.
Among others, Oracle SE kept within the same amount of RAM as OpenJDK.
Round No. 5, 64 * 64 chunk and Dynamic trees
This scene contains a forest and several dozen mobs. Kilometers of trees are constantly growing and updating the position of their blocks.
Each tree is a separate tile, but initially have a low tick rate, ticking only 1 time in 20 game ticks. Below is a graph of processor utilization per server tickrate.
Ubuntu + OpenJDK and Windows Server with Oracle on board could not start the server in the previously discussed arguments, so they did not get into the schedule.
To start the server, I had to change the flags to:
-Xms4g -Xmx8G -server -XX:+UseCompressedOops -XX:+AggressiveOpts
All three instances initially rested on 100% of the processor, but only Windows Server + AdoptOpenJDK did not drop the server. After garbage collection, everything returned to the schedule below.
When switching from a tick rate of 60 to 70, on Ubuntu, the CPU load schedule began to behave like a sine wave, which is why the average CPU utilization suddenly started to fall due to the increasing complexity of the task. Because of this, the schedule had to be stopped where it is now.
This is probably the difference between the Linux’a scheduler and Windows.
Despite the objective difference in the OS and JRE distributions, it is impossible to give a specific recommendation, which is objectively better in order to keep the server on it.
In this case, it is probably worth choosing the operating system with which you are more familiar.