Fix Proxmox swapping issue

I recently had an issue with one of my Proxmox hosts where it would max out all swap and slow down to a crawl despite having plenty of physical memory free. After digging and tweaking, I found this post which directed to set the kernel swappiness setting to 0. More reading suggested I should set it to 1, which is what I did.

Append to /etc/sysctl.conf:

#Fix excessive swap usage
vm.swappiness = 1 

Apply settings with:

sysctl --system

This did the trick for me.

One thought on “Fix Proxmox swapping issue”

  1. Hi.
    Don’t use vm.swappiness = 1
    Try vm.swappiness = 10 or leave default (60)

    Or better try :

    #!/usr/bin/env bash
    #http://redsymbol.net/articles/unofficial-bash-strict-mode/
    #set -euxo pipefail
    #set -euo pipefail
    set -x
    IFS=$’\n\t’

    for module in lz4 lz4_compress z3fold
    do grep -iqw “^$module$” /etc/initramfs-tools/modules || printf ‘%s\n’ “$module” >> /etc/initramfs-tools/modules
    done
    update-initramfs -u

    echo ‘GRUB_CMDLINE_LINUX_DEFAULT=”$GRUB_CMDLINE_LINUX_DEFAULT zswap.enabled=1 zswap.compressor=lz4 zswap.zpool=z3fold zswap.max_pool_percent=25″‘ > /etc/default/grub.d/zswap.cfg
    update-grub

    And reboot.

    P.s. Now ZSTD can be much better then LZ4. But ZSTD is not exist in linux kernel by default 🙁
    github.com/facebook/zstd
    http://www.linuxmint.com.br/discussion/51150/habilitando-zswap-zstd-z3fold

    P.p.s. forum.netgate.com/topic/120102/proxmox-ceph-zfs-pfsense

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.