I'm no optimization expert .. looking for tips.

Discussion in 'Bukkit Help' started by gnftoxic, Mar 4, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    gnftoxic

    Hey guys. I'm having issues with my servers and everything lagging after about 30 minutes of playtime. Given I have three servers running, sometimes up to five, this may be the issue - however, they've been running fine up until yesterday.

    I'm running on a dedicated server, Intel Quad Core Xeon x3440 @ 2.53 GHz (hyper-threaded) with 2GB RAM (6GB SWAP), 500GB SATA II 7200 RPM HDD.

    I suppose I'll follow the sticky... :p

    1. Ubuntu 10.04.2
    2. 64-bit
    3.
    Code:
    # uname -a && java -version
    Linux x3430-22679 2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 23:42:43 UTC 2011 x86_64 GNU/Linux
    java version "1.6.0_20"
    OpenJDK Runtime Environment (IcedTea6 1.9.7) (6b20-1.9.7-0ubuntu1~10.04.1)
    OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)
    4. No.
    5. Server 1, 2, & 3: #462 (I know this is not latest - I will try upgrading in a few moments)
    6.
    Server 1, 2, & 3:
    Code:
    # cat /minecraft/survival/s
    #!/bin/bash
    screen -dmS Survival java -server \
            -Xincgc -Xmx1024M -XX:+UseConcMarkSweepGC \
            -XX:+UseParNewGC -XX:+CMSIncrementalPacing \
            -XX:ParallelGCThreads=4 \
            -jar craftbukkit.jar
    
    7.
    Server 1: NoCheatPlugin, LWC, MyHome, XenuStats, dynmap, Announcer, MCBans, WorldGuard, WorldEdit
    Server 2: MyHome, Whitelist, XenuStats, MyWarp, dynmap, WorldGuard, Minecart Mania Core, WorldEdit, Minecart Mania Autocart, XenuMod
    Server 3: NoCheatPlugin, CraftBookMechanisms, NameChanger, CraftBookCircuits, XenuStats, CraftBookVehicles, WorldGuard, CraftBookCommon, WorldEdit
    8. No errors occur, simply becomes a lagging issue - seems to be my first server, Survival, it takes quite some time for me to do a 'stop' and restart.
    9. Changing the RAM limits on the servers, adjusting "swappiness" (how often SWAP is used), changing the GCThreads from anywhere between 2-8 (4 seemed to be the best), and a few other methods I've forgotten about.
    10. I've tried most of the suggestions there, as it is a common support method.

    So yeah. I'm not sure how to completely tune Java - it just seems like a pain in arse.

    I appreciate any help :)
     
  2. Offline

    Toasty

    It is quite a pain.

    Not entirely sure how Java handles conflicting tags, but I can see you're telling it to use both the Incremental garbage collector, and the Concurrent Mark Sweep gc as well. That may be your problem.

    Here's mine:
    Code:
    #!/bin/sh
    java -Xmn256M -Xms512M -Xmx2048M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThreads=1 -XX:+CMSParallelRemarkEnabled -XX:+DisableExplicitGC -XX:MaxGCPauseMillis=500 -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -jar craftbukkit.jar
    Generally, you probably want two cores dedicated to GC if you can spare them (in your case, that ends up being 1 for the bukkit server, 2 for GC, and 1 for the system/everything else).

    -XX:ParallelGCThreads=** is used to limit the number of threads the GC uses, since the GC uses all available cores by default. But since bukkit isn't multi-threaded (from what I can tell), and you have 4 cores to burn, you might as well give the GC some more muscle to work with.

    Using Xincgc, my console actually spits out tons of "Can't keep up!" warnings with only 3 people on. This pretty much eradicated those warnings altogether, even with 8 people on.

    Also, note that -Xms is your initial starting allocation of RAM, with -Xmx as your limit. -Xmn is the initial heap size, and for efficiency reasons you want that to equal the average amount of RAM used by your server after 20-30min of average activity with all your plugins loaded. The best way to figure this out is to look at the process in your system monitor/task manager and look for the amount of RAM it's currently using (Note: NOT the amount of RAM it currently has allocated, which is what will probably be readily visible in those windows. You might have to adjust some view options).

    Too low and you [slightly] reduce performance. Too high and you're just wasting memory.
     
  3. Offline

    gnftoxic

    Hmmm. So 2 GC threads should work better than four? Virtually, I have 8 cores (because of hyper-threading) - and my server handles up to about 40 players across three servers until it starts lagging, I had actually just noticed that.

    Thanks for your suggestions - I'm going to try them out realtime and see how my players feel about it. If it goes bad, they surely will let me know (LALGLGALGALGALGLAG!!11!one) :)
     
  4. Offline

    Plague

    I don't really think you have to have a FAST garbage collecting or even multithreaded. I personally only use -Xmx3G -Xincgc and it works quite well. All those super-duper-advanced options you don't even know what they do are generally not a good idea to start with.
     
  5. Offline

    TnT

    The GC options usually make more sense if you have a lot of ram allocated to your server (8+GB). I haven't seen a case where its really worth while to run those commands with less RAM. Here's mine, and it works great:
    java -Xincgx -Xmx3G -jar craftbukkit.jar nogui

    Setting the GC threads is meant to decrease the amount of GC threads you have for your Java. Its an optimization for very large servers. By default it will use the same number of threads as you have processor cores.
     
Thread Status:
Not open for further replies.

Share This Page