XMS and XMX

Discussion in 'Performance Tweaking' started by WilsonXRS, Dec 31, 2012.

  1. I have a VPS and last night I paid to have it upgraded to 2.5GB of RAM. When they told me it was done I notice that I'm only getting 2.2GB of RAM for my server (using /gc in game it says I only have 2GB). I submitted a support ticket stating that I'm missing RAM and they replied:

    "The memory is all there. We've found that by not allocating the entire amount to the java memory heap allows for better performance because it will use more than just the heap."

    Is there any truth behind this? Does your XMS = XMX?

    On average I have about 25 players online and it gets up to the mid 30s. CPU usage is normally 30-40% and RAM usage is normally 60-70%. I need more memory to add additional plugins and for multiple worlds.
     
    #1 WilsonXRS, Dec 31, 2012
    Last edited: Dec 31, 2012
  2. Neither XMS nor XMX equate to full ram amount. In fact, it should NEVER be the full ram amount. Your Operating System and other applications (kernel logging, ssh server, ftp server, minecraft server control panel, web server powering that control panel etc. etc. etc.) ALL need a bit of memory. If you allocate 100% of your ram to your XMX, you will run into situation where Java cannot get enough ram, and forced to use swap, which is stupidly slow compared to ram.

    So, what they've done is correct: instead of putting 100% of it all into minecraft, they've left some aside for other things to work with, so your minecraft server hopefully does not run into swap as frequently.

    Now, to answer your question, I have my XMS set to the same as my XMX, both of which right now are set to 16G, but I have 32G of ram on my server. As you will note, XMS and XMX are NOT set to the full amount of ram I have... not by far. And that is the correct way to do things.

    With your current setup, you are probably okay. I'd usually want 100MB of memory set aside per connected player. That is, if I have 25 people online, I would want a XMX value of 2.5G. However, that does NOT mean a 2.5G VPS will do, I'd want a 3G VPS minimum if I want to set my XMX to 2.5G. If I have any lesser, I am at a high risk of running into swap, which is much slower, and will in turn hurt my server's performance.

    Hope this helps!
     
    • Informative Informative x 1
  3. Thank you so much for making this clearer!
     
    • Informative Informative x 1