Linux – vSwap vs Burstable RAM for OpenVZ

linuxmemoryopenvzvirtualization

What is the big difference between vSwap and Burstable RAM?

Does vSwap create and cause I/O by using disk? I know SWAP will use the disk so is vSwap the same as swap just virtualized in the container.

Best Answer

Burst memory is essentially memory that you can use if the host node has memory available and you have exceeded the memory guaranteed to your container. This is a flawed system because applications do not read memory in OpenVZ beancounters. It means that your VPS thinks it has more memory than the host node actually guarantees that you have.

For example, if I set a memory guarantee of 1GB and gave you 2GB burst, you would see a VPS that has 2GB of memory to use. However, if your usage exceeded 1GB and the host server had no memory to give to you beyond that point, the OpenVZ kernel begins to kill off your processes to drop your usage to a value equal to or lower than 1GB, your guaranteed memory.

The more appropriate solution was vSwap. Applications typically do not want to fill up swap space with frequently accessed data. This is typically (with plenty of exceptions) treated as the additional memory storage to keep you running if your memory usage happens to exceed that of your physical memory. Swap is, on a normal Linux system, disk space. Disk is slower than RAM. Treating the system disk as RAM has an impact on performance. OpenVZ assigns vSwap as actual RAM on the host node instead of disk space. To simulate a more native environment, the kernel artificially slows down the container so as to make swapping unattractive as it is generally thought to and expected to be.

The idea behind using RAM to assign vSwap instead of disk is that you do not want disk latency to increase for all users on the server when a few containers start maxing out their memory and swap. By assigning it to RAM you avoid unnecessary disk performance problems.

For an OpenVZ VPS that performs more like actual virtualization or like an actual dedicated server, vSwap is the choice you would make and Burst is outdated.

Related Topic