Console Login

OpenVZ vs. KVM: The Hidden Costs of "Burstable" RAM in 2012

OpenVZ vs. KVM: The Hidden Costs of "Burstable" RAM

There is a dirty secret in the hosting industry that most providers won't tell you: that 2GB of RAM you just bought might not actually be yours. If you are running a high-traffic e-commerce site on Magento or a critical database backend, understanding the virtualization layer underneath your operating system is not just an academic exercise—it is a survival skill.

In the current landscape of 2012, two technologies dominate the Virtual Private Server (VPS) market: OpenVZ and KVM. While OpenVZ offers attractive price points, it introduces architectural constraints that can lead to unpredictable downtime. At CoolVDS, we often migrate clients who are baffled by random MySQL crashes on other platforms, only to find they were victims of the "noisy neighbor" effect inherent to containerization.

The Architecture: Shared Kernel vs. Private Kernel

To understand the performance gap, you have to look at the kernel. OpenVZ is operating system-level virtualization. There is one single Linux kernel (usually a modified Red Hat 2.6.32 kernel in today's market) running on the host node. Your VPS is essentially a fancy chroot environment with resource limits applied.

KVM (Kernel-based Virtual Machine), which is the standard for CoolVDS infrastructure, offers full hardware virtualization. Each guest gets its own kernel. This distinction dictates stability, security, and performance.

The Nightmare of user_beancounters

If you are on an OpenVZ system (common with budget hosts), you are governed by the User Bean Counters (UBC). This is a set of limits that dictates everything from TCP buffers to kernel memory usage. The most dangerous metric here is not the RAM limit itself, but the kmemsize (kernel memory size) and privvmpages.

I recall a recent incident debugging a client's server in Oslo. They were running a standard LAMP stack on CentOS 6. The server had 4GB of "Burst" RAM, but MySQL kept crashing with Out of Memory errors, even though top showed 1GB free. The culprit? The provider had set a low barrier on kernel memory.

You can check if you are being throttled by running this command inside your OpenVZ container:

cat /proc/user_beancounters

The output will look something like this. Pay close attention to the last column, failcnt:

Version: 2.5
       uid  resource           held    maxheld    barrier      limit    failcnt
      101:  kmemsize        2434202    2643029   14372700   14790164          0
            lockedpages           0          0        256        256          0
            privvmpages       43120      45002      65536      69632       4829
            shmpages            650        660      21504      21504          0
            numproc              24         28        240        240          0
            physpages         14902      15045          0 2147483647          0

If you see the failcnt (fail count) rising above zero for privvmpages or kmemsize, your applications are silently being denied memory requests by the host kernel, regardless of what the free -m command tells you. This is why "Burst RAM" is a marketing gimmick. It is RAM you can use only if no one else on the node wants it.

The KVM Advantage for Database Reliability

Unlike OpenVZ, KVM acts like a dedicated server. There is no `user_beancounters`. If you allocate 4GB of RAM on a CoolVDS KVM instance, that RAM is reserved for your OS. The hypervisor does not overcommit in the same aggressive way.

This is critical for configuring databases. When tuning MySQL (InnoDB), you generally set the buffer pool to 70-80% of available RAM. On OpenVZ, this is Russian Roulette. On KVM, it is simple math.

Here is a safe configuration for a 4GB KVM instance running MySQL 5.5:

[mysqld]
# /etc/my.cnf
# Only possible reliably on KVM/Physical hardware
innodb_buffer_pool_size = 2G
innodb_log_file_size = 256M
innodb_flush_log_at_trx_commit = 1
query_cache_size = 0
query_cache_type = 0
Pro Tip: On OpenVZ, you often cannot modify sysctl parameters (like net.ipv4.tcp_tw_recycle) because you don't own the kernel. On CoolVDS KVM instances, you have full control over /etc/sysctl.conf to tune your TCP stack for high-latency connections, which is vital if your users are connecting from outside Norway.

Performance: The I/O Bottleneck

Disk I/O is usually the first bottleneck in virtualization. In an OpenVZ environment, the I/O scheduler (CFQ or Deadline) is managed by the host. If another container on the same physical node starts a heavy backup operation or a dd command, your website's latency will spike.

CoolVDS mitigates this by using RAID-10 SSD arrays (Solid State Drives are expensive, but the IOPS performance is non-negotiable for modern workloads). Furthermore, KVM allows us to use VirtIO drivers. VirtIO allows the guest OS to talk directly to the hypervisor for network and disk operations, reducing overhead significantly.

To ensure you are using the VirtIO driver on your CentOS 6 or Ubuntu 12.04 LTS instance, check your loaded modules:

lsmod | grep virtio

You should see virtio_net and virtio_blk listed. If not, you are running in emulation mode, which is significantly slower.

Legal and Compliance Nuances in Norway

For our Norwegian clients, data integrity is governed by Personopplysningsloven and overseen by Datatilsynet. While OpenVZ is generally secure, the shared kernel architecture theoretically exposes a larger attack surface. A kernel panic triggered by one container can take down the entire node.

For sensitive data handling, complete isolation is preferred. KVM provides that strong boundary. Furthermore, hosting on CoolVDS ensures your data resides in Oslo-based datacenters, ensuring low latency to the NIX (Norwegian Internet Exchange) and compliance with data residency requirements. Keeping data within the EEA is crucial.

Summary: Choosing the Right Tool

Feature OpenVZ CoolVDS (KVM)
Kernel Shared (2.6.32) Dedicated (Customizable)
Memory Burstable (Unreliable) Dedicated (Guaranteed)
Disk I/O Shared Scheduler VirtIO + SSD
Swap Virtual/Fake Real Partition

OpenVZ is not dead. It is excellent for lightweight development environments, VPN tunnels, or testing scripts where uptime is not paramount. However, for production applications, databases, and anything that generates revenue, the risk of resource contention is too high.

If you are tired of debugging vague "Resource Temporarily Unavailable" errors, it is time to move to a platform that respects your resources. Deploy a true KVM instance on CoolVDS with high-speed SSD storage today and stop fighting your hosting provider for the RAM you already paid for.