brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: free -h counts the page cache as available memory, so drop_caches is rarely needed

Cache
~/tips/tip-cache-free-page-cache-drop-caches

free -h

Explains the buff/cache column and how to drop the kernel page cache for testing.

A server with almost no free memory in the free column is normally fine.

free -h
sync; echo 3 | sudo tee /proc/sys/vm/drop_caches

The buff/cache column is file data the kernel keeps in RAM for faster reads, and it gives that memory back when programs need it. Look at the available column instead of free. Writing 1, 2 or 3 to drop_caches drops the page cache, the slab caches or both. It does not lose data, but the next reads come from disk, so the machine is slower for a while. It is useful for benchmarks, not as a regular cron job.

Further reading: Linux kernel docs: sysctl vm

Going deeper: Guide: your Unraid cache is full and Docker stopped, how to find out why and fix it

More Cache tips fincore /var/lib/example/data.db npm cache verify fc-cache -f -v ~/.local/share/fonts proxy_cache app; Cache-Control: no-cache All Cache tips (24) All topics

Link