I would like to tweak some settings on my server to better use the resources I have.

The Linux server in question has 32gb RAM, running general Docker containers of the selfhosted variety, no AI, and 250gb SSD. Currently, the server has no swap with swappines set at 60.

Swap:              0           0  
vm.swappiness = 60

Generally, only one app is being engaged at a time and everything seems to respond fairly well.

So, my question is, what would be a good swapsize and swappiness level for this server? I realize that all of this is dependent on how the server is used and load level during operation. Is there a rule of thumb to go by. I’m sure there will be some tweaking involved, but I was looking for a good point to deviate from. Where do you guys set swap and swappiness?

Thanks

  • suicidaleggroll@lemm.ee
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    4 days ago

    I run all of my Docker containers in a VM (well, 4 different VMs, split according to network/firewall needs of the containers it runs). That VM is given about double the RAM needed for everything it runs, and enough cores that it never (or very, very rarely) is clipped. I then allow the containers to use whatever they need, unrestricted, while monitoring the overall resource utilization of the VM itself (cAdvisor + node_exporter + Promethus + Grafana + Alert Manager). If I find that the VM is creeping up on its load or memory limits, I’ll investigate which container is driving the usage and then either bump the VM limits up or address the service itself and modify its settings to drop back down.

    Theoretically I could implement per-container resource limits, but I’ve never found the need. I have heard some people complain about some containers leaking memory and creeping up over time, but I have an automated backup script which stops all containers and rsyncs their mapped volumes to an incremental backup system every night, so none of my containers stay running for longer than 24 hours continuous anyway.