Welcome to Minetown!
To join our community, please login or register!
Internet Explorer
Internet Explorer is not supported. Please upgrade to a more modern browser.

[Enjin Archive] What's a RAMdisk and how it works.
Started by [E] sawine

Hey,

I think I will try to clear this up once so most of you can understand better the configuration the server is running on.

First, a "regular" minecraft server runs on a hard drive. A hard drive consist of rotating rigid platters on a motor-driven spindle. Data is magnetically read from and written to the platter by read/write heads. You could picture this as something that would look like a miniature record turn table writting on some thick magnetic rock disk.

In minecraft, everytime you place or destroy a block, you create data inside a file. Also when the map is being generated. Each player doing one action is a single data entry. So this means that when there are 30 players online, around 30 files are being edited and read on the hard disk. This is excluding all the other needed data that need to be read on the hard drive, which is mostly everything that runs on the dedicated server.

Another thing with hard drives is that the data is not necessarily written or read in the same section of the disk. So imagine a circle, draw 30 lines around it randomly and each of these lines would represent the physical location where the data is stored. That means the disk have to achieve more operations to read all this data. It would have to spin several times instead of just once.

Hard disk also have physical limitation. I wont go into details here, but will do a quick resume. Most hard drives at the moment have between 5400 - 10000 RPM speed. This is the speed that the drive can acquire and write the data. Hard drives dont write data directly on the disk. The drive has an integrated cache memory. This is kind of ram but only for you hard drive. So this memory gets filled, when its full the drive writes it and clears the memory for more data. I think you can understand that the more things you ask your hard disk to do, this operation have to be redone everytime, and at some point will reach physical limitations. Which will result in longer delay read/write = lag.

The 2x500gb RAID1 configuration we are using means we have 2 500gb harddrives that are configured to both store the same exentical data. Both writes the data at the same time, but they dont read the same. This configuration gives a performance increase on the read speed but it has a "slower" write speed, considering atlernative configurations. This configuration is also more safe than using RAID0 because if one drives fails, we wont lose all the data.

(RAID0 would mean of using both drive to act as a single one. 2x write&read speed, 2x more likely to fail)

http://en.wikipedia.org/wiki/RAID

So... now, the RAM.

RAM consist of virtual memory. It isnt written on anything solid, if you turn off your computer or server, your ram is complety wiped and reloaded at the restart of the machine.

A SATAII hard disk write or read at an approximate speed of 300MB/S. It can only do one action at the time at this speed.

RAM read and writes at the same time at a speed of 1200MB/S. It can support multiple actions at the time at this speed.

I think the numbers speak for themselves.

So finally... What's a RAMdisk ?

RAM wasnt originally created to be a place to host files. RAM is the memory that programs and OS use to execute applications.

But with nowadays technology and strong servers, it is now possible to configure mostly what you want.

A RAMdisk is an emulation of a disk on the RAM. A section of the ram is told to act as a disk.

In our case, we are creating a link over the world files to send them onto the ram and the rest of the server is runned on the regular disk.

That way the map can me read and modified at 1200MB/S. Which also result in freeing alot of work charge on the hard disk.

This configuration has it advantages, but also disadvantages:

If the power cut down or the server box is shut down, all the data is cleared instantly.

That's why we are using a script to backup the data from the ramdisk to the hard disk every 5 minutes. A second script also save it every 60 minutes in a different location for more safety.

And another regular backup that occurs every 12h compress and store the map files.

The problem with the 5min backup. Is that if the map gets corrupted, It leaves only 5 minute to disable the save. So this script only protects us from map being lost from a server box reboot.

What happened 24 hours ago, is that somehow the link to the ramdisk failed at some point, the game server couldnt see some data, so it recreated it.

The reason why it failed is unknown by my host, and Im still digging this issue to try to find the actual problem... if there is one, as this could have been a random issue caused by... a plugin, a person, a command ? who knows, java is full of surprises.

Well, I hope this thread will help more people understand how things work <object class="emojione" data="https://resources.enjin.com/1489581540/themes/core/images/emojione/svg/1f642.svg?0" type="image/svg+xml" standby=":)">:)</object>

Also hope enouph ppl will make it to the end of it <object class="emojione" data="https://resources.enjin.com/1489581540/themes/core/images/emojione/svg/1f61b.svg?0" type="image/svg+xml" standby=":p">:p</object>

Cya
Guys he's lying the internet is magic. <object class="emojione" data="https://resources.enjin.com/1489581540/themes/core/images/emojione/svg/1f632.svg?0" type="image/svg+xml" standby=":o">:o</object> jk Thank you sawine, for real that time.
MAGNETS!