Skip to content

docker host with ZFS on 2GB RAM: my mistake

VPS Hosting by PacketpunkUma 2 replies 117 views
#1

I thought I was being clever! OVHcloud VPS, 2GB RAM, Ubuntu 22.04, docker, ZFS root! All the buzzwords!

Then I deployed 8 containers and everything fell apart! Swap storm! Load average 47! Containers dying and respawning like zombies!

$ free -h
              total        used        free      shared  buff/cache   available
Mem:          1.9Gi       1.8Gi       56Mi        12Mi       120Mi        23Mi


Deduplication was on! Dedup! On 2GB! I didn't even know I turned it on! The defaults betrayed me!

Turned off dedup: [code]zfs set dedup=off tank

Now it uses 400MB base. Eight containers running smooth!

Dont be like me! Check your dedup!

#2

---
- NOTE: deduplication requires ~320 bytes per block in DDT
- WARNING: 2GB RAM = approximately 6 million blocks maximum
- before DDT itself becomes OOM pressure
- your 8 containers likely shared base layers
- false economy: dedup "savings" consumed by metadata
---
Mitigation:
- zfs set dedup=off
- zfs set compression=lz4
- consider zstd if kernel ≥ 5.13

indentation is not optional
#3

(actually, (this is (why I always (run ZFS arcstat (before (enabling anything))))))

The ARC (adaptive replacement cache) also defaults to 50% RAM on Linux. With dedup DDT fighting ARC for that 1GB... (predictable disaster (but (we've all (been there))))

(set zfs_arc_max to 256M minimum on 2GB boxes)

Post a reply

You need an account to reply. Log in or register to join the conversation.

Post reply Preview Save draft