← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
← Back to glossary

Linux Performance Tools

Linux Intermediate
debt(d7/e3/b3/t5)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). The detection_hints list htop, iotop, nethogs, vmstat, perf, sar as tools, but the specific misuse pattern — ignoring IO wait, missing disk saturation, skipping strace for hung processes — only surfaces during careful operational review or when users report slowness. The tools themselves are detectable but knowing which tool is missing from your analysis requires human judgment during an incident or code review of runbooks.

e3 Effort Remediation debt — work required to fix once spotted

Closest to 'simple parameterised fix' (e3). The quick_fix describes a straightforward substitution pattern: swap or add htop, iotop, nethogs, vmstat as appropriate. This is more than a one-line patch (you need to identify the bottleneck type and apply the correct tool combination) but is well within a single session of work without touching multiple files or architectural concerns.

b3 Burden Structural debt — long-term weight of choosing wrong

Closest to 'localised tax' (b3). The applies_to contexts are web and cli, and the tags indicate devops/debugging scope. The burden is primarily on operators and on-call engineers who must know the toolset, but it doesn't impose a persistent codebase-wide tax. It affects diagnostic and runbook practice rather than every future code change.

t5 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'notable trap' (t5). The misconception is explicitly documented: developers assume top is sufficient, but it misses IO saturation, network bottlenecks, and blocking syscalls. The common_mistakes reinforce this — %iowait being confused with disk utilisation is a well-known documented gotcha that most developers eventually learn, placing this squarely at the 'documented gotcha most devs eventually learn' anchor.

About DEBT scoring →

Also Known As

strace perf iostat htop vmstat ltrace

TL;DR

Essential tools for diagnosing CPU, memory, IO, and network performance on Linux — top, htop, vmstat, iostat, perf, strace, and ltrace.

Explanation

CPU: top / htop (real-time process stats), mpstat (per-CPU stats), perf top (CPU profiling by function). Memory: free -h (overview), vmstat -s (detailed), smem (per-process). Disk IO: iostat -x (saturation and utilisation), iotop (per-process IO). Network: nethogs (per-process bandwidth), iftop (per-connection traffic), ss -s (socket summary). Tracing: strace -p PID (system calls made by a process — what is it doing?), ltrace (library calls). For PHP: strace on a stuck PHP-FPM worker shows exactly which system call it's blocked on.

Common Misconception

top is the only tool needed for performance analysis — top shows CPU and memory snapshot but misses: disk IO saturation, network bottlenecks, and which specific system calls are blocking — iostat, nethogs, and strace fill these gaps.

Why It Matters

A slow PHP response that looks fine in CPU and memory metrics may be blocked on a slow NFS mount or disk IO — strace shows exactly which read() or write() call is taking seconds.

Common Mistakes

  • Only looking at CPU usage — IO wait shows as CPU idle but means processes are blocked on disk.
  • Not knowing strace -p for live process inspection — invaluable for hung process diagnosis.
  • Running strace in production on a busy process — overhead can be 10-100x; use carefully.
  • Confusing %iowait (CPU waiting for IO) with disk utilisation — %iowait doesn't directly show disk saturation.

Code Examples

✗ Vulnerable
# Performance analysis by guesswork:
# 'The server is slow'
# Restart PHP-FPM (sometimes works, doesn't fix root cause)
# Check top: CPU 30% — nothing obvious
# Give up, ticket to sysadmin
# Hours wasted
✓ Fixed
# Systematic performance investigation:
# 1. CPU and load:
htop           # Real-time, with color
mpstat 1 5     # Per-CPU every second for 5 seconds

# 2. Memory:
free -h        # Quick overview
vmstat 1 5     # Including swap activity

# 3. Disk IO:
iostat -x 1 5  # Is any disk at 100% util?
iotop          # Which process is using IO?

# 4. What is a stuck PHP-FPM worker doing?
strace -p $(pgrep php-fpm | head -1) -e trace=network,file -T
# Shows: connect() to DB taking 3.5 seconds — DB is the bottleneck!

Added 16 Mar 2026
Edited 22 Mar 2026
Views 65
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
1 ping T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 1 ping T 2 pings F 1 ping S 2 pings S 0 pings M 1 ping T 2 pings W 0 pings T 0 pings F 0 pings S 0 pings S 1 ping M 0 pings T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W
No pings yet today
No pings yesterday
Amazonbot 15 Scrapy 7 Ahrefs 5 Perplexity 5 ChatGPT 4 Unknown AI 3 Google 3 Claude 2 Bing 2 Majestic 1 Meta AI 1 Sogou 1
crawler 45 crawler_json 4
DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: Medium
⚡ Quick Fix
Use htop for process monitoring, iotop for disk I/O, nethogs for per-process network, and vmstat 1 5 for overall system health — these identify whether PHP, DB, or OS is the bottleneck
📦 Applies To
any web cli
🔗 Prerequisites
🔍 Detection Hints
Performance issue without identifying whether CPU IO or memory bound; no system-level metrics alongside PHP-level metrics
Auto-detectable: ✓ Yes htop iotop nethogs vmstat perf sar
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: Medium Context: File


✓ schema.org compliant