Memory ballooning and KSM in Proxmox VE

Memory ballooning and Kernel Samepage Merging let you overcommit RAM on Proxmox VE, but they trade density for latency and add a side-channel risk. This page explains how to decide, configure and verify them.

On this page

Memory ballooning and KSM in Proxmox VE: when overcommitting RAM is worth it

Overcommitting memory means allocating more RAM to guests than the hosts physically hold, and it only works when the guests do not all use their full allocation at the same time. Before a cluster team turns on memory ballooning or Kernel Samepage Merging (KSM), they should confirm that their workloads are idle enough, and their hosts have enough headroom, for the trade to make sense. Proxmox VE exposes both mechanisms through the KVM stack it integrates, but neither is a substitute for sizing. The balloon driver lets the hypervisor ask a guest to give back memory it is not using, and KSM lets the host look for identical memory pages across guests and keep only one copy. Both reduce pressure on host RAM, and both can add latency or create side channels when the workloads are sensitive.

Teams usually reach for these features when many guests run far below their configured memory, for example development, test or general-purpose Linux and Windows servers with bursty use, and when buying more RAM is not an option. The balloon driver is the first part of the picture: it runs inside the guest and needs to be present for the host to reclaim memory from it. Node-level control comes from the ballooning target, set per node with pvenode config set --ballooning-target, and the Proxmox VE guidance is to leave the ballooning device enabled in general. Confirm with the current host system administration chapter how the target behaves on your node version before you rely on it for a planned capacity figure.

Plan the decision in writing before you change settings. Record which guests are overcommitted, how much memory each actually uses under peak load, and what happens if all of them peak together. Treat KSM as a security question as well as a capacity one: page sharing across guests is the kind of feature that security teams will ask about, so check the QEMU/KVM chapter and your own threat model before enabling it on hosts that run tenants or sensitive workloads. For latency-sensitive guests such as databases or real-time services, plan to exclude them from ballooning and KSM and test that choice under load rather than assuming it.

How Kernel Samepage Merging trades density for isolation

Kernel Samepage Merging (KSM) is a Linux kernel feature that scans memory pages and merges identical pages from different processes into a single copy-on-write page. On a Proxmox VE host, this means that guests running the same operating system, libraries or application binaries can share physical memory that would otherwise be stored several times. KSM does not reduce the memory a guest believes it has. It reduces how much host RAM the identical pages consume, and the saving depends entirely on how similar the guests' memory contents are.

  • Scanning is periodic: KSM works in the background, so savings build up over time rather than instantly after a VM starts.
  • Copy-on-write breaks sharing: When a guest writes to a merged page, the kernel creates a private copy, which can add a small delay.
  • Savings vary by guest mix: Identical Linux or Windows images with the same patch level tend to merge more than heterogeneous workloads.
  • Host-level control: KSM is enabled and tuned on the host, so every guest on that node is affected by the same policy.
  • Visibility matters: Check how much memory is actually shared on each node before you count on the savings in capacity plans.

Confirm the current KSM behavior, default state and tuning options in the release you plan to run, using the Proxmox VE host system administration chapter as the starting point.

Which memory settings fit which workload

This table compares the four memory levers on a Proxmox VE node and the guests on it: the balloon device, the node ballooning target, KSM and per-VM memory minimums. Read each row as a workload type, then check the cell for the setting you would change and what it costs in latency or security. The main takeaway is that ballooning and KSM are tuning choices, so latency-sensitive and security-sensitive guests should be measured and reviewed before they inherit overcommitted memory.

SettingFits bestTrade-offConfirm before relying on it
Balloon device enabled (general default)Mixed guests where idle memory can be reclaimed under pressureReclaim depends on guest driver cooperation, so pressure can show up as slower guestsGuest balloon driver installed and working in each VM
Node ballooning targetNodes where host memory use should stay under a chosen levelSets a target for the host, so it needs monitoring to confirm the effect on guestsValue set per node with pvenode config set and checked after changes
Per-VM memory minimumGuests with a known floor that must never be squeezed belowLower headroom for the balloon to reclaim, so overcommit gains shrinkMinimum sized from the application's measured working set
KSM enabledMany similar guests, such as identical Linux or desktop imagesMerged pages can add timing side channels and cross-VM exposure riskYour security review accepts page sharing between tenants
KSM disabledMulti-tenant or regulated guests, and workloads with strict isolation requirementsLess memory density per node, so more hosts or RAM may be neededCapacity plan rerun without KSM savings
Ballooning and KSM off for a guestLatency-sensitive guests such as databases or real-time workloadsGuest keeps its memory, which lowers overcommit headroom on the nodeBenchmark of latency before and after the change
No overcommit (fixed memory)Guests whose performance must be predictable under loadHighest memory cost per guest, with no reclaim from idle VMsNode sized for the sum of guest memory plus host overhead

How to configure ballooning and KSM safely on a Proxmox VE node

This sequence moves a Proxmox VE node from an unplanned memory setup to one where overcommitment is deliberate, the balloon device is confirmed in every guest, KSM is set per workload, and the result is measured under load.

  1. Inventory guest memory and driver readiness

    The platform or virtualization engineer lists every VM on the node with its configured memory, its minimum memory setting, its OS and whether the VirtIO drivers and QEMU guest agent are installed. Record which guests are latency-sensitive, such as databases and real-time workloads, and which are batch or general-purpose. Done means you have a table that shows total configured memory, physical RAM on the node and the guests that cannot safely give memory back. Guests without the guest tools are the ones to fix first, because ballooning depends on the guest driver responding to the host.

  2. Set the node ballooning target

    Using root access on the node, the administrator sets the host memory usage target with pvenode config set --ballooning-target, choosing a percentage that leaves headroom for the host itself, Ceph or ZFS caches where present and hypervisor overhead. Changes are made node by node, so run the command on each node that will host the workload and keep the value consistent with the sizing in step one. Confirm the stored value by reading the node configuration back. The check is that the configured target matches the planned value on every node, and that the node still has free memory under normal load.

  3. Confirm the balloon device in each VM

    For each VM, the engineer checks the hardware tab or the VM configuration file to confirm the balloon device is present and that the minimum memory value reflects the lowest acceptable size for that guest. The general guidance in the Proxmox documentation is to keep the balloon device enabled, so disable it only with a recorded reason. Inside Windows or Linux guests, confirm the balloon driver is loaded and the guest agent reports memory. The check is a list of VMs where the device and driver are both confirmed, with exceptions documented.

  4. Decide KSM per workload

    Kernel Samepage Merging deduplicates identical memory pages across VMs, which can save memory on hosts running many similar guests but adds CPU work and can open side-channel exposure between tenants. The security team and the platform owner decide whether KSM stays on for each node or pool, based on whether guests from different trust zones share the node. Latency-sensitive guests are candidates to exclude or to keep on separate nodes. The check is a written decision per node or pool, reviewed by security, that states the trust boundary it assumes.

  5. Apply KSM settings and restart affected guests

    The administrator applies the chosen KSM setting on the nodes where it is approved, using the host configuration the team has standardized, and records the change in the change log. Where a setting only takes effect after a guest restart or host service restart, schedule that work in a maintenance window and confirm the guests come back with the expected memory layout. The check is that the node reports the intended KSM state and that restarted guests boot, show the expected memory and pass their application health checks.

  6. Monitor host memory and guest pressure

    The operations team adds dashboards or alerts for host memory use, swap activity, balloon inflation and guest-reported memory pressure, using the monitoring stack the organization already runs. Set thresholds with the application owners, because acceptable pressure differs between a database and a file server. The check is that each metric appears on the dashboard for every node in scope and that a test alert reaches the on-call channel. Without this visibility, ballooning problems appear first as slow applications rather than as a memory event.

  7. Verify under a controlled load test

    The team runs a load test that reproduces peak memory demand on a representative node, ideally one that mirrors production hardware and guest mix, and watches the host and guests during the test. Record response times for latency-sensitive services before and after the test, and confirm that ballooning reclaims memory without guests swapping heavily or failing. Keep the test scope to the nodes approved in the earlier steps. The check is a signed test record showing the results were acceptable, with any tuning changes logged and retested.

Security risks of page deduplication and how to contain them

Kernel Samepage Merging trades memory for shared pages across guests, and that sharing creates side channels that a memory-overcommit plan can overlook. The cards below cover the leakage paths, the tenant model, and the controls that keep KSM limited to workloads your security team has accepted. Confirm the risk model with your security team before enabling it on any node.

Cross-VM leakage through merged pages

When KSM merges identical memory pages, guests that hold the same content share one physical page. Attack research has shown that a guest can sometimes infer what another guest holds by observing write timing on pages it shares. For this topic, the question is whether any guest on the node could be hostile to another. Ask your security team to confirm the risk model for each guest class before KSM is enabled on a node that hosts them.

Timing effects on guest memory

Copy-on-write breaks on merged pages add latency when a guest writes to memory it shares with others. This is a performance risk and a side-channel risk at once, because the delay itself can reveal that a page was merged. Latency-sensitive guests are the ones most likely to show the effect, so check their memory behavior under load when you decide whether they should be excluded from KSM.

Tenant separation on shared nodes

KSM works across all guests on a host, so it does not respect boundaries between customers, business units or regulated data sets. If guests from different trust zones share a node, merging can connect them even when their networks and storage are separate. Map which guests belong to which tenant and decide whether those tenants should be placed on separate nodes instead of relying on KSM settings alone.

Limiting KSM to trusted workloads

The main operational control is to enable KSM only on nodes that run guests from a single trust zone, and to keep untrusted or regulated guests on nodes where it is off. Set this at the node level and document it, since a node-wide setting is easy to forget during later changes. Review placement rules and HA recovery targets so a guest does not move onto a node with different KSM behavior after a failure.

Change control and evidence

Changes to memory overcommit and KSM settings can alter the security posture of many guests at once, so they belong in change control. Record which nodes run KSM, which guests run on them, and who approved the trust model. Keep this record with your other evidence for access and tenant separation, and ask your security team which reviews must repeat after a version upgrade or a placement change.

How memory moves between guests, the balloon and the host

Memory starts in the host pool, which the hypervisor allocates to each VM. The balloon driver inside each guest hands pages back to the host when the host asks for memory, so the ballooning target on the node decides how far the host pushes. KSM runs on the host separately and merges identical pages across VMs, which is why it sits on the far side of the tenant boundary. Check which guests run the balloon driver, which ones trust KSM, and whether latency-sensitive VMs should keep their memory fixed.

Host pool, ballooning target, guest balloon drivers and KSM across tenant boundaries.

Limits to confirm before you overcommit memory

Memory overcommit only works when the guest, the host and the cluster behave as you expect under pressure. The cards below cover the checks that connect guest drivers, host headroom, swap, failure behavior and cluster operations, so you can test each one before a production workload depends on it.

Guest driver support

Ballooning depends on a balloon driver inside each guest that accepts requests to give memory back. Confirm that the guest OS and kernel you run include a working driver, and that the VM has the balloon device enabled in its hardware settings. A guest without the driver will ignore reclaim requests, so the host gets no relief when it needs it. Check this on a test VM before you size a node.

QEMU/KVM docs

Windows balloon driver installation

Windows guests need the VirtIO balloon driver installed before ballooning has any effect. Confirm that the driver is installed from the VirtIO driver package during setup or afterward, and that the device appears as working in Device Manager. Test that the guest responds when the host asks it to shrink. Without this check, a Windows guest can look healthy while the reclaim path does nothing.

Swap and host headroom

Overcommit moves pressure from RAM to swap or to guests that cannot shrink, so the host needs room for its own services, Corosync, storage caches and migrations. Ask whether swap exists on each node, how much it holds, and whether it sits on fast storage. Confirm the host keeps enough unreserved memory to start a failed guest elsewhere. Measure these figures on your own hardware rather than relying on a general rule.

Behavior under memory pressure

Test what happens when every guest asks for its full configured memory at the same time. Watch for swapping on the host, guest out-of-memory kills, and slow I/O that delays database or storage services. Use the node ballooning target to set a host-level goal, and confirm it leaves headroom for the host itself. Record which workloads you are willing to slow down and which must never shrink.

Migration and HA interaction

A VM that has been ballooned down can arrive on a target node with less memory than its configured size, and a node failure can push guests onto hosts that are already full. Confirm that the target nodes can absorb the guests you plan to move, and that high availability recovery does not depend on memory the cluster cannot provide. Plan these tests with your cluster design, since migration and HA behavior depends on shared storage and fencing being in place.

HA wiki

Questions buyers ask about ballooning and KSM in Proxmox VE

Should I turn KSM off on Proxmox VE hosts?

For guests that handle secrets or run latency-sensitive workloads, turning KSM off is usually the safer default, and many teams make that call per node or per guest group. Kernel Samepage Merging combines identical memory pages across guests, which saves RAM but adds CPU work and can create side channels between tenants or workloads that share a host. Keep it on only where the guests share a trust level, the savings matter, and your security team has accepted the risk in writing. Confirm the current KSM behavior and settings against the Proxmox VE host system administration chapter for your release before you decide.

What does the team need to run ballooning and KSM safely?

Someone needs to own memory capacity planning, who can read host memory metrics, and who can change guest settings and node-level options. The work requires knowledge of how the balloon driver reclaims memory from guests, how the ballooning target for host memory is set per node, and how the guest operating system reacts when memory is taken back. Windows and Linux guests need their drivers and guest agent installed and tested. Security staff must sign off on page sharing between guests. Without these skills in-house, the risk of swapping or slow guests after an overcommit change rises quickly.

Can we configure memory ballooning and KSM ourselves?

Yes, many teams can make these changes themselves, since the settings are documented in the Proxmox VE administration guide and apply per node and per virtual machine. The harder part is the verification: you need a test plan that loads representative guests, measures latency and swap activity, and checks that a migration or a busy night does not push the node into memory pressure. If your engineers have not run this kind of test before, or if the guests carry regulated data, a partner can plan the change, run the tests and document the result. Decide based on your team's capacity and on how much the guests matter to the business.

What drives the effort and cost of this work?

The main drivers are the number of nodes and guests, how mixed the workloads are, and how strict the trust boundaries between tenants are. Effort rises when guests have different latency needs, when Windows guests need driver checks, when the cluster uses high availability and must keep headroom for failover, or when auditors ask for evidence of the decision. Costs are mostly staff time for planning, testing, and documentation, plus any monitoring you add. Ask any provider for a written scope that lists the nodes, guest groups, test scenarios, and the evidence you will receive. Proxmox VE subscriptions are priced per CPU socket per year, and the pricing page lists the support tiers, but the memory settings themselves do not change that price.

How long does verification of ballooning and KSM changes take?

Duration depends on the number of hosts, the range of guest workloads, and how many load scenarios you must test. A small test cluster with a few representative guests usually takes less time than a production cluster with latency-sensitive databases and shared tenant guests, because each change needs a baseline, a test run, and a comparison. Plan time for a baseline measurement before any change, for repeated runs under memory pressure, for live migration and restart tests, and for the written result. Ask your team or partner to give a schedule tied to the scope in writing, and confirm the test window with the business owners of the affected guests.

Does ballooning or KSM change our compliance evidence?

Yes, the decision to overcommit memory and to share pages between guests can affect how you describe isolation, availability, and change control to auditors. Keep a record of the chosen settings per node, the reason for each decision, the test results, and the approval from the owner of the risk. Compliance frameworks use their own control IDs and wording, so ask your auditor which evidence they expect rather than assuming a format. DeployOpen prepares systems, controls, and evidence for compliance assessments, but independent auditors and certification bodies issue the audit reports and certifications.

When should we leave the ballooning device enabled?

In general, leave the ballooning device enabled and use the node-level ballooning target to protect the host, because it lets the host reclaim memory under pressure. Disable it for guests where unexpected memory reclaim would cause harm, such as databases with fixed buffer pools or real-time workloads, and test that choice. Confirm the per-guest and per-node settings in the QEMU/KVM virtual machines chapter before you change production guests, since the behavior depends on the guest operating system and its drivers.

How DeployOpen scopes memory tuning for your Proxmox VE clusters

DeployOpen sets the memory design in writing before any setting changes on a production node. The scope records which guests may be overcommitted, which must keep their memory fully reserved, the host headroom each node keeps for the hypervisor and Ceph or ZFS caches, and how a failed node's guests would fit on the survivors. Most engagements are fixed-scope, so the deliverables, the test plan and the acceptance criteria are agreed in writing first, and any retainer for later tuning or continuous testing is priced from that same written scope. DeployOpen does not publish a price list, so the quote follows from the scope rather than from a template.

Implementation happens inside your own clusters, on your hardware and under your change process. The work covers the balloon device settings per guest, the node-level ballooning target set with pvenode config set --ballooning-target, the decision on whether Kernel Samepage Merging stays enabled on each host, and a test run that drives the overcommitted guests to peak memory while latency-sensitive workloads are measured. DeployOpen then documents every final value, the reason behind it and the test results, so your operations team can change a setting later with the evidence in hand and your security team can review the KSM decision against its side-channel exposure.

Before you request a quote, confirm three things with your own teams: which workloads carry latency or compliance requirements that rule out sharing memory pages, who approves changes to host memory policy, and whether your Proxmox VE subscription tier and repository access match the change window you plan. The Proxmox VE administration guide is the reference for the host-side controls, and a scoping conversation with DeployOpen starts from those answers.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.