Diagnose Memory Growth in a Long-Running Process
Design the observability, investigation, containment, and verification path for a process whose memory grows from roughly 100 MB to 50 GB.
Problem statement
For this exercise, assume a long-running production process begins near 100 MB and can grow toward 50 GB over a workday according to one consistently sampled total process-memory measure; candidates must state which platform measure they use and its blind spots.
Known configured application-cache retention has been ruled out, while operating-system or file-backed cache, memory mappings, allocator retention, buffers, and other resource growth remain possible unless measured.
Design a memory-observability and incident-response system that distinguishes managed-heap growth from native or off-heap allocations, memory mappings, retained buffers, and leaked resources; correlates growth with requests, workload classes, deployments, and configuration versions; captures bounded diagnostic evidence; and contains the incident safely.
Assume the process handles 2,000 requests per second, sustained abnormal growth must be detected within 5 minutes, continuous instrumentation overhead must stay below 3 percent, detailed diagnostic profiles are retained for 24 hours, and aggregates are retained for seven days.
Diagnostic evidence must exclude raw user payloads and secrets. A restart or drain must not silently lose accepted work, and missing telemetry must be shown as unknown rather than healthy.
What to build
- Define one consistent total process-memory measure and attribute its growth across managed heap, native or off-heap memory, mappings, caches, buffers, and retained resources.
- Correlate memory growth with workload classes, request cohorts, deployments, configurations, and resource lifecycles.
- Capture bounded snapshots, profiles, and resource-count evidence without exposing sensitive payloads or destabilizing the process.
- Drain, restart, roll back, or isolate affected instances without silently losing accepted work, then verify that memory remains bounded.
At scale
- For this exercise, assume 2,000 requests per second and a consistently measured total process-memory footprint that starts near 100 MB but can grow toward 50 GB over one workday.
- For this exercise, detect sustained abnormal growth within 5 minutes while keeping continuous diagnostic overhead below 3 percent.
- For this exercise, retain detailed profiles for 24 hours and privacy-safe memory and resource aggregates for seven days.