How VPS Virtualization Works: Hypervisors, Resource Allocation, and Performance Isolation Explained

Every VPS shares hardware with neighbours, but “shared” is not the useful abstraction. The useful abstraction is what the hypervisor enforces on each dimension: CPU time, memory residency, block I/O, and network queueing. Those four enforcement points explain nearly every performance surprise on a virtual server — the slow query that is actually steal time, the “1 GB” of RAM that behaves like 700 MB, the disk that delivers 8,000 IOPS while the provider advertises 10,000.

What the hypervisor schedules

KVM is the dominant production hypervisor for VPS hosting, with LXC (or OpenVZ in legacy setups) providing container-based alternatives. The distinction matters: a KVM guest is a real Linux kernel running in guest mode and it does not know it is virtualized; an LXC container is a namespace-isolated set of processes sharing the host kernel. For KVM, the host schedules each guest’s virtual CPUs as ordinary host threads, subject to the same CFS scheduler as every other process.

That means a vCPU is a time slice, not a core. If the host is oversubscribed — say 24 guest vCPUs on 16 physical threads — your vCPU waits its turn, and the wait appears inside your guest as steal time. Inside the guest, top shows st. Query it precisely with vmstat 1 5, column st, or read /proc/stat line cpu directly. Sustained steal above 5% on a single-vCPU guest is a sizing problem worth escalating; transient bursts during host maintenance are normal.

CPU shares, quotas, and why “vCPU” is ambiguous

Providers typically configure guests in one of two ways. A quota model caps you at N cores’ worth of time per period; exceeding it causes throttling, visible as a step-drop in throughput. A shares-based model lets you burst using idle cycles but deprioritizes you under contention. Neither is dishonest, but they produce very different behaviour under load. The practical test is to run a saturated workload for 15 minutes and watch whether steal rises smoothly or throughput cliffs:

# measure sustained CPU behaviour for 60 seconds
sysbench cpu --threads=$(nproc) --time=60 run
vmstat 1 60 | awk '{print $13}' | sort -n | tail -1

A cliff indicates quota-throttling; a smooth rise in steal indicates shares contention. The first is deterministic and easy to plan around, the second is noisy and argues for either a larger plan or a different provider.

Memory: allocated, resident, and actually available

On KVM, guest RAM is allocated to you at boot in most configurations, but that is not the whole story. The hypervisor may overcommit by using KSM (Kernel Samepage Merging) to deduplicate identical pages, and some providers use memory ballooning to reclaim pages from guests under host pressure. KSM is usually benign — identical zero pages and identical shared libraries collapse — but it costs CPU on the host to scan, and it can slow down your guest when a page must be un-shared on write.

Inside the guest, you also lose a little memory to the kernel itself, page tables, and any virtio buffers. A “1 GB” plan typically yields 950–990 MB of MemTotal. Check with free -m and be suspicious if the shortfall is larger than 5% — that suggests ballooning is active and your effectively usable RAM is below what you bought.

ResourceEnforcement mechanismWhere you observe itAction threshold
CPU timeCFS quota or shares; host thread schedulingst in vmstat/top>5% sustained steal
MemoryPre-allocated guest RAM, KSM, ballooningMemTotal vs plan size>5% shortfall
Block I/Oblkio/cgroup and provider-side QoSfio latency at fixed QDp99 >3× median
Networkvhost-net queues, traffic shapingiperf3, tc -s qdiscdrops or shaper backlog

I/O isolation is the weakest link

CPU is schedulable and memory is partitionable; block I/O is neither, cleanly. A shared NVMe device serves every guest on the host, and a noisy neighbour doing sequential writes can push your p99 read latency from 0.4 ms to 20 ms without touching your CPU allocation. Providers mitigate with cgroup io.max throttles (in cgroup v2) or blkio weights, but these cap throughput rather than guarantee latency.

Measure latency at a fixed queue depth rather than measuring peak IOPS, because IOPS numbers hide tail latency:

# 4k random read, queue depth 16, 30s
fio --name=rr --rw=randread --bs=4k --iodepth=16 \
    --size=1G --time_based --runtime=30 \
    --ioengine=libaio --direct=1 --group_reporting

Compare clat percentiles between a quiet hour and a busy one. If p99 moves by more than 3× while p50 stays flat, you are being affected by a neighbour, not by your own workload. That evidence is what a provider’s support team can actually act on.

Virtual devices and their overhead

Guest hardware is emulated or paravirtualized, and the choice is visible in lspci. virtio-net and virtio-blk (or virtio-scsi) are paravirtualized and cheap; emulated e1000 or IDE devices are expensive because every operation traps into the hypervisor. If you see emulated NICs, ask for virtio — the difference on a 1 Gbps link is frequently 30–40% of achievable throughput before any tuning at all. Enabling multi-queue virtio-net (ethtool -l eth0) further spreads packet processing across vCPUs and reduces softirq concentration on one core.

Containers versus virtual machines

An LXC container shares the host kernel, so there is no steal time in the KVM sense — but there is also no kernel isolation. Memory is limited by cgroup, CPU by cgroup, and a kernel bug or a sysctl change can affect everyone. Containers boot faster and often deliver better I/O because there is one fewer layer, which is why cheap plans frequently use them. The trade-off is that container guests usually cannot run their own kernel modules, change the I/O scheduler, or use nested virtualization.

If you want to understand which model fits a given workload before renting, the VPS plan comparison pages on virtualserversvps.com list the virtualization type alongside CPU and storage for each tier, which is the single most useful line on any provider’s spec sheet.

Sizing rule of thumb

Buy vCPUs for your p95 concurrent runnable threads, not your peak thread count, and add 25% for the hypervisor’s scheduling jitter. Buy RAM for your working set plus the kernel plus 15% page cache headroom. Treat storage IOPS and network as shared resources to be verified by measurement on arrival, not trusted from the brochure. The first hour on a new VPS should be three commands — vmstat 1, fio at fixed QD, and iperf3 — and if the numbers do not match the plan, you have a return window for a reason.

Isolation is never absolute on shared hardware. What you can do is know precisely which dimension is being contended, quantify it, and make the upgrade decision on evidence rather than on the feeling that the server “got slow”.

Leave a Reply