Proxmox VEIX · Virtual MachinesCPU and memory
VM memory: ballooning, hugepages, NUMA
What you'll learn
- Configure memory allocation, ballooning, and overcommit
- Decide when hugepages are appropriate
- Avoid the memory-ballooning pitfalls
- Read host and guest memory pressure indicators
Prerequisites
Verified against Proxmox VE 9.2.4 · Proxmox Backup Server 4.2.5 · Ceph Squid / Tentacle · Debian 13 (Trixie) · Linux kernel 7.0 (PVE 9.2 default) · 2026-08-07
Why this matters in production
Memory is the resource most often mis-sized in Proxmox deployments. Either VMs are sized too large (no room for HA failover) or too small (poor application performance). This lesson teaches the right way to think about guest memory.
How guest memory maps to host memory
A VM’s configured memory is committed by the host kernel — the host reserves that much RAM for the guest. With ballooning, the guest can return memory to the host dynamically.
flowchart LR
A[Guest kernel] -->|balloon driver| B[Host memory]
B --> C[QEMU process address space]
Without ballooning: the host commits the full configured memory immediately. With ballooning: the host commits a configurable minimum; the guest may return up to (configured − minimum) when the host is under pressure.
qm set 100 --balloon 1024
When to use ballooning
| Scenario | Use ballooning? |
|---|---|
| Overcommit ratio reasonable (< 1.5×) | Yes |
| Heavy overcommit (> 2×) | No — guests starve when host memory is tight |
| Latency-sensitive workloads | No — balloon driver adds latency |
| Production with strict SLAs | No — predictable memory is better |
Hugepages
Default Linux page size is 4 KB. Hugepages are 2 MB or 1 GB, reducing TLB pressure for large-memory workloads (databases, in-memory caches).
Enable hugepages on the host:
echo 'vm.nr_hugepages=32' > /etc/sysctl.d/99-hugepages.conf && sysctl -pThen enable hugepages on the VM:
qm set 100 --hugepages 1
Reading memory pressure indicators
Inside the guest:
free -h && vmstat 1 5
si/so columns in vmstat show swap-in/swap-out. Non-zero values indicate memory
pressure. KSM (Kernel Samepage Merging) can also help reduce memory pressure across
similar VMs.
On the host:
cat /proc/pressure/memory && ps -eo pid,comm,rss | sort -k3 -n -r | head
/proc/pressure/memory shows system-wide memory pressure (some/full stall time).
Production considerations
Common mistakes
- Allocating more memory than the workload needs.
- Relying on ballooning under heavy overcommit.
- Enabling hugepages without sizing the host’s hugepage pool correctly.
- Forgetting that hugepages disable memory overcommit.
Key takeaways
- Ballooning allows some overcommit; do not exceed 1.5× safely.
- Hugepages improve performance but disable ballooning.
- Monitor committed memory vs physical RAM.
Knowledge check
Knowledge check · 3 questions
Q1. What does ballooning do?
Q2. A VM backed by hugepages has its memory pinned at start, which rules out ballooning.
Q3. Which sysctl setting reserves hugepages on the host?
Passing score: 75%. Answers are checked in this browser.