The number of players alone does not tell you the correct amount of RAM. World, modpack and addons change memory consumption. Make the decision based on the measured load.
Step by step
-
First determine how much memory is needed by the operating system and other services on the same machine. The total limit on the server panel and the Java heap limit may be different.
-
In the startup file,
-Xmxis the upper limit. For example, you can use-Xmx3Gfor testing, but don't sync it to the entire machine. -
Monitor heap, process memory and garbage collection behavior during peak hour. If there are long ticks depending on the CPU, do not increase RAM just because there is lag.
-
Change the memory limit gradually and measure in the same scenario. Rebalance the configuration if the OS is going into swap or the process is being killed at the limit.
Keep in mind
The value recommended by the modpack is a starting point, not a guarantee of capacity.