Proxmox 8.0.4 Swap management

hidigoudi

New Member
Aug 27, 2023
3
0
1
Hello,

I'm posting here something I noticed on Proxmox 8.0.4 about Swap and Swapiness on Debian 12. Here is the configuration of my Proxmox VE node :
  • 4 x Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz (1 Socket) (4 cores)
  • 16 GB of RAM
  • 6TB available (Raid 10 on 6*2TB Hard Disk)
  • BTRFS Storage to perform snapshots (6TB)
I have 3 running VMs (100, 101 and 102) :
  • 100: SMB share (Samba) on a GNU/Trisquel system (4GB of RAM + 2 vCPUs)
  • 101: Rocket Chat on Debian 11 (4GB of RAM + 4 vCPUs)
  • 102: A GNU/Trisquel system for some tests (2 GB of RAM + 2 vCPUs)
That's all, I have no other service running on my node. My swapiness parameter is at 10 which means that I can reach 90% of my physical memory before the system swap.

From the graphs on the proxmox VE web interface, I'm only at about 50% of RAM used. Here is the screenshot :

1693158285258.png

I never reach beyond 60% of RAM at all.
However, as you can see on the same above screenshot, the swap fills up over time without overloading of the server. The RAM used remains stable and never exceeds the 7.5 GB used. But I currently have 780 KB of data in the SWAP! I already performed a swapoff -a && swapon -a, but the behavior is still the same. The swap is used from time to time. I don't understand why...
By checking with htop command on the Proxmox node, I noticed I have a lot of cached memory :
1693158607403.png
Is swap is based also on cached / buffered memory ? It's really weird. Here is my Swapiness config :
1693158725778.png
Is someone able to explain me what I missed about this subject ?
Thank you very much for your help.
 
That's all, I have no other service running on my node. My swapiness parameter is at 10 which means that I can reach 90% of my physical memory before the system swap.
No, this is not how swappiness works. You can't define a percentage at which data should be swapped out. You just define if you want more or less pressure. When and how much is swapped out totally depends on the decisions of the kernel.

If you don't want to swap out at all unless it is really necessary to not OOM, you can set the swappiness to 0.
 
Ok thank you ! That's what I missed, I really though it was like a percentage. So with 10 as swapiness, how we can define how kernel will behave ? Is it rather a big pressure or not ?
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!