Skip to main content

Java resource management

Cut Java memory waste without OOM kills.

LevelFour finds the JVMs on your clusters and reads each heap from the pod spec or, with the optional JVM reader, from the running JVM: the heap it may grow to, its live set and the memory it holds outside the heap. Then it sizes each Java pod to fit and ships the change, in place or as a pull request.

A Java container's memory request walking down in three steps from 8 GiB to its 4.65 GiB memory floor, above its 4 GiB heap maximum, then verified

JVM-aware by design

A JVM reserves memory up front and can grow its heap to -Xmx at any moment. Size a Java pod from last week's usage and the next busy hour ends in an OOM kill. LevelFour sizes every Java container from its heap, so no memory cut goes below what the JVM can claim: the heap maximum, plus 256 MiB and a tenth of the heap for everything outside it.

The JVM section of a workload in LevelFour with the JVM reader on: how its 8 GiB limit splits between live set, heap and memory outside the heap, two weeks of heap by day, and the JVM's JDK, collector and time in GC pauses

See inside every JVM

Turn on the optional JVM reader and each Java container shows its heap maximum, an upper bound on its live set, committed heap, memory outside the heap, time in GC pauses and JDK, day by day, next to its requests and limits. LevelFour also flags what wastes memory, such as a heap far above its live set or one left at the JVM's default 25% on a large limit.

A Java container hits its 2 GiB memory limit, two OOM kills, and the automation raises the limit 25% in place, with no OOM kill after

OOM kills fixed in place

After two OOM kills of a container within an hour, the automation gives the running pod up to 25% more memory, with no restart. The chart marks the raise, and the days after show whether it held.

The Automation tab running in two namespaces, with its pace, its window and the pods it resized in place

Rightsized in place, one step at a time

Where you turn automation on, LevelFour cuts a request by at most 20% a step on the running pods and stops at the memory floor. It never lowers a JVM's limits, and a pod that is OOM killed, evicted, restarts twice in an hour or stops being ready goes back on its own.

How the automation works
A LevelFour pull request on GitHub that lowers a workload's CPU and memory requests in its Helm values, with every check passed

Or as a pull request

Each change can ship as a pull request on the repository that deploys the workload, with the HPA or KEDA target moved in the same diff. Your pipeline applies it, and a week later LevelFour measures the saving on your bill.

How LevelFour sizes the JVM

The docs cover the memory floor, the CPU rules for older JDKs, what the agent reads from each container and the automation's guardrails.

Read the docs

Java resource management FAQ

See what LevelFour can save you