In one minute
- A way to find out why a server is slow, using a few numbers: load average, memory, swap and disk wait.
- "The server is slow" is vague. Your job is to turn it into a clear answer: is the problem the CPU, the memory, the disk or the network? Each one needs a different fix.
- You run a short checklist of commands (
uptime,free,vmstat,df,ps). Each command checks one part of the machine. The part that looks overloaded is your bottleneck. - 👉 Any time an app is slow, an alert fires for high CPU or memory, or a container keeps restarting.
Think of it like: a doctor's check-up. Temperature, pulse, blood pressure. Each check is quick, and together they point to what is wrong.
Load average: uptime
The load average shows how busy the CPU has been: how many processes were running or waiting for their turn.
👉 The very first number to check on a slow server.
uptime 09:42:17 up 3 days, 4:12, 1 user, load average: 0.08, 0.12, 0.10The three numbers are averages over the last 1, 5 and 15 minutes.
How to read it: compare it with the number of CPU cores (find that with nproc).
| Cores | Load | Meaning |
|---|---|---|
| 4 | 0.5 | Mostly idle |
| 4 | 4.0 | Fully busy, but keeping up |
| 4 | 12.0 | Overloaded: work is waiting in a queue |
Look at the trend too, reading from right to left (oldest to newest):
1.0, 4.0, 8.0→ load is going down.8.0, 4.0, 1.0→ load is going up right now.
Think of it like: checkout lanes in a shop. 4 lanes (cores) with 4 customers (load 4) is busy but fine. 4 lanes with 12 customers means people are queueing.
Memory: free
free shows how memory (RAM) is being used.
👉 The app is slow, or something keeps getting killed.
free -m total used free shared buff/cache availableMem: 3936 912 2210 12 813 2780Swap: 0 0 0- available is the column that matters. It is how much memory apps can still get.
- buff/cache is memory Linux borrows to speed up file reading. It gives it back instantly when apps need it. So a small free number is normal and healthy.
- Swap is disk space used as extra memory when RAM is full. Disk is far slower than RAM, so heavy swap use makes everything slow.
Remember it: Ignore "free". Read "available".
When memory truly runs out: Linux's OOM killer (Out Of Memory killer) stops a process to save the rest of the system. You see it in the kernel log:
journalctl -k | grep -i "out of memory"# Out of memory: Killed process 2211 (java) total-vm:... anon-rss:...In Kubernetes, the same thing shows up as a pod restart with the reason OOMKilled.
Where is CPU time going? top and vmstat
The %Cpu(s) line in top splits CPU time into types.
It tells you what kind of busy the CPU is, which points to the cause.
| Field | Meaning | If it is high |
|---|---|---|
us | User programs (your apps) | Your app is busy: look at the app |
sy | System (the kernel) | Lots of low-level system work |
wa | Waiting for disk | The disk is the bottleneck |
id | Idle | Spare capacity |
st | Stolen by the cloud host | Another customer on the same cloud machine is using it: consider a bigger instance |
vmstat 1 5procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 1 0 0 2263040 120400 712600 0 0 3 11 210 402 3 1 96 0 0vmstat 1 5 prints one line every second, five times. Watch these columns:
r: processes waiting for CPU. More than your core count = CPU pressure.b: processes stuck waiting for disk.si/so: swapping in and out. These should be 0.wa: waiting for disk.
The 60-second checklist
👉 The moment someone says "the server is slow". Run these in order:
uptimefree -mvmstat 1 5df -hps auxuptime # 1. load vs. coresfree -m # 2. available memory, swapvmstat 1 5 # 3. CPU split, IO wait, swappingiostat -xz 1 3 # 4. disk utilization and latency (sysstat package)df -h # 5. full disksps aux --sort=-%cpu | head # 6. top CPU usersps aux --sort=-%mem | head # 7. top memory usersss -s # 8. connection countsjournalctl -p err --since -1h # 9. recent errorsThen match what you see:
| What you see | Likely cause |
|---|---|
High load, high us | The app is using lots of CPU |
High load, high wa | Slow or overloaded disk |
| Low available memory, swapping | Not enough memory, or a memory leak |
| OOM messages | Out of memory: raise limits or fix the leak |
High st | The cloud machine is starved by its host |
Limits and cgroups
cgroups are a Linux feature that caps how much CPU and memory a program may use.
👉 Every Docker container and Kubernetes pod uses them.
docker run --memory 512m --cpus 1 app:1.0# Kubernetes: resources.limits.memory: 512MiA container that goes over its memory limit is OOM-killed, even if the machine has free memory. Many "random restarts" are just limits set too low.
Real-world scenario: slow API after a deploy
Response times doubled after this morning's deploy. You run the checklist:
uptimefree -m- Load is 7 on a 4-core machine → overloaded.
- Available memory is low and swap is rising → memory pressure.
ps aux --sort=-%memshows the Java app using far more memory than yesterday.
Conclusion: the new release leaks memory or has its memory set too high. Roll back first, investigate second.
Common mistakes
- Panicking about low "free" memory. Look at available. Linux uses spare RAM for cache on purpose.
- Reading load without the core count. A load of 8 is fine on 16 cores and terrible on 2.
- Restarting before collecting clues. Save the output of
top,freeand the logs first, or the evidence disappears.
Practice
- Read the load average and say whether a 2-core server is overloaded.
- From
free -m, find how much memory apps can still use. - Run
vmstat 1 5and find the disk-wait column. - Write down the 60-second checklist from memory.
Cheat sheet
| Command | What it shows |
|---|---|
uptime | Load averages |
nproc | Number of CPU cores |
free -m | Memory and swap |
vmstat 1 5 | CPU split, swap, disk wait over time |
top | Live processes and CPU breakdown |
iostat -xz 1 | How busy and slow the disks are |
journalctl -k | Kernel messages, including OOM kills |
Key takeaways
- A slow server is slow because of CPU, memory, disk or network. Find which one.
- Load average only makes sense next to the number of CPU cores.
- For memory, read the "available" column, not "free".
- When memory runs out, Linux kills a program (OOM kill).
- Run the 60-second checklist before you restart anything.