Proxmox is not using all available RAM
Hello! I have a Proxmox 8.3.2 node with 2 CPUs (72 cores) and 128 GB of RAM. The disks are configured with LVM, not ZFS.
I’ve noticed that Proxmox is not using all available RAM. Over 99 GB of the 128 GB are never utilized, and the system starts actively using SWAP. This happens even after a server reboot. I understand that using SWAP is normal, but I’m concerned about the unused amount of RAM.
I experimented with the swappiness parameter, setting it to 10, 1, and 50, but the problem persists.
What could be causing this behavior? Is this normal system operation? It would be very helpful to have an additional 25 GB of RAM available.
Currently, 87064 MB is occupied by virtual machines. Somewhere the balloon mechanism is enabled, but the total memory usage does not exceed the available amount.
As a result, I had to reduce the memory allocation for virtual machines to prevent SWAP from loading at 100%.
What could be wrong with the system configuration?
Proxmox doesn’t use all available RAM due to built-in Linux memory management mechanisms that intentionally leave part of RAM free for buffers and cache to avoid aggressive allocation of all available memory. This is normal system behavior aimed at ensuring stability and performance, especially when working with virtual machines. The problem with active SWAP usage when RAM is unused is usually related to incorrect balloon driver configuration in virtual machines or host memory management parameters.
Contents
- Main reasons for unused RAM
- Balloon driver issues
- Proxmox memory settings configuration
- Diagnostics and monitoring
- Optimization solutions
- Virtual machine configuration checking
Main reasons for unused RAM
In Linux systems, including Proxmox, there are several reasons why all available RAM might not be used:
Linux buffer caching - the system intentionally allocates memory for file caches and buffers. This isn’t “lost” memory, but efficient resource utilization to speed up I/O operations. You can check this with the command:
free -h
Pay attention to the “buff/cache” section - this memory is actively used by the system to improve performance.
ZFS ARC (if used) - when using the ZFS filesystem, there’s an Adaptive Replacement Cache that can occupy a significant amount of RAM. However, in your case, you mentioned using LVM, so this factor doesn’t apply.
Memory reservation for kernel and processes - Linux always keeps a certain amount of memory untouched for system processes and the kernel, especially on server systems with large amounts of RAM.
Balloon driver issues
Virtual machines in Proxmox can use a balloon driver for dynamic memory management. This is a common cause of the problems you’re describing:
How balloon driver works - ballooning allows VMs to “return” unused memory back to the host system. However, when misconfigured, this can lead to a paradoxical situation where the VM reports available memory while the host actively uses SWAP.
Problem symptoms:
- High SWAP level with available RAM
- Low overall memory usage on the host
- Slow virtual machine performance
Checking balloon status:
qm list # to view VM list
qm config <VMID> | grep balloon # check configuration of a specific VM
Proxmox memory settings configuration
To properly manage memory in Proxmox, you need to configure several parameters correctly:
Swappiness parameter - you’ve already tried changing this parameter, but it’s important to understand that it only affects the system’s decision to move memory pages to SWAP, not the overall memory allocation policy. Values of 10-50 are reasonable for server systems.
Memory overcommitment - in Proxmox, you can configure the ability to allocate more memory than is physically available:
cat /etc/sysctl.conf | grep vm.swappiness
cat /etc/sysctl.conf | grep overcommit_memory
Check the value of vm.overcommit_memory. For servers, values of 2 (strict control) or 1 (soft control) are usually recommended.
Huge Pages - for systems with large amounts of RAM, enabling Huge Pages can improve performance:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
Diagnostics and monitoring
For accurate diagnosis of memory issues, use the following tools:
Free command with details:
free -h free -m
Pay attention to the ratio between used, free, buff/cache, and swap.
Vmstat utility:
vmstat 1 10
The si (swap in) and so (swap out) parameters show swap activity.
Sar utility (sysstat):
sar -r 1 10
Shows real-time memory usage.
/proc/meminfo:
cat /proc/meminfo | grep -E "(MemAvailable|MemFree|Swap|Slab|PageTables)"
The MemAvailable parameter is particularly important - this is the memory actually available for allocation.
Optimization solutions
To solve the problem with unused RAM and active SWAP, you can take the following steps:
Disable balloon driver for virtual machines that don’t require dynamic memory management:
qm set <VMID> -balloon 0
Configure sysctl parameters:
cat >> /etc/sysctl.conf << EOF
vm.swappiness = 10
vm.vfs_cache_pressure = 50
EOF
sysctl -p
Optimize caching - reduce pressure on the filesystem cache:
echo 50 > /proc/sys/vm/vfs_cache_pressure
Monitor specific processes:
ps aux --sort=-%mem | head -10
Allows you to see which processes are consuming the most memory.
Virtual machine configuration checking
It’s important to check the settings of each virtual machine for incorrect memory usage:
VM configuration check:
qm config <VMID>
Pay attention to the parameters:
memory- allocated memoryballoon- is balloon enabledshares- memory prioritylimit- memory limit
Check memory usage within VM:
For each virtual machine, check the actual memory usage:
qm guest exec <VMID> "free -h"
Analyze Proxmox logs:
journalctl -u pve-cluster -f journalctl -u corosync -f
May contain errors related to memory management.
Sources
- Proxmox VE Memory Management Documentation
- Linux Memory Management Explained
- Balloon Driver in Virtualization
- Linux Memory Management Best Practices
- Proxmox Performance Tuning Guide
Conclusion
Unused RAM in Proxmox is in most cases normal system behavior aimed at ensuring stability and performance. Key points:
-
Buffer caching - a significant portion of “unused” memory is actually occupied by Linux file caches and buffers, which is efficient resource utilization.
-
Balloon driver - it’s most often the cause of problems with active SWAP usage when RAM is available. Check and disable it for non-critical virtual machines.
-
Proper configuration - optimal parameters
swappiness=10andvfs_cache_pressure=50will help balance memory usage. -
Monitoring - regularly use
free,vmstat, andsarto monitor memory status. -
VM configuration - check the settings of each virtual machine, especially allocated memory parameters and balloon driver.
For your case with 128GB RAM and active SWAP usage, it’s recommended to disable the balloon driver for most virtual machines and carefully configure memory management parameters in the system. This will allow for efficient use of available resources and avoid swapping issues.