Linux Shared Memory allocation behaviour
First a little background: we used this tutorial to place our Minecraft world folder (which won't get bigger than 150MB or so with our settings) inside the Linux shared memory folder. We back it up every 10 minutes to the HDD using rsync. This should reduce the amount of I/O operations the HDD (a single 1TB drive) has to endure.
We set this up yesterday evening, but we forgot that every Tuesday night our backup program starts running too (which backs up the entire server to another machine on the network). Normally this isn't a problem, but this time our server went into a coma. It started swapping memory because it ran out of RAM.
Now I find this a little odd, since I'd think the shared memory would only allocate 150MB on the RAM to store the data on. With 4GB installed, you'd think that it doesn't matter that much.
My question is: does the Shared Memory actually allocate as much space on the RAM as the amount of data you put on it, or does it behave differently (like it reserves larger blocks)? I'm having a hard time finding info on the net about this.
If you could give some other tips on why the server mig开发者_运维问答ht've freaked out, please do.
You can probably find out what you want by using
df /dev/shm
du -shc /dev/shm/minecraft/world/*
Or you can use the better road and create a separate mount, and limit it:
mkdir /tmp/minecraft
sudo mount -o size=150M,noexec,nodev -t tmpfs none /tmp/minecraft
HTH
PS: it is entirely possible to setup this mount from fstab, e.g.
none /mnt/minecraft tmpfs auto,size=400M,noexec,nodev 0 0
精彩评论