free -m on a healthy database host shows free: 412 and available: 51203 out of 64 GB. A junior engineer wants to add RAM. What do you tell them?
- Add swap so the cache can be paged out. Page cache is dropped, never swapped; swap is for anonymous memory.
- They are right; 412 MB free means the OOM killer is imminent. The OOM killer cares about reclaimable memory, which 'available' estimates.
- Run
echo 3 > /proc/sys/vm/drop_cachesnightly to keep free memory high. Dropping caches throws away useful data and forces re-reads from disk; it lowers performance for no benefit. - The host is fine: the kernel uses idle RAM as page cache, which is reclaimable; 'available' is the number that predicts whether new allocations will succeed. 'free' is memory doing nothing; a well-used Linux box keeps it near zero on purpose.
Free memory is supposed to be small, so the number that matters is available.
Page cache is the kernel spending otherwise-idle RAM on avoiding disk reads, and it is given back the moment a process needs it. Reading free correctly is table stakes in Linux rounds; the interviewer is checking whether you know what MemAvailable estimates.
Reading the free column as headroom, and asking for more RAM on a machine that is perfectly healthy.