Deep infrastructure troubleshooting: a method for when “it's slow” and nobody knows why
The USE method, 60-second Linux analysis, networking, Kubernetes, CPU throttling, conntrack, and eBPF: a roadmap for investigating infrastructure problems with data instead of guesswork.
SRE$ vmstat 1 5 && iostat -xz 1▍“The application is slow.” Few sentences trigger as much guesswork in an incident channel. It’s the database. It’s the network. It’s the last deploy. It’s Kubernetes. When everyone has a theory and nobody has data, time to recovery explodes.
Deep troubleshooting isn’t about knowing every command by heart — it’s about having a method that systematically narrows the search space. This guide collects the playbook we use to get from symptom to root cause.
Before the first command: define the problem
Spend two minutes answering, in writing:
- What exactly is wrong? High latency? Errors? On which endpoint, for which users?
- Since when? Start a timeline.
- What changed? Deploys, configuration changes, traffic increases, provider changes. Most incidents start with a change.
- What’s the scope? All nodes or one? One zone? One customer?
- How will we know it’s fixed? Which metric needs to return to normal.
This may seem like bureaucracy, but it avoids the most common trap: three people investigating three different problems while thinking it’s the same one.
The USE method: a checklist for every resource
Proposed by Brendan Gregg, the USE method says: for every resource (CPU, memory, disk, network, and also limits such as file descriptors and connections), check:
- Utilization: how much of the time the resource was busy;
- Saturation: how much work was left waiting in the queue;
- Errors: how many errors the resource reported.
For services, the complement is the RED method: Rate (request rate), Errors, and Duration (latency). Start with RED to find which service is unhealthy; use USE to find which resource is constraining that service.
The golden rule: saturation matters more than utilization. A disk at 70% utilization with an empty queue is doing great; one at 40% with a growing queue is already making requests wait.
The first 60 seconds on a Linux server
This sequence, popularized by Netflix’s performance team, gives you an overview in one minute:
uptime # load average: 1-, 5- and 15-minute trend
dmesg -T | tail # OOM killer, disk errors, network drops
vmstat 1 5 # CPU run queue, memory, swap, I/O
mpstat -P ALL 1 3 # per-core CPU (one core at 100% = single-thread bottleneck)
pidstat 1 3 # which processes are using CPU
iostat -xz 1 3 # disk latency and saturation
free -m # available memory and cache
sar -n DEV 1 3 # throughput per network interface
sar -n TCP,ETCP 1 3 # new connections and retransmits
top # overview to confirm
What to look for in each one:
vmstat: anrcolumn (processes waiting for CPU) higher than the number of cores indicates CPU saturation. Non-zerosi/soindicates swapping — almost always bad for latency. Highwapoints to I/O wait.iostat -xz:r_await/w_awaitshow average latency in milliseconds;aqu-szis the queue size;%utilnear 100% on a single disk means saturation (on SSDs and network volumes, look at latency and queue size more than%util).sar -n ETCP: a highretrans/sindicates packet loss or network congestion.dmesg: messages likeOut of memory: Killed processornf_conntrack: table full, dropping packetsolve many mysteries in seconds.
Network: break down the latency
When the problem looks like “the network,” break the request into stages. curl does this on its own:
curl -o /dev/null -s -w '\
dns: %{time_namelookup}s\n\
connect: %{time_connect}s\n\
tls: %{time_appconnect}s\n\
ttfb: %{time_starttransfer}s\n\
total: %{time_total}s\n' https://api.example.com/health
- Slow DNS → check the resolver, the cache, and (on Kubernetes)
ndots. - Slow connect → network, firewall, SYN backlog, or a full conntrack table.
- Slow TLS → handshake without session reuse, a long certificate chain, proxy CPU.
- High TTFB with a fast connection → the problem is on the server, not the network.
Other essential tools:
ss -s # socket summary (lots of TIME-WAIT? connection overflow?)
ss -tni dst 10.0.3.15 # RTT and retransmits per connection
dig +trace api.example.com # full DNS resolution path
mtr -rwc 50 10.0.3.15 # loss and latency hop by hop
Kubernetes: where the problem hides
Events and the container’s previous state
kubectl describe pod checkout-7d9f8b-x2x4q -n checkout # events, Last State, restart reason
kubectl get events -n checkout --sort-by=.lastTimestamp | tail -20
kubectl logs checkout-7d9f8b-x2x4q -n checkout --previous # logs from the container that died
Last State: Terminated, Reason: OOMKilled is the answer to many “random restarts.”
CPU throttling: the silent p99 latency killer
When a container has limits.cpu, the kernel (CFS) caps how much CPU time it can use in each 100 ms period. A service with short bursts can be paused in the middle of a request even when its average CPU usage is low — and p99 latency spikes without any CPU chart looking worrying.
Measure the proportion of throttled periods:
sum by (namespace, pod) (rate(container_cpu_cfs_throttled_periods_total{container!=""}[5m]))
/
sum by (namespace, pod) (rate(container_cpu_cfs_periods_total{container!=""}[5m]))
Values consistently above 20–25% on latency-sensitive services deserve attention. The usual fixes: raise the limit, match the runtime’s thread count to the actual limit (JVM, Go GOMAXPROCS, Node/Python workers), or, for critical workloads, consider removing limits.cpu while keeping well-sized requests.
DNS and ndots:5
By default, pods have ndots:5 in /etc/resolv.conf. This causes an external name like api.example.com to be tried first with each of the cluster’s search domains (api.example.com.checkout.svc.cluster.local, etc.), multiplying DNS queries. For services that call many external APIs, use fully qualified names (with a trailing dot) or tune dnsConfig.options on the pod.
Full conntrack table
High-traffic nodes (especially with kube-proxy in iptables mode) can exhaust the conntrack table. The symptom is intermittent loss of new connections:
dmesg -T | grep conntrack
sysctl net.netfilter.nf_conntrack_count net.netfilter.nf_conntrack_max
The limits nobody monitors
Many incidents aren’t about CPU or memory, but about forgotten limits:
df -h && df -i # space AND inodes (millions of small files exhaust inodes)
cat /proc/<pid>/limits | grep files # the process's file descriptor limit
ls /proc/<pid>/fd | wc -l # how many are in use
cat /proc/sys/fs/file-nr # descriptors across the whole system
Also add to the checklist: an exhausted database connection pool, load balancer connection limits, cloud provider API quotas, and ephemeral port exhaustion on proxies with many outbound connections.
When the basic tools aren’t enough: eBPF and profiling
If the metrics don’t show the bottleneck, it’s time to look inside the kernel and the process — carefully, in production.
perf top/perf recordshow which functions the CPU is spending time in; combined with flame graphs, they reveal code bottlenecks in minutes.- eBPF tools (BCC/bpftrace) have low overhead and answer specific questions:
biolatency— a histogram of disk latency;tcpretrans— every TCP retransmit, with source and destination;execsnoop— short-lived processes (scripts and health checks nobody knew existed);opensnoop— which files are being opened (and failing).
strace -c -p <pid>summarizes a process’s system calls, but has high overhead: use it for a few seconds and never leave it running in production.
For continuous profiling without manual effort, tools like Parca, Pyroscope (Grafana), and commercial APM profilers collect profiles all the time — so you can compare “before” and “after” the incident.
A real case (simplified)
Symptom: checkout p99 latency went from 300 ms to 2 s after a migration to Kubernetes. Average pod CPU: 35%.
- RED showed that only checkout was affected, and only at p99.
- No code deploy coincided with it; the change was the infrastructure migration.
- USE on the nodes: everything healthy.
- The throttling metric showed 60% of periods throttled.
- The runtime was configured with 8 worker threads in a container with
limits.cpu: 1— bursts of parallelism used up the quota within a few milliseconds and the container stayed paused for the rest of the period.
Fix: match the thread count to the limit and raise the limit to 2 CPUs. p99 went back to 280 ms. Preventive action: a throttling alert and a migration checklist that includes runtime configuration.
Discipline during the investigation
- Write everything down in a shared document: command, time, result. This becomes the postmortem timeline.
- One change at a time. Changing three things at once and watching the problem disappear teaches you nothing.
- Mitigate first, understand later. If a rollback fixes it, roll back — and investigate calmly afterward.
- Be wary of convenient correlations. “The chart went up at the same time” isn’t causation.
- Close the loop. Every investigation should end with something that makes the next diagnosis faster: a dashboard, an alert, a runbook, or more instrumentation.
A good troubleshooter isn’t the one who knows the answer. It’s the one who knows the next right question to ask — and can prove it with data.