1

Making your server lag less (by tuning Java settings)

Darklord__GabeN's Avatar Darklord__GabeN5/28/16 6:17 pm
1 emeralds 684 4
6/17/2016 7:52 am
Darklord__GabeN's Avatar Darklord__GabeN
Hello, i wanted to continue a thread started on the minecraft forum in 2010 by sk89q in which he dicusses about tuning java startup flags to:
A: make the server somewhat multithreaded
B: make it use less RAM / CPU cycles
In quick recap to drop the load off of a single core on your server you have to run the server off of the JDK and not the JRE, and also have a very specific set of start up flags in you batch/bash file.
With these settings:
Click to reveal
@ECHO OFF
SET BINDIR=%~dp0
CD /D "%BINDIR%"
::-XX:ParallelGCThreads should equal to 1 less tham the amount of virtual cores you machine has.
java -d64^
-server^
-XX:+UseConcMarkSweepGC^
-XX:+UseParNewGC^
-XX:+CMSIncrementalPacing^
-XX:ParallelGCThreads=3^
-XX:+AggressiveOpts^
-XX:SurvivorRatio=16^
-Djava.net.preferIPv4Stack=true^
-Xnoclassgc^
-XX:UseSSE=3^
-Xms6G^
-Xmx6G^
-jar craftbukkit.jar^
nogui
PAUSE

I managed to make my server use significantly less RAM and its is very visible that now the load is now somewhat spreaded across my 2 cores and 4 threads.
At idle my server used to take ~ 1 GB of ram (note that garbage cleaner ran regularly and dropped the memory usage, but 1 gb is a good avrage) and now on idle it takes about 100 MB of ram.
Tested with 5 players online doing regualr tasks like digging talking and walking around the map my memory usage went up to about 400 MB.
Note that my CPU usage went irregularly high but i don't mind that since what i'm mostly trying to optimize is RAM and bandwidth usage.
The results may be verry different for you, so please don't use my results as a baseline.
If you have any questions please ask and also feel free to share your own tests with startup configs and results, this is what i created this thread for!
EDIT:
As of the 4th of june, 2016 i am still using the startup options above, and they are still working great, iv'e had no issues with them, and RAM usage is very low!
Posted by Darklord__GabeN's Avatar
Darklord__GabeN
Level 1 : New Taco
1

Create an account or sign in to comment.

4

1
06/17/2016 7:52 am
Level 1 : New Taco
Darklord__GabeN
Darklord__GabeN's Avatar
bump
1
06/13/2016 1:08 pm
Level 26 : Expert Princess
star_weaver
star_weaver's Avatar
do the "^" do anything or what?
1
06/13/2016 5:58 pm
Level 1 : New Taco
Darklord__GabeN
Darklord__GabeN's Avatar
Nope, they just tell batch that there's more arguments to the command in the next line.
It's for ease of reading mostly.
1
06/09/2016 5:22 am
Level 1 : New Taco
Darklord__GabeN
Darklord__GabeN's Avatar
bump.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome