How To Reduce Memory Usage For Your Minecraft Server

Is your Minecraft server using too much RAM? Are you running out of memory with an "OutOfMemoryError" exception? Perhaps you're seeing large garbage collection lag spikes due to your server running dangerously low on memory. This guide will explain how you can reduce your server's memory usage to avoid these problems.

The most common cause for memory issues in Minecraft servers is too many chunks being loaded at one time. The easiest way to change this is by changing the view-distance property in your server.properties file. This setting will reduce the number of  chunks that are loaded by your server, which will in turn reduce the amount of RAM your server is using.

Paper's no-tick-view-distance setting (located in paper.yml file) also will cause chunks to load in the same manner. If you are using this setting for your server, then you will need to reduce this setting instead of the view-distance setting. For servers with large player counts, we recommend a maximum value of 7 chunks for no-tick-view-distance and view-distance settings. This value provides a nice balance between view distance and performance for most servers with higher player counts. Smaller servers can get away with higher values, and we recommend setting these values to around 10 or so.

Reducing the number of loaded chunks, in almost all cases, will result in decreased memory usage. It is also worth noting that some plugins have high memory usage. Dynmap and Pl3xMap can have very large memory footprints, especially when they are rendering large sections of your world. Reducing the rendering speed of these plugins can help to reduce the amount of RAM your server is using.

If you consistently are running into memory problems and have already reduced your server's render distance, it is likely that a plugin on your server has a memory leak. You will need to perform and analyze a heap dump in order to determine which plugin is causing the issue. If you suspect a particular plugin to be causing the problem, then you can also try temporarily removing that plugin to see if the problem goes away.

If you don't have any malfunctioning plugins and your server still is using too much memory, then it may be time to upgrade your server's RAM. On Pufferfish Host, this upgrade can be done directly in the billing panel.