Issue of memory for a container

You can use ZRAM swap, and disk swap also, that way when your Zram swap gets full it will swap to disk. ZRAM will also help against SSD wear. Not really a problem on a spinning disk, but those are also super slow and would bog down your Container if you are using too much swap.

I have a small fanless mini-pc that I have Proxmox running a router VM, and many LXC containers.

I have this command watch '( zramctl --output-all ; echo -e "\n\n" ; free -h ; echo -e "\n\n" ; swapon --show ; )' that will live update all the memory information on my Proxmox host. Here is a sample of the output:
Code:
 zramctl --output-all ; echo -e "\n\n" ; free -h ; echo -e "\n\n" ; swapon --show
NAME       DISKSIZE DATA  COMPR ALGORITHM STREAMS ZERO-PAGES  TOTAL MEM-LIMIT MEM-USED MIGRATED COMP-RATIO MOUNTPOINT
/dev/zram0     4.6G   3G 791.4M zstd                    4908 858.2M        0B   860.3M    12.1K     3.5291 [SWAP]



               total        used        free      shared  buff/cache   available
Mem:           7.7Gi       6.9Gi       357Mi       320Mi       1.2Gi       819Mi
Swap:           28Gi       3.2Gi        24Gi



NAME       TYPE       SIZE USED  PRIO
/dev/sdb4  partition 23.6G   0B    10
/dev/zram0 partition  4.6G 3.2G 32767
root@pve:~# uptime
 11:43:04 up 2 days,  8:35,  1 user,  load average: 2.99, 3.01, 2.78
root@pve:~# uname -a
Linux pve 6.18.0-1-jaminmc-tcp-pve #1 SMP PREEMPT_DYNAMIC PMX 6.18.0-1 (2026-01-14T16:25Z) x86_64 GNU/Linux
Using the zstd compression, I get good ram compression, and Even with a Debian 13 LXC with an Xfce desktop connected with xrdp, I have the LXC with 2048 ram, and 2048 swap. Using Brave in it, playing youtube, and a 5 other tabs open, Let alone 2 pihole servers, an Omada Controller, and a podman LXC running some docker apps, and I am still not hitting my disk swap. Eventually it does hit the disk swap, but I rebooted 2 days ago when I installed my 6.18 test kernel.
 
  • Like
Reactions: Johannes S