KatInterview

Investigating High CPU Usage on a Linux System

System DesignModel answer
EasyModel answerSystem Designlinuxperformancedebugging

Last updated

Walk through the steps to identify and verify the cause of elevated CPU consumption on a Linux machine, from system-wide metrics to specific code paths.

You're operating a Linux system that's responding more slowly than usual, and initial observations show elevated CPU consumption. Walk through your investigation methodology to pinpoint what's consuming CPU resources and confirm whether it's the actual bottleneck affecting performance.

What to Cover

Explain your diagnostic approach from initial system inspection through identifying the specific process, thread, or function responsible. Describe how you'd verify that CPU is genuinely the limiting factor and not another resource constraint.

Important Considerations

  • High CPU utilization by itself doesn't prove a problem exists—relate resource consumption back to observable degradation in response time or request throughput
  • Consider whether load is distributed evenly or concentrated on specific cores
  • Determine if processes are actively computing, blocked on I/O, restricted by resource limits, or competing for shared resources
  • Account for containerized workloads if relevant

Hints

Hint 1

Start with system-wide visibility before drilling down to individual processes

Hint 2

Distinguish between time spent in application code versus kernel operations versus idle wait states

Hint 3

Use profiling tools to identify hot code paths once you've isolated the problematic process