Server slow with good hardware? Try a RAM disk!

Discussion in 'Bukkit Help' started by ShadowDrake, Jan 23, 2011.

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

    ShadowDrake

    I figure I can come here and help out anyone who may need it.

    I'm running a server on some seriously old hardware. It's an old Dell with a 2.4 GHz single core P4, 1.25GB DDR1 RAM and a couple of old, slow HDD's. It's probably at least six years old, pretty modest hardware. I have an average of six players on at any time, peaking around 10. There is a mere 768MB of RAM assigned to the server and it runs beautifully. How?

    For most people - server slowness, holes in the world, and other irritating things while running a minecraft server are related to the (poor) file save system and a bottleneck at HDD transfer speed because most people aren't running an SSD or multiple HDD's in a RAID 0. It really doesn't matter if you have an overclocked i7 if your HDD maxes out at 20mb/sec transfer speed ;) Also, HDD's have a relatively poor random access time (30-60ms IIRC) which results in a long delay waiting for many files to load.

    The most recent thing we tried to get the server to work with more than two people was a RAM disk (and disabling the page file). These two things ensure that ALL of Minecraft's data is stored in RAM which is VERY fast and designed for small, fast, random accesses which is what Minecraft's save system requires heavily. Even the slowest ram can easily hit 1Gb/sec transfer rates with near-zero random read times (measured in nanoseconds instead of milliseconds).

    Just wanting a no-nonsense way to create a RAMdisk, we tried dataram's ramdisk. Which I found here. http://memory.dataram.com/products-and-services/software/ramdisk

    It's free for up to 4GB - which is great because who actually has a 4GB world in minecraft?

    Install it, set it up. Check your minecraft folder size - I'd recommend making the ramdisk 25-50% bigger, just to leave extra space if the world increases or you want to add addons. Optionally, disable your page file. If you have lots of RAM, turning off the page file won't make a difference, but it's an extra measure to ensure that on lean machines, none of minecraft's data ends up anywhere except RAM.

    The last thing to note, data in RAM is volatile and WILL BE LOST when the computer is shut down. You'll need to find a way to ensure that data kept in the RAMdisk is stored to permanent media periodically in case of crash or power loss.

    So, TL;DR?

    Your minecraft server slow?
    1) Move all minecraft data to a RAM disk
    2) Disable your pagefile
    3) ?
    4) Profit! Or just have fun.

    Edit: Pagefile information has been struck out because this should not be performed on a machine which is used for any purpose other than your minecraft server. The pagefile is important and will save you from headaches later if you actually use that machine. Read below a little bit to see more, or, if you decide to disable the page file and you do not understand what it does, you can give yourself quite a few headaches later on down the line.
     
  2. Offline

    Plague

    Wait a minute here. Disabling a pagefile is one of the most common misconceptions on the net regarding HDD access slowness. Do you even know how swapping works? I know there are many people posting that it helped them, but that's either a quirk in windows caused by another software or driver or the lack of good testing methods (which is quite normal in internet posts).

    When you disable a pagefile, you do NOT force the pages to stay in memory, they stay there until there is no more space. the pagefile is only a temporary storage for those pages that could not fit. By disabling it you force the OS to commit them back to disk (if those were file pages) or cause allocation errors in virtual allocations.
     
  3. Offline

    ShadowDrake

    Well, our server is very slim on RAM. It's very likely that some of the memory allocated by minecraft was needed by windows processes, bumping some of that information to the page file. Our reason for disabling the page file was to prevent it from happening totally, leaving a crash as acceptable if RAM were to become filled. I'm very on top of what's left running on the server (hint: it's not much) but in case I forgot something, I'd prefer to have it attempt to allocate memory, fail, and subsequently crash so I can find it, and disable it if necessary, or make more space.

    I guess the average person wouldn't do this, so I'll remove it from the post. We did notice a -small- difference when disabling the page file, however we've definitely scraped for every tweak we can to get the server running it's best. We don't use it for anything else.

    Edit: What I mean to say is that I understand the page file has purpose and should be left enabled for the average user. Our machine is a dedicated Minecraft server which we use for nothing else. It has nothing but power and ethernet hooked up to it. It sits in a closet. I'm not one to advocate turning off the page file for all systems, but in this case, in my situation, it's preferable.
     
  4. Offline

    Plague

    Yes there are those acceptable reasons, but it is so hackish, that even mentioning it to wider public just causes misinformed crowd to use it improperly (I think this is why they tell you that gotos are baaad :) ).
     
  5. Offline

    ShadowDrake

    Fair enough point :p So I added a little edit at the bottom. But I left out a bunch of information that a person with an above-average computer background could fill in the blanks when setting it up. This is pretty much just a suggestion to anyone who may not have thought of it to work around the terrible save system that minecraft currently employs. It'll probably become a bit more of a moot point once Notch implements a better system - but it will still have benefits.

    I'd love to have a fast machine around to try it on as we still have some minor issues, but we're all too broke to throw more money at our dedicated server. It's worked great for pretty much any game my group has played in the past, so it keeps on chugging along haha
     
  6. Offline

    SeeD419

    <snip>

    Got it working.

    A system restart was needed.
     
  7. Offline

    Valrix

    Ram disks are so much faster, I love it
     
Thread Status:
Not open for further replies.

Share This Page