← Questions

Troubleshoot high CPU, slow responses and DNS failures

0
GoogleCodingLast asked Sep 2025

A coding interview question asked in Google's onsite coding round, last asked Sep 2025. It tests debugging, linux and networking.

Three troubleshooting scenarios on Linux production hosts. For each, explain step by step what you check, which commands you run, what the output would tell you, and what you would do next.

Part 1: CPU suddenly spikes

A server's CPU usage jumps. Which immediate checks do you run (top or htop, pidstat, vmstat, mpstat, iostat, perf)? How do you find the hot process and thread, and tell whether the time is user CPU, kernel CPU, or I/O wait? What are the next steps and the remediations?

Part 2: a service is slow

A service shows high latency. How do you use ss or netstat, tcpdump, and traceroute or mtr to tell whether the problem is in the client, the server or the network? Which signals do you look for: SYN backlog overflows, retransmissions, round-trip times, drops, connection states?

Part 3: DNS

Walk through how a name is resolved: the stub resolver, /etc/resolv.conf and the local cache, the recursive resolver, the root, TLD and authoritative servers, caching and TTLs, negative caching. Then explain the practical differences between dig and nslookup, when you would reach for each, and give example commands for debugging a failing lookup.

Clarifying questions

  • Did anything change recently (a deploy, a config change, traffic growth)?
  • Is the problem on one host or on all of them, and constant or intermittent?
  • Are these containers or VMs, with limits that could throttle the CPU?
  • Is the latency on every endpoint or only some?

What a strong answer covers

  • CPU: load average against core count; us, sy, wa, st in top or mpstat; pidstat -t or top -H for threads; perf top or a flame graph for the hot code path; iostat -x for disk saturation; cgroup throttling. Remediation from rolling back the deploy to adding capacity.
  • Latency: a method that splits the request path in half. ss -s and ss -ltn for listen queue overflows; netstat -s for retransmits; tcpdump timestamps to separate network delay from server processing; mtr to find the hop where loss starts. Server-side checks: thread pool saturation, GC pauses, slow dependencies.
  • DNS: the full resolution path and where caching happens; dig +trace, dig @server name, checking TTLs and SERVFAIL against NXDOMAIN; why dig is preferred for debugging (raw answers, chosen server, flags) and nslookup is everywhere, including Windows.
  • A calm order of operations: confirm the symptom, limit the blast radius, find the cause, fix it, then write it up.

Follow-ups

  • CPU is high but every process looks idle. What could it be (steal time, kernel threads, interrupts)?
  • Lookups fail for one in every few requests. What would you suspect?
  • How would you build alerts so you hear about each of these before users do?

Where it's asked

  • Google · Onsite coding · Last asked Sep 202545 min · Usually two rounds, mostly in person: whiteboard plus a Chromebook with Google Docs · No AI (a pilot code-comprehension round lets candidates use Gemini)

What it tests

debugging · linux · networking

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding