Performance Monitoring — CPU, Memory, Disk, Network
Users say notes-api "feels slow". That is a symptom, not a diagnosis. A server has only a few resources that can run out, and a short, fixed checklist tells you which one is to blame in a couple of minutes.
The rule
Check the four resources in order: CPU, memory, disk, network.
For each resource, ask three questions: how busy is it, is work queueing for it, and are there errors? That is the idea behind the well-known USE method: utilisation, saturation, errors.
CPU. uptime shows the load average over 1, 5 and 15 minutes: roughly how many tasks were running or waiting. Compare it with the number of cores from nproc. A load of 2.0 on 4 cores has spare room; 7.8 on 2 cores means work is queueing. top shows which process is using it.
Memory. free -h shows memory. Read the available column, not free: Linux fills spare memory with disk cache and gives it back on demand, so a small free value is normal. Real trouble is low available, heavy swap use, or the kernel's out-of-memory killer ending processes (dmesg or journalctl -k shows it).
Disk. df -h shows space per filesystem. df -i shows inodes, the slots for file entries: millions of tiny files can exhaust them while space remains. du -sh /var/log/* finds what is big. iostat -x 1 or vmstat 1 shows whether the disk is the bottleneck, with processes waiting on input and output.
Network. ss -s summarises connections; ip -s link shows traffic and errors per interface.
uptime && nproc
free -h
df -h && df -i
vmstat 1 5