Menu

Why Kubernetes 1.35 resizePolicy: RestartContainer Isn't Required for ZGC/Shenandoah
πŸ“°

Why Kubernetes 1.35 resizePolicy: RestartContainer Isn't Required for ZGC/Shenandoah

DEV Community: javaΒ·BaoKhangΒ·3 days ago
#eNs1LtqU
#devtojava#devto#dev#memory#limit
Reading 0:00
15s threshold

Why Kubernetes 1.35 resizePolicy: RestartContainer Isn't Required for ZGC/Shenandoah

A lot of current advice says to set resizePolicy: RestartContainer for memory on every JVM container. For growing the heap ceiling, that advice is right. For shrinking and regrowing within a ceiling you chose at launch, I tested ZGC and Shenandoah in a Linux container and found a restart isn't needed, as long as the JVM releases memory before the limit drops.

The short version

Kubernetes 1.35 can change a running container's memory in place (the pods/resize subresource is GA).

A JVM fixes its maximum heap at startup. Raising the limit in place does not raise the heap. Two popular articles are right about this.

That does not mean every memory change needs a restart. Three different operations hide inside "resize memory", and only one of them requires it.

On ZGC and Shenandoah you can lower and raise the heap's soft ceiling at runtime.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.