Swappiness with Proxmox Nodes

mliebherr99

New Member
Jun 21, 2017
3
0
1
44
Hello,

i am monitoring my Swap usage with Nagios and i get:

SWAP WARNING - 35% free (4151 MB out of 12006 MB)

I started with 4GB of swap. My Node has 48GB RAM in Total.
Should i create even more swap space? I have a bad feeling if the node uses so much swap:
  • What happens when the node crashes ? Is the data in swap lost?
  • What if i want to live migrate a VM, will it then read the 12GB VM RAM from swap (and therefore be slow?)

Has anyone else the same problem? Has someone adjusted the swappiness? Should i leave it the default like other thousands of proxmox users, too?

Thanks.
 
Hi,

I would inspect why your Host swaps?
Do you use more Memory than you have?
 
Hello,

i am monitoring my Swap usage with Nagios and i get:

SWAP WARNING - 35% free (4151 MB out of 12006 MB)

I started with 4GB of swap. My Node has 48GB RAM in Total.
Should i create even more swap space?
Hi,
depends on your system and VMs. I would use 8GB swap (I know, there are people here, with an different view of swap).
I have a bad feeling if the node uses so much swap:
What happens when the node crashes ? Is the data in swap lost?
sounds, that you don't understand the usage of swap right.
swap will used instead (expensive) memory, for programs, which are not used (in the worst case, for used programs too).
If your system crash, the program in the memory ist also lost - with memory and swap.
  • What if i want to live migrate a VM, will it then read the 12GB VM RAM from swap (and therefore be slow?)
if your VM used swap, this will read for an migration - of course.
Has anyone else the same problem? Has someone adjusted the swappiness? Should i leave it the default like other thousands of proxmox users, too?

Thanks.
You can adjust your swapiness - it's make sense. I use an swapiness of 1.
Nevertheless the pve-system will used swap, because the kvm-processes are used cgroups with own swapiness-settings.
If you have VMs with running, but unused programs, they will use swap - even with an swapiness of 1 on the host!

You can install smem to identify which process used how much swap-space.

Udo
 
Thanks a lot for your replies.

Thanks Udo for the "smem" tip :)

Looking at "free -m" i just wonder why it swapps that much:
See: https ://image.ibb.co/kmSGmy/swap.jpg

3x /usr/bin/kvm processes use 1,5GB, 1,7GB and 2,3GB swap
But why if i have so much RAM available?
 
If you have plenty of RAM, why you do not disable swap altogether? I have been running Proxmox without swap for a few years, without any problem...

I always hear the same "you need swap in case you run out of ram" crap. And what if you run out of swap too? Why should I have "x" GB ram and "y" GB swap? Why not having "x+y" GB ram instead?
 
  • Like
Reactions: Oleg Zech
Why this happens (and how to avoid swapping, if you have enough RAM) is covered in: https://forum.proxmox.com/threads/swappiness-question.42295/page-2

> I always hear the same "you need swap in case you run out of ram" crap. And what if you run out of swap too?
Remember, everyone don't have same amount of finances, same hardware etc. Needs for system resources change over time, etc etc.
Everything varies. Therefore, attitude: "buy more RAM", often does not apply.
Also, original poster stated that free RAM is available, but system still swaps to disk, to me that indicates that kernel swappiness is either default value of more aggressive than default, which means that if you buy more RAM, it wont solve this problem.
 

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!