KatInterview

Diagnosing a Host Overloaded by Excessive Logging

System DesignModel answer
EasyModel answerSystem Designloggingobservabilityincident-response

Last updated

Walk through how you would find out whether logging is exhausting a server, restore service safely, and put guardrails in place so the problem cannot return.

You are on call for a service whose host is struggling, and there are signs that logging is part of the problem. Latency is climbing, and some requests are timing out.

Describe how you would handle this from start to finish:

  1. Diagnose. How do you work out which resource is actually saturated, and whether logging is the cause or only a bystander?
  2. Stabilize. What can you safely do right now to restore service without losing data you may need?
  3. Prevent. What changes to the logging pipeline and its configuration would keep this from happening again?
  4. Verify. How do you confirm that the fix worked and that the underlying trigger was addressed, not just the symptom?

The report does not say whether the bottleneck is CPU, memory, disk space, disk bandwidth, or a downstream logging sink such as a remote collector. Part of your answer should be how you tell these apart before you change anything.

Some questions you may want to answer or ask yourself:

  • Which resource is exhausted?
  • Did log volume change recently, for example after a deploy, a config change, or a traffic shift?
  • Are application threads blocked on a slow sink, or is an unbounded in-memory queue growing?
  • Which logs are needed for debugging or audit, and which can be dropped or sampled?

Hints

Hint 1

Start by attributing the saturation: check CPU, memory, disk space, disk I/O and network per process before you touch any logging setting.

Hint 2

Separate the producer side (how many lines per second, and from where) from the sink side (local file, agent, remote collector). A slow sink can block producers or make an in-memory buffer grow.

Hint 3

Think about bounded behavior: bounded queues, a clear drop-or-block policy, rotation by size and age, retention limits, and rate limiting or sampling for repetitive lines.

Hint 4

A fix is only proven when the metric that was saturated returns to normal under comparable load and you know why volume spiked in the first place.