Host swapping when it shouldn't

Valerio Pachera

Active Member
Aug 19, 2016
131
6
38
42
Hi all, I have a server with proxmox 5.
It hosts 2 vm:
- windows 2011, domain controller (id100);
- windows 2008, terminal server (id101).

I was going to check some setting in computer management / roles.
I guess it was a heavy task for windows (probably querying sql server)...well, the host hanged with message
Code:
task kswapd0:54 blocked for more than 120 seconds
And several other similar messages for other processes.

The host has 24G of ram.
Guest id 100: from 4G till 12G ram.
Guest id 101: from 2G till 4G ram.
So the host shall have alway 4G of ram for it self.

Notice I only have 8G of swap and it's size was chose automatically by proxmox installer.

Anyway, I chose then to give 4G more of ram to guest id 100 and remove the from guest id 101.
Nonetheless I selected 'Use fixed size memory' for guest id 100.
Both guests were shutdown, the I started the domain controller (id100).
It was amazingly slow at loading...I checked the host by atop and I saw the used swap size was increasing constantly!
Right now, the host has 24-16=8G of ram for itslef...why is it swapping?
Why isn't

I had to kill the guest ans reset the ram amount as before.
Notice that the domain controller has a 30G dedicated vdi for page file...

Please, help me understanding what's happening!

May virtio driver be involved?
 
Don't use swap with zfs.
I removed the swap partition and using zram, it's working fine.
You need of course a server with extra ram when using with zfs
You can lower the zfs arc cache to limit the RAM usage of zfs (default is 8GB) but you will loose performances
 
Hi I thought I fixed my issue by limiting max_c to 4G following the instruction of the above links...but the swapping problem showed up again.
Here's what a did yesterday:
- turned off my two guests.
- apt update; apt upgrade
(Proxmox got updated from 5.0-23/af4267bf to 5.0-30).
- Didn't reboot the host.
- Started the first guest...and the host started wapping right away!
- Killed the guest and restarted it two time and it was still swapping!
- Roboot of the host.
- The guest started and the host dind't swap.

Here's how I configured zfs the last time.

Code:
/etc/modprobe.d/zfs.conf
options zfs zfs_arc_min=536870912
options zfs zfs_arc_max=4294967296

grep ^c_ /proc/spl/kstat/zfs/arcstats
c_min                           4    536870912
c_max                           4    4294967296

Note: tight now the swap is still on zfs.
I'll move it as soon as I can add a disk.
Anyway, there's no reason to start swapping that way when noting is running on the server.

This is what I see running free -h waitng 20-30 second between each call:

Code:
Swap:          8.0G        548M        7.5G
Swap:          8.0G        611M        7.4G
Swap:          8.0G        670M        7.3G
Swap:          8.0G        714M        7.3G
Swap:          8.0G        780M        7.2G
 
Just remove swap and you are done. I have been running all my servers without swap for a few years with no issue...
 
Hi I thought I fixed my issue by limiting max_c to 4G following the instruction of the above links...but the swapping problem showed up again.
Here's what a did yesterday:
- turned off my two guests.
- apt update; apt upgrade
(Proxmox got updated from 5.0-23/af4267bf to 5.0-30).
You should use apt dist-upgrade, not only "upgrade", see the wiki, otherwise you risk that some package are not updated at all.
 

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!