Jump to content

Heavy server optimizing


Mysli0210

Recommended Posts

Hi Tekkit (and other) folks,

I dont know if this have been around these forums, but i have a way that you can take a lot of load off your servers without a single problem. ie. You'll probably go from around 70% to 20% cpu usage (depending on the system)

So here we go

1. You have to get the bukkit plugin called minecraft remote toolkit, found here

http://forums.bukkit.org/threads/admn-remotetoolkit-r10-a13-restarts-crash-detection-auto-saves-remote-console-1-3-2.674/

(its not necessary, but i cannot for the life of me remember the other link)

2. Set it up, as per readme from the plugin.

3. Then go to the toolkit folder in the minecraft root folder and edit wrapper.properties with notepad or whatever.

4. A couple of lines in this document have some interest,

minecraft-server-jar= should say minecraft-server-jar=tekkit.jar

maximum-heap-size= This is your maximum allowed ram usage, mine is

maximum-heap-size=2048M

initial-heap-size= This is your initial allocated ram, mine is

initial-heap-size=1024M

And here comes the interesting line that does all the work :D

server-arguments= This is the line for all extra server arguments, some of these will force your server to use things such as SSE, which i really cant explain what actually does but is an intergrated part of newer cpu's

you should set this value to whatever you set in your maximum ram line SoftRefLRUPolicyMSPerMB\=2048

server-arguments=nogui,Xincgc,server,XX\:NewRatio\=2,XX\:CMSFullGCsBeforeCompaction\=1,XX\:SoftRefLRUPolicyMSPerMB\=2048,XX\:+CMSParallelRemarkEnabled,XX\:+UseParNewGC,XX\:+UseAdaptiveSizePolicy,XX\:+DisableExplicitGC,Xnoclassgc,oss4M,ss4M,XX\:+UseFastAccessorMethods,XX\:CMSInitiatingOccupancyFraction\=60,XX\:+UseConcMarkSweepGC,XX\:UseSSE\=3,XX\:+UseCMSCompactAtFullCollection,XX\:parallelGCThreads\=4,XX\:+AggressiveOpts

I actually saved a minecraft pvp tournament with this once where the admins praised this tune up to high heavens.

I hope you understand this, if not PM me :)

Link to comment
Share on other sites

SSE is 1999 technology, hehe. Your command line adds SSE3 (2004).

Here's the command line you posted for matted for use on an actual script. I'm not sure I want to mess with my public server atm but someone else might want to:

-Xincgc -server -XX:NewRatio=2 -XX:CMSFullGCsBeforeCompaction=1 -XX:SoftRefLRUPolicyMSPerMB=2048 -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:+UseAdaptiveSizePolicy -XX:+DisableExplicitGC -Xnoclassgc -oss4M -ss4M -XX:+UseFastAccessorMethods -XX:CMSInitiatingOccupancyFraction=60 -XX:+UseConcMarkSweepGC -XX:UseSSE=3 -XX:+UseCMSCompactAtFullCollection -XX:ParallelGCThreads=4 -XX:+AggressiveOpts

EDIT: I've read somewhere before that you should set ParallelGCThreads to twice the amount of cores you have, but like you, I'm not a pro at this so I can't explain why.

Link to comment
Share on other sites

I kinda want to try this but I don't really want to add anything in without knowing what it does heh

Well, seeing how my server keeps crashing because of low memory (BOTH of them), I decided to give this a shot. I'm running this script on both a vanilla server and a Tekkit server. I'll report if/when they both burn to the ground. Or at the end of the day if they don't. :)

Link to comment
Share on other sites

@Silent i promise you, you wont regret it ;) and if you're not impressed by the performance increase you can always just uninstall it :)

EDIT: Oh, commie i actually think i know why ParallelGCThreads should be twice the number of cpu cores.

Its cause most newer cpu's have a thing called hyperthreading which doubles the amount of threads available, so if you have a quad core with HT then you'd have 8 threads.

But most of Core2 cpu's does not have this, so i'll keep on running with it at 4 :)

Link to comment
Share on other sites

Vanilla server crashed 3 times due to low memory, Tekkit server crashed twice. Hmm. I was actually excited, heh. It could have something to do with me running two servers on a tiny 4GB of RAM, but my vanilla server usually lasts 4 to 5 days without a restart. :(

Thanks anyways, sir, a man still needs hope every now and then.

I have my server automaticly restart every 24 hours, it really helps with Javas memory leaks

Link to comment
Share on other sites

I have my server automaticly restart every 24 hours, it really helps with Javas memory leaks

I never got any sort of automatic restart to work. The plugin 'SmartRestart' only shuts down the server, and a cron job to shutdown and then restart fails at the restarting part. I think it's something related to Linux permissions but... meh.

Link to comment
Share on other sites

@Commie, do you have a server log cause maybe we can find the cause :D

EDIT: Also just run the following commands on the mc folder if its a secure private server

cd /home/minecraft/

(might be another path, but you should use /home/user/subfolder/ cause the user will have full permissions for that path)

sudo chmod -r 777 serverfolder/

this will change to completely open file perms in the /home/minecraft/serverfolder/ dir and sub-dirs

BTW the remote toolkit do in fact have automatic restart schedule :)

Link to comment
Share on other sites

  • 2 weeks later...

Guys c'mon if you are serious about your server and stable uptime then dont just copy and paste someone elses command line. It is tuned up to their requirements and will probably negatively impact your server if you dont have say 4 threads:

-XX:ParallelGCThreads=4

Also this is littered with bizarre settings. One prime example:

SoftRefLRUPolicyMSPerMB => is defined in ms not mb so why set to 2048????

Anyways not here to flame your efforts, just to point out to server admin that copy and paste is a bad idea.

If you really want to get to grips with your server then add visualvm via jmx. This will show you actual gc related cpu usage and how your heap is behaving. It wont write the command lines for you, but it will help you to learn how fragile a command really is.

Link to comment
Share on other sites

Guys c'mon if you are serious about your server and stable uptime then dont just copy and paste someone elses command line. It is tuned up to their requirements and will probably negatively impact your server if you dont have say 4 threads:

-XX:ParallelGCThreads=4

Also this is littered with bizarre settings. One prime example:

SoftRefLRUPolicyMSPerMB => is defined in ms not mb so why set to 2048????

Anyways not here to flame your efforts, just to point out to server admin that copy and paste is a bad idea.

If you really want to get to grips with your server then add visualvm via jmx. This will show you actual gc related cpu usage and how your heap is behaving. It wont write the command lines for you, but it will help you to learn how fragile a command really is.

That's exactly what I think, that's why although I really want to put some of these to use, I'm not going to unless I understand what they do.

Link to comment
Share on other sites

  • 2 weeks later...

@xtremetom, you are absolutely right. But i did actually copy+paste and then edit things such as memory allowance.

But i actually forgot one very important thing, You need to have JDK 1.7.0 and not just JRE 1.7.0

AAAAND... i actually found a very useful link here (not the one i used originally but it should suffice) http://www.mcschematics.com/index.php?topic=5994.0

@Silent if you're that worried, why not just try it on a local server with a crapload of plugins that use a lot of cpu ;)

Link to comment
Share on other sites

"... You'll probably go from around 70% to 20% cpu usage ..."

And when you use this shit twice it will run a 100.000 slot Tekkit Server with 0,0000% CPU usage on a electronic calculator - for sure!

This is my command line:

-Xmx{MAX_MEMORY}M

That's all you need. When your server lags, get better hardware!

Link to comment
Share on other sites

Growster, thats just plain dumb... Please keep shitty comments out of this thread, as im actually just trying to help other server owners ;)

also about the SoftRefLRUPolicyMSPerMB=2048 This is from what i understand the time needed for soft references to get flushed per MB in Milliseconds and that this value per default is 1000 MS so changing this to 2048 would more than double the time needed, therefor reducing the cpu power needed to do this.

And yeah, it might aswell be 2000 MS or 2500 MS, But what if he who originally made these tuneups found that 2048 is a sweet spot ;)

Also more info on this in the link below.

http://www.oracle.com/technetwork/java/hotspotfaq-138619.html

And as a little bonus, i found this

http://forums.bukkit.org/threads/optimize-java-for-minecraft-in-a-extreme-way-p-need-feedback-thx-i-am-back.25994/

Its the original thread i first copied this from :D

Link to comment
Share on other sites

Plain dump?

You are referencing documents for Java 1.4: "Unless otherwise noted, all information on this page applies to both the HotSpot Client VM and the HotSpot Server VM as of Java SE version 1.4."

Java 1.4 is about 10 years old, you should use Java 1.7, with this version all these switches are obsolete. Welcome to 2012!

Link to comment
Share on other sites

Growster, yeah it may be 10 years old, but that does not mean that they still dont work. If you dont think they will help you, i wont force the fact that it lowered at least my cpu usage from 300% (3 cores in linux) to about 0 - 10%

Djinnii, again if something is old, does that mean its not right?

Also, im outta here as most of you either wont believe what i say or just denies that it could work in any way...

Link to comment
Share on other sites

Yeah, i read that but at least it worked for me and also saved a PVP-tournament on Netparty Fyn (the largest danish lan) with this.

So growster think what you want, but just because a Bukkit developer calls it a hoax, does not neccesarily mean it is.

And Djinnii i wasn't arguing with you, just asking a rethorical question :)

Also why would you need any more documentation on "if it still works" its not a very time consuming thing to test. it took me about 10 minutes to set up at that lan ;)

Link to comment
Share on other sites

Ok, ok - these switches saved a pvp tournament on a netparty ^^

I'm running 8 Minecraft Server, Tekkit, Craftbukkit and Vanilla. My experience with such experiments are bad, for a stable server you only need the switch -Xmx (regardless if your at a netparty). Java 7 (1.7.x) optimize all for you, in the days of 1.4 this was different.

Link to comment
Share on other sites

Hi Growster, I certainly agree with what your saying, especially from the perspective of a new server admin. However, java gc commands in the hands of an experienced "tinkerer" (even experienced users will need to tweak the settings a few times) are invaluable.

I suspect the developers suggest the aforementioned settings to keep things simple and help steer people from possibly corrupting game files and info.

To look at this issue in perspective, companies such as Blizzard employ people purely for for java gc management.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...