I'm wondering if I was to run minecraft in a 32bit or 64bit ubuntu server; would there be a benefit (speed improvements) or something else, or just the same? Downsides?
116 Answers
Minecraft is written in Java, so it should "adapt" itself to both 32-bit and 64-bit systems (depending if you have a 32-bit or 64-bit Java runtime).
While Minecraft itself is not optimized for 64-bit, it will take advantage of JVM optimizations for 64-bit processors. Basically, this means more general-purpose registers available (16 in 64-bit against 8 in 32-bit, which means better machine code and less RAM access, improving performance) and larger addressable memory. On the other hand, since now pointers take up twice as much space, there is a little extra overhead for using 64-bit.
But you should also think about the operating system, as it will also take advantage of 64-bit improvements. If you have more than 2GB or 3GB of RAM, your operating system should be 64-bit, else it won't access all RAM (or will have a considerable overhead doing so). And if you have a 64-bit operating system, you should also go with a 64-bit Java Runtime for better performance (as other users already commented).
By the way, in my opinion, you should always go to 64-bit unless you have a very good reason to avoid it, like compatibility reasons (which is not this case).
Related question on StackOverflow: Does Java 64bit perform better than the 32bit version?
Wait a minute! I talked code written in Java, but how about native libraries? Like OpenGL support and OpenAL? They are available on both 32-bit and 64-bit versions, and the correct version will be loaded. And I can confirm that on my Linux 64-bit system, it loads the 64-bit version of those native Java libraries. (as an experiment, I've deleted the 32-bit versions and Minecraft still runs fine)
6Minecraft is not designed as a 64-bit application, and thus, while usable on a 64-bit OS, won't see any sorts of improvements from a technical standpoint.
However, if you also install the 64-bit java runtime environment, you may notice some slight performance optimization, but a 64-bit OS on its own will not have much of an effect.
5I'm running my server on a 64 CentOs server and it doesn't seem to have improved anything. Minecraft only records the movements X,Y,Z of the players with items and block placed in the world. So running it on a 32 or 64 bit OS won't change anything.
For better performance of the game you need lots of RAM and fast HDD maybe a 10k RPM or 15 RPM on the server. That way you ensure faster loading and higher efficiency.
I have 8GB RAM on a Quad core system with 2 HDD 10k RPM, and I haven't noticed any lag with 20+ players online.
CPU-bound Java apps will almost always run slower on 64-bit JVM, and Minecraft is no exception. To quote Oracle,
the benefits of being able to address larger amounts of memory come with a small performance loss in 64-bit VMs versus running the same application on a 32-bit VM. This is due to the fact that every native pointer in the system takes up 8 bytes instead of 4.
The fact that 64-bit JVM features more registers alleviates that performance loss, but does not out-weight it. According to Oracle, Java applications on x86 lose 0 to 15% of their original performance when migrated to 64 bit.
Another point to consider is that 64 bit JVM is more memory-hungry: because of those 64-bit pointers, so you'll have to give it 30% more RAM just to match the storage space you had on 32 bits. Another quote from Oracle FAQ:
We have adjusted the defaults for 64-bit implementations to be 30% larger in order to make up for the increased size of Java objects due to larger native pointers. Remember that Java objects contain class and lock pointers so even if you create Java objects which contain only integers, each object takes up additional memory.
Of course, things turn over when you're giving Minecraft lots of RAM, since it will be able to run GC less frequently and keep more chunks in the memory.
To sum up, upgrading is only worth it when you're planning to give it 4 GB or more.
2Using a 32-bit Java Runtime Environment, you may run into errors giving it 2 GB of memory or more:
"%programfiles(x86)%\Java\jre1.8.0_201\bin\java.exe" -Xms2G -Xmx2G -jar server.jarError occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
And for 4 GB and up:
java -d32 -Xms4G -Xmx4G -jar server.jarInvalid initial heap size: -Xms4G
The specified size exceeds the maximum representable size.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
It works with a 64-bit Java:
%programfiles%\Java\jre1.8.0_201\bin\java.exe -Xms4G -Xmx4G -jar server.jar[main/INFO]: Loaded 0 recipes
[main/INFO]: Loaded 0 advancements
[Server thread/INFO]: Starting minecraft server version 1.13.2
...
Minecraft also seems to come with its own 64-bit JRE which you may use:
"%programfiles(x86)%\Minecraft\runtime\jre-x64\bin\java.exe" -Xms4G -Xmx4G -jar server.jarNote that the flags -d32 and -d64 don't let you choose an installed 32- or 64-bit JRE (at least on Windows), but rather define the bitness you require. If java is a 64-bit Java, then -d32 will make it fail because the 64-bit executable does not support 32-bit.
For me, I have got a weird solutions I have a 64-bit Processor and OS, but the game was unplayable, I then decided to try out the x86 version (32-bit). I know this normally doesn't improve anything, but when I did I have a decent framerate of 60fps WHEN RECORDING! The performance dramatically improved with 32-bit for me. However, if your machine is 64-bit, I would recommend using the 64-bit version first, then use the 32-bit. After that you can decide which to use.
My system info ATI Radeon X1200 Graphics AMD Turion 64X2 Dolby Sound Room Atheros Wireless Windows 7 Professional x64 SP1/Ubuntu 13.10 x64
1