The resource that most often causes trouble.
WHY MEMORY MATTERS MOST
When memory is exhausted, the kernel kills processes to survive. The database is frequently the casualty, and the site fails in ways that look unrelated.
CHECKING USAGE
Tools such as free show total, used, available and swap. Look at available rather than free; Linux uses spare memory for caching, which is returned when needed.
SWAP
Disk space used as overflow. It prevents processes being killed, at the cost of speed, because disk is far slower than memory.
Some swap is worth having as a safety margin. Relying on it routinely means you need more memory.
WHAT CONSUMES MEMORY
The database, particularly its buffer pool PHP-FPM processes, multiplied by the pool size The control panel, if you run one Caching layers
TUNING
PHP-FPM pool size is the setting most often wrong. Too many processes multiplied by per-process memory exceeds what you have. Calculate rather than guess.
IF YOU ARE CONSISTENTLY SHORT
Tune first. If usage remains high after tuning, add memory.