# Performance and Troubleshooting

> Diagnose slow or unhealthy machines methodically by checking CPU, memory, disk I/O and network with the right tools. Free notes, key concepts, resources and a...

Canonical: https://www.internhack.in/roadmaps/tracks/devops/linux-performance
Last updated: 2026-11-28

Diagnose slow or unhealthy machines methodically by checking CPU, memory, disk I/O and network with the right tools.

Intermediate · about 8 hours · difficulty 3/5

Learn first: [Processes, Signals and Resources](https://www.internhack.in/roadmaps/tracks/devops/processes-signals), [Filesystems, Disks and Storage](https://www.internhack.in/roadmaps/tracks/devops/filesystems-storage)

When a server is slow, guessing wastes time. Use a method: check **utilisation, saturation and errors** (the USE method) for each resource: CPU, memory, disk and network.

### The first-minute checklist

- `uptime`: load averages (compare with CPU count).
- `top`/`htop`: which process is hot; watch `%wa` (I/O wait) and `st` (steal time on VMs).
- `free -m` and `vmstat 1`: memory pressure, swapping, run queue.
- `iostat -xz 1`: disk utilisation and latency.
- `ss -tulpn` and `sar -n DEV 1`: sockets and network throughput.
- `dmesg -T`: kernel messages such as the **OOM killer** or disk errors.

### Going deeper

`strace` shows the system calls a process makes (great for "why is it hanging?"), `perf` profiles CPU usage, and eBPF tools (`bcc`, `bpftrace`) answer precise questions with low overhead.

### Pitfalls

Treating load average as CPU percentage, assuming "free memory is low" is a problem (Linux uses spare RAM for cache), and restarting the box before capturing evidence.

**Good enough to move on:** given a slow VM, you can tell within five minutes whether the bottleneck is CPU, memory, disk or network, and which process causes it.

## Key concepts

- **USE method**
- **Load average and CPU**
- **Memory, cache and OOM killer**
- **Disk I/O with iostat**
- **vmstat, sar, ss**
- **strace**
- **perf and flame graphs**
- **eBPF tools**

## Mini project

Use stress-ng to create CPU, memory and I/O pressure on a VM one at a time, and for each run record which tool revealed the problem first and what the key numbers looked like.

## Check yourself

A 4-core machine shows a load average of 12 but CPU usage is only 20%. What is probably happening?

## Free resources

- [Linux Performance](https://www.brendangregg.com/linuxperf.html) (Brendan Gregg)
- [The USE Method](https://www.brendangregg.com/usemethod.html) (Brendan Gregg)

Previous: [Services with systemd](https://www.internhack.in/roadmaps/tracks/devops/systemd-services) · Next: [Shell Scripting for Ops](https://www.internhack.in/roadmaps/tracks/devops/shell-scripting)

## More in Living on Linux

- [Linux Command Line and Packages](https://www.internhack.in/roadmaps/tracks/devops/linux-basics)
- [Processes, Signals and Resources](https://www.internhack.in/roadmaps/tracks/devops/processes-signals)
- [Filesystems, Disks and Storage](https://www.internhack.in/roadmaps/tracks/devops/filesystems-storage)
- [Users, Groups and Permissions](https://www.internhack.in/roadmaps/tracks/devops/users-permissions)
- [Services with systemd](https://www.internhack.in/roadmaps/tracks/devops/systemd-services)
- [Performance and Troubleshooting](https://www.internhack.in/roadmaps/tracks/devops/linux-performance)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [DevOps Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/devops)
