Scrivio Interview library
LeadershipPrincipal6 min read · updated 12 November 2026

Looking back at ten years of memory-related production incidents in a large Java organisation, which organisational practices reduce their frequency and impact more than individual expert debugging?

The practices that help most are the ones that make memory problems visible early and diagnosable by anyone: classify every memory incident by type and track the trends, ship a standard runtime profile with exit on OOM, heap dumps, GC logging and memory metrics, alert on leading indicators such as heap after GC rising or RSS nearing the limit, run memory soak tests before major releases, train on-call engineers with runbooks and practice, and give each service a memory budget with an owner. Expert debugging fixes one incident; these practices change how many happen and how much they hurt.

Why this question is asked

In a large Java organisation, memory incidents follow patterns. The same kinds of leaks, the same container limits and the same missing heap dumps appear again and again in different services. A few experts get called into each one, solve it brilliantly, and the organisation learns very little. Interviewers ask this question at the most senior levels to see whether we can step back from individual debugging and think in systems: what makes incidents rarer, and what makes the remaining ones shorter. In this answer, we will look at why expert debugging does not scale, then go through six practices with the reasoning behind each, and finish with how to measure whether they work.

1Why Expert Debugging Does Not Scale

An expert who can open a 20 GB heap dump and find a leak in an hour is valuable. But in an organisation with 400 services and 60 teams, that expert sees each problem only after it has already caused an outage, often at night, and often without the data they need because nobody captured it. The knowledge stays in their head. The next team makes the same mistake six months later.

Looking back over ten years, the incidents that hurt most were rarely the hardest to debug. They were the ones that had no heap dump, no GC logs, no alert until customers complained, and no one on call who knew where to start. So the leverage is in prevention, detection and preparation, and that is what the practices below target.

2Practice 1: Classify Incidents and Track Trends

Every memory incident gets a type in the post-incident review: Java heap leak, legitimate heap growth, native memory growth, container OOM kill, metaspace or class loader leak, thread explosion, direct buffer exhaustion. We also record the root cause category, such as unbounded cache, high-cardinality metrics, ThreadLocal not removed, or heap percentage too high for the container.

The reasoning is that we cannot prioritise what we do not count. After a year, the data usually shows that a few causes dominate. If 40 percent of incidents are container OOM kills from a too-high heap percentage, the fix is a platform default, not more training on heap dumps.

Example classification after one year
Incident typeCountMost common causeOrganisational fix
Container OOM kill14heap at 80% of limit, no room for nativeplatform default of 65%
Heap leak9unbounded caches, metric tagscache library with bounds, tag review
Native growth5direct buffers, thread poolsMaxDirectMemorySize default, pool limits
Metaspace2runtime class generationreview of codegen libraries
Counting incidents by type shows where a platform change prevents the most incidents.

3Practice 2: A Standard Runtime Profile in Every Service

The platform team ships a base image or starter that every service uses, containing the agreed JVM settings: exit on OutOfMemoryError, heap dump on OOM to a persistent and secured location, rotated GC logging, a continuous JFR recording, a heap percentage suited to containers, and a standard set of memory metrics such as heap after GC, metaspace, thread count, direct buffer usage and RSS.

This removes the most common reason incidents take long: missing data. When every service has the same settings, a heap dump exists after every Java OOM, and the dashboards look the same everywhere, so an engineer from another team can read them. It also turns lessons into defaults. When one incident teaches us something, we change the profile once and every service benefits.

4Practice 3: Alert on Leading Indicators

Most memory incidents announce themselves hours or days in advance. A leak shows as heap occupancy after GC rising steadily; native growth shows as RSS approaching the container limit; thread leaks show as thread count climbing. We alert on these trends, not just on the final crash, for example when post-GC heap has risen by more than 20 percent over 24 hours, or RSS is above 90 percent of the limit for 30 minutes.

The reasoning is time. An alert two days before the OOM lets the owning team take a heap dump during working hours, calmly, from a pod still serving traffic. An alert at the crash gives them a restart loop at 3 a.m.

5Practice 4: Memory Soak Tests Before Major Releases

Many leaks grow slowly, 50 MB per hour for example, and are invisible in a ten-minute load test. A soak test runs the service under realistic, varied load for many hours, typically 12 to 24, and checks that heap after GC, RSS and thread count are flat at the end. We run it for major releases and for changes to caching, metrics, connection handling or frameworks.

It costs some test infrastructure and patience, but it catches exactly the class of incident that otherwise shows up days after a release, when nobody connects it to the change.

6Practice 5: Train On-Call Engineers, Not Just Experts

Runbooks describe the standard steps for each incident type: how to confirm an OOM kill, how to take a class histogram, how to dump a JFR recording, where dumps are stored and how to open them. Practice sessions, often called game days, give on-call engineers a recorded incident or a deliberately broken test service and let them diagnose it with the runbook while an expert watches.

The reasoning is that knowledge only spreads by use. An engineer who has opened a heap dump once in a calm session will do it in an incident; one who has only read about it will call the expert. Over time the experts move from fixing incidents to improving the runbooks and tools.

7Practice 6: A Memory Budget and an Owner for Each Service

Each service has a documented memory budget, its container limit, expected heap and native footprint, and a named owner who reviews it every quarter or after major changes. The review compares actual usage with the budget, checks headroom and looks at trends. This makes memory a designed property of the service rather than a number someone copied from another deployment file.

To know whether all this works, we measure at the organisation level: the number of memory incidents per quarter, the share that had a dump or recording available, time from alert to root cause, and the share of incidents caught by leading-indicator alerts before a crash. If those numbers improve, the practices are working; if not, the classification from practice 1 tells us where to look.

Step throughThe improvement loop
  1. Incident happens
  2. Classify type and causepractice 1
  3. Seen this cause before?
    YesChange the platform defaultNoAdd to runbooks and training
  4. Update profile, alerts, soak tests
  5. Measure incidents per quarterand time to root cause

5 steps in order. Play them, or step through them one at a time.

8Follow-up questions

How do you get 60 teams to adopt a standard runtime profile?

By making it the easiest path: it comes with the base image or starter they already use, it is documented, and opting out requires a short written reason. We show its value with incidents it shortened. Mandating it without making it easy usually leads to copies that drift.

Do soak tests not take too long for continuous delivery?

They do not need to block every deployment. We run them nightly or before major releases, against the latest build, and treat a failure as a release blocker for the next major version. Small changes ship as usual, and the nightly run catches slow leaks within a day.

9Conclusion

In this answer, we looked at memory incidents across a large organisation and why expert debugging alone does not reduce them. The practices that do are classifying incidents and tracking trends, shipping a standard runtime profile with exit on OOM, heap dumps, GC logging and memory metrics, alerting on leading indicators such as post-GC heap and RSS trends, running memory soak tests before major releases, training on-call engineers with runbooks and practice sessions, and giving each service a memory budget with an owner. Together they make incidents rarer, earlier and shorter.

What to say in the interviewAbout 90 seconds aloud

Open with

Looking back, the incidents that hurt most were not the hardest to debug; they were the ones with no heap dump, no alert until customers noticed, and no one on call who knew where to start.

Then, if they want more

So I would invest in practices rather than heroes. First, classify every memory incident by type, heap leak, native growth, container OOM kill, metaspace, and by cause, and track the trend, because often a few causes dominate and one platform default fixes them.

Second, ship a standard runtime profile in the base image: exit on OOM, heap dump to a secured path, GC logging, continuous JFR, a sensible heap percentage and standard memory metrics, so the data always exists and every dashboard looks the same.

Third, alert on leading indicators, heap after GC rising over a day or RSS near the container limit, so teams investigate during working hours instead of at the crash. Fourth, run 12 to 24 hour memory soak tests before major releases, since slow leaks never show in short load tests.

Fifth, train on-call engineers with runbooks and practice sessions so knowledge is not held by a few experts. And sixth, give each service a memory budget and an owner who reviews it. I would measure success by incidents per quarter and time to root cause.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Looking back at ten years of memory-related production incidents in a large Java...": https://scrivio-interview-library.netlify.app/java/jvm-diagnostics/56bbd07f9c/