Scrivio Interview library
LeadershipPrincipal7 min read · updated 12 November 2026

As the senior technical leader, you must set a company-wide policy for Kubernetes resource requests and limits and JVM sizing for 1,500 Java services. Teams argue for large safety margins; finance wants high utilisation. How do you set and govern the policy?

I would set the policy from data: actual CPU and memory usage per service against requests, plus OOMKilled and CPU throttling rates. The defaults would be a memory limit equal to the memory request, the heap sized as a percentage of that limit with MaxRAMPercentage, CPU requests from measured usage and CPU limits only where there is a reason. Exceptions are allowed with a written reason and a review date, cost is shown per service and team, and the whole policy is tied to SLOs and rolled out with monitoring so right-sizing never breaks reliability.

Why this question is asked

With 1,500 services, nobody can hand-tune resources one by one, and arguments between teams and finance will go on forever without a shared rule. Interviewers ask this question to see whether a senior leader can turn a conflict between safety and cost into a policy that is based on evidence, simple to follow, enforced by tooling and fair to both sides. In this answer, we will look at the data the policy rests on, the default values and the reason for each, how exceptions work, how cost visibility changes behaviour, and how SLOs and monitoring keep the policy honest.

1Understanding Both Sides of the Argument

Teams that ask for big margins are not being careless. They have been paged at 3 a.m. for an OOM kill, and the cheapest insurance they control is a bigger request. Finance is not wrong either: if utilisation is 25 percent, three quarters of the compute bill buys nothing. The problem is that neither side can see the other's risk. A good policy gives both sides the same numbers, so the discussion is about evidence, not opinion.

A request is what the scheduler reserves and what we pay for. A limit is the ceiling the kernel enforces: for memory, going over it kills the container, and for CPU, going over it throttles the container. The policy has to set both, plus the JVM settings that decide how much of the memory the heap may take.

2Starting From Data, Not Opinions

Before writing any rule, the platform team collects, for every service, CPU and memory usage at p95 and peak against requests, the rate of OOMKilled restarts and the share of throttled CPU periods. This gives two lists. The first is services with large gaps between request and use, where money is wasted. The second is services that are already too tight, with OOM kills or throttling, where reliability is at risk. A policy that only cuts would ignore the second list, and teams would rightly distrust it. Publishing both lists shows that the policy is about correct sizing, in both directions.

3The Default Settings and Why Each One Exists

Memory limit equal to memory request. Memory cannot be taken back from a running process, so if the node runs short, pods using more than their request are the first to be evicted or killed. Setting limit equal to request gives predictable behaviour and makes the request honest.

Heap as a percentage of the limit. With -XX:MaxRAMPercentage=75 the JVM reads the container limit at startup and sizes the heap from it, leaving about a quarter for metaspace, thread stacks, the code cache and direct buffers. When a team changes the memory limit, the heap follows automatically. Fixed -Xmx values are banned in the default chart, because they are the main way a heap outgrows its container.

CPU request from measured usage, CPU limit only where justified. CPU is compressible: without a limit, a pod can use idle CPU on its node, while its request still guarantees its share under contention. Tight CPU limits throttle multi-threaded JVMs in bursts and cause latency spikes, and they also make the JVM see fewer processors. So the default is a CPU request from p95 usage and no CPU limit, with limits used where there is a real reason, such as noisy batch jobs or tenant isolation.

Java
# Default values in the shared Helm chart (teams override with an exception)
resources:
requests: { cpu: "{{ .Values.measured.cpuP95 }}", memory: "{{ .Values.memory }}" }
limits: { memory: "{{ .Values.memory }}" } # equal to request; no CPU limit
env:
- name: JAVA_TOOL_OPTIONS
value: "-XX:MaxRAMPercentage=75 -XX:+ExitOnOutOfMemoryError"
Policy defaults at a glance
SettingDefaultReason
Memory requestp95 working set plus 20 to 30% marginHonest reservation with room for spikes
Memory limitEqual to requestPredictable, no surprise evictions
HeapMaxRAMPercentage=75Follows the limit; room for non-heap memory
CPU requestp95 usageFair share under contention
CPU limitNone unless justifiedAvoids burst throttling of JVM threads

4Exceptions With Reasons and Review Dates

Some services really need more: a search service holding a large in-memory index, or a batch job with a known month-end peak. The policy allows exceptions, but each one is a small record in the service's repository with the reason, the owner and a review date, typically six months away. When the date passes, the exception is flagged in the team's report until someone reviews it. This keeps the door open for real needs while preventing the slow drift where every service becomes an exception forever.

Admission control enforces the defaults. A policy engine such as Kyverno or OPA Gatekeeper can reject deployments without requests, warn on fixed -Xmx values and require an exception annotation for a CPU limit or a memory request far above measured usage. Tooling is how a rule reaches 1,500 services without 1,500 meetings.

5Showing Cost per Service and Team

Every month each team sees the cost of its requests, the cost of what it used, and the idle share, alongside its OOM and throttling numbers. When a team sees that a 3x safety margin costs, for example, 40,000 dollars a year, the margin becomes a business decision the team owns rather than an invisible habit. Finance gets the same view across the company, so the conversation moves from blaming platform to helping specific teams.

6Tying the Policy to SLOs and Rolling It Out Safely

The policy says plainly that right-sizing must not break latency or availability targets. If a service misses its SLO after a change, the change is rolled back first and discussed later. That rule is what makes teams willing to accept smaller margins.

Rollout follows the same logic. New services get the defaults from day one through the golden path chart. Existing services move in waves, largest waste first, with dashboards watching p99 latency, throttled CPU periods, OOMKilled restarts and GC time for two weeks after each change. We review the policy itself twice a year with the data, adjusting the margins if, for example, OOM kills rose after a wave.

Step throughGoverning a change under the policy
  1. Measure usage and failuresrequests, p95, peak, OOM, throttling
  2. Apply defaults via chartadmission control checks
  3. Needs more than the default?
    YesException with reason and review dateNoKeep the defaults
  4. Watch SLOs after rolloutp99, errors, OOMKilled
  5. SLO still met?
    YesReport the saving per teamNoRoll back, then resize

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

7Follow-up questions

Why not set CPU limits everywhere to protect nodes?

Requests already protect each pod's fair share when the node is busy. Limits add throttling in bursts, which hurts JVM latency and wastes idle capacity. We keep limits for workloads with a real reason to cap them and rely on requests for fairness everywhere else.

How much margin should the memory request carry?

Enough to cover the gap between p95 and observed peak plus some growth, often 20 to 30 percent over the p95 working set. The data from OOMKilled rates tells us if the margin is too thin, and we adjust the policy rather than individual services.

How do you handle teams that resist?

With the same data for everyone, a clear exception path and the SLO guarantee. Most resistance is fear of outages; showing that rollback is fast and that SLOs come first answers it better than an escalation.

What about services that use the VPA?

VPA in recommendation mode feeds the measured values into the chart. Automatic VPA updates can be allowed for stateless services with enough replicas, as long as they respect the same rules, such as memory limit equal to request.

8Conclusion

In this answer, we saw how to set a company-wide policy that both teams and finance can accept. It rests on data about usage, OOM kills and throttling, sets defaults with a clear reason each (memory limit equal to request, heap as a percentage of the limit, CPU requests from usage and CPU limits only where justified), allows exceptions with reasons and review dates, shows cost per team and is tied to SLOs, with admission control and staged rollout keeping it in force.

What to say in the interviewAbout 90 seconds aloud

Open with

I would make the policy about correct sizing, not cost cutting, and base it on data. First the platform team measures, for all 1,500 services, CPU and memory usage at p95 and peak against requests, plus OOMKilled and throttling rates, and publishes both the wasteful list and the too-tight list.

Then, if they want more

Then the defaults, each with a reason. Memory limit equals memory request, because memory cannot be reclaimed and we want predictable behaviour. The heap is a percentage of that limit through MaxRAMPercentage, around 75, and fixed -Xmx values go away, so the heap always fits the container.

CPU requests come from measured usage, and CPU limits are only used where there is a reason, because limits throttle JVM threads in bursts. These defaults live in the golden path Helm chart and are checked by admission control. Teams can get exceptions, but each needs a written reason and a review date, so it does not become permanent.

Every team sees the monthly cost of its requests and its idle share, so the price of a big margin is visible. And the policy is tied to SLOs: if a right-sizing change breaks latency or availability, we roll it back first. Rollout is in waves with monitoring, and we review the policy itself every six months.

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.
Official documentation
Kubernetes documentation
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 "As the senior technical leader, you must set a company-wide policy for Kubernetes...": https://scrivio-interview-library.netlify.app/spring-boot/containers-and-kubernetes/05d5bb813a/