Skip to content

ReferenceThe 22 checks

Memory and swap

Health checkmemory

What it reads

Memory and swap totals in /proc/meminfo.

Does it need root?

It reads everything it needs as a normal user.

When it passes

The report lists it as passed, in these words:

  • percent% of total memory in use

What it can find

Warning

Memory is percent% in use, above limit%

When memory runs out, Linux kills a process to free it, usually the biggest one, which is often the app.

Fix
ps -eo pid,comm,rss --sort=-rss | head -n 6
Warning

This server has total of memory and no swap

On a server under 2 GB with no swap, one spike in memory gets the app killed. Swap gives it room to survive the spike.

Fix
sudo fallocate -l 1G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile && echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab