OpenWrt on a small router: living within 184 MB

Cheap routers are excellent OpenWrt hosts right up to the moment you install one package too many.

Know your budget

After the kernel and base system there is less free memory than the spec sheet suggests. I keep a note of the free memory on a fresh boot and treat anything I install as spending from that budget.

free -m
cat /proc/meminfo | grep -E 'MemAvailable|Slab'

One heavy service at a time

Most trouble came from running two memory-hungry daemons side by side. Restart scripts that start a new instance before the old one has exited are a classic way to double usage for a few seconds — long enough for the kernel to start killing things.

Watch the logs

logread | grep -i oom is the first command I run when the router misbehaves. If it prints anything, the fix is almost always to run less, not to tune more.

Older: What actually drains an Android phone overnight

← All notes