TOCICI

Memory, Swap Space & VPS Environments

Low RAM

VPS accounts below 256MB RAM are intended for specific purposes, such as remote systems monitoring nodes, diagnostic & troubleshooting nodes, and low-end web servers. Upon request we can pre-install certain packages for you, but since your amount of RAM is so minimal, you will often be unable to run distribution package management tools (i.e. yum or apt-get) yourself.

If you want the ability to utilize standard package management tools:

  • On Debian-based platforms, please obtain a VPS with a minimum of 128MB guaranteed RAM.
  • On RedHat-based platforms, please obtain a VPS with a minimum of 256MB guaranteed RAM.

Overusage of VPS

In addition to just Low RAM VPSes, if you run many processes inside your VPS; so much that it has very little unused RAM, then you'll also encounter the same issues as a Low RAM VPS. The recommendation here, is to close some open programs, or purchase additional RAM.

Common Errors

Below are common errors encountered when attempting to utilize a package manager on a VPS which is low on RAM:

YUM

memory alloc (4 bytes) returned NULL

Troubleshooting

How to identify if your VPS is low on RAM? Just check out the /proc/user_beancounters file with the command:

sudo cat /proc/user_beancounters

Pay close attention to the failcnt column:

       uid  resource                     held              maxheld              barrier                limit              failcnt
...
            privvmpages                112406               365624               524288               524288              1721635

The above entry indicates that your VPS is running out of RAM. The short-term quick workaround is typically to shutdown running services while running an update, the longer-term recommendation is that you upgrade your VPS's memory.

Swap Space

Each VPS includes SWAP space that equals 50% of purchased RAM.

If you need more working memory, please upgrade your VPS. Utilizing large amounts of swap space inside your VPS will significantly slow it down. We recommend two things:

  1. If you need just a little bit of swap, count on your existing swap resources for this. We provide a very generous swap allocation.
  2. If you need large amounts of swap, your VPS will run slow. Either upgrade your VPS to more accurately reflect your usage needs, or reduce your memory requirements.

Additional Swap Space

We've been noticing quite a few customers attempting to add additional memory to their VPS by creating a swapfile. Please don't do this. Attempting to do so can result in your VPS becoming unbootable, with two remedies:

  1. Restarting the host server (which we're very unlikely to do).
  2. Wiping & rebuilding your VPS (you can do this via the Control Panel interface - it will wipe all data from your VPS).

OpenVZ does not virtualize swap down to the individual VPS level. Instead, swap is handled at the host level, and your processes are given a slice of ram in which to run. To better understand how OpenVZ handles memory, please see the OpenVZ memory and swap space page.

Each VPS includes SWAP space which equals 50% of purchased RAM. If you need more working memory, please upgrade your VPS. Utilizing very large amounts of swap space simply slows your VPS down, and provides no benefits to you.

Where is it going?

Even notice that an idle server often consumes lots of RAM, why?

When RAM is not needed for other functions, your server will load frequently-accessed files into memory in order to read them more quickly. While loaded into RAM, the server accesses the file's contents orders of magnitude faster than when reading from disk. A modern SATA disk will enable a server to read files at upwards of 100MB/second, if the files are in sequential units disk. However, RAM read speeds start at multi-GB/second, and quickly move upwards from there.

If RAM becomes needed for another function, these files are quickly, transparent, and automatically flushed out of memory, and the RAM is made available for the other functions.

The most reliable method for viewing view your memory use is run from the command line – “top.” Top is a very handy program, which will show you real-time sytem information. Log into your server as root using SSH, and type the word “top” (without quotes) at the prompt. You’ll see something like the following:

top - 16:43:19 up 73 days, 17:07,  6 users,  load average: 3.06, 4.18, 4.38
Tasks: 492 total,   1 running, 491 sleeping,   0 stopped,   0 zombie
Cpu0  :  4.0%us,  1.0%sy,  2.6%ni, 91.4%id,  0.0%wa,  0.3%hi,  0.7%si,  0.0%st
Cpu1  : 25.1%us, 10.2%sy,  0.7%ni, 63.7%id,  0.3%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   8160100k total,  7857656k used,   302444k free,   327140k buffers
Swap:  3080184k total,    57976k used,  3022208k free,  2967988k cached

The second line from the bottom shows your total memory usage – it displays how much RAM you have (8GB in this case,) how much is used (~7.8GB) and how much is free (0.3GB).

The bottom line shows your swap usage. “Swap” memory is extremely inefficient; the system is using hard disk space as virtual memory, essentially using the disk as “fake RAM.” If you see your server has low free memory, and is often using a lot of swap, add more RAM to improve performance.

Specific Application Needs

Minecraft

For running a Minecraft server, we recommend a minimum of 2GB RAM, and a minimum two CPU threads. This ensures that you have enough ram at all times to meet their minimum system requirements and overcome any hardware limitations.

We have many environments happily running Minecraft on 2GB and larger VPSes. Some are attempting to run on 1GB, or smaller, VPS environments, or just on a single core - we often hear of lower performance and decreased Minecraft stability within those smaller setups, but apparently some folks are OK with that…you get to decide, by purchasing the resources that you feel is appropriate.

Additional setup details are available on our support site: http://support.tocici.com/minecraft

General Minecraft server sizing recommendation

Below is a brief summary reviewing the number of players you can expect to support with varying amounts of VPS RAM:

RAM1) Number of Players
512MB 62)
1024MB (1GB) 12
2048MB (2GB) 24
4096MB (4GB) 47
8192MB (8GB) 96

To better understand how VPS RAM allocations will impact your Minecraft server, we recommend visiting www.canihostaminecraftserver.com.

1) guaranteed RAM
2) This is if, and only if, you can get Minecraft to start on such a plan; often requires that you do quite a bit of tuning beforehand.