The 30 second answer
Not by itself. The number is real but the baseline matters: JVM heap settings, GC choice, framework, and whether they measured heap or container RSS. In that write-up, memory at rest fell from 494 Mi to 12 Mi, but peak only from 558 Mi to 78 Mi, about 7 times, and infrastructure was removed at the same time. Before rewriting, I'd tune the JVM and measure RSS, then decide.
What the reported numbers say. In the November 2026 write-up, memory at rest went from 494 Mi on Java to 12 Mi on Go, and peak memory from 558 Mi to 78 Mi. The memory request per pod dropped from 1,280 Mi to 128 Mi, pod start time went from 60 to 79 seconds down to 4 to 9 seconds, and a search cluster and a queue cluster were removed in the same move. So the 40x is the idle figure; the peak figure is about 7x; and part of the saving is architecture, not language. Commenters on the post pointed out that the JDK version, framework and JVM settings weren't stated.
Why an idle JVM looks big. RSS, the memory the container actually holds, is more than the Java heap. It includes metaspace for loaded classes, the code cache for JIT-compiled code, a stack for every thread, GC data structures and direct buffers. A framework that loads many classes and starts large thread pools pays for all of that even when idle. The heap also tends to stay committed after a load spike unless the GC returns it.
What to try on the JVM first.
- Measure the right thing. Compare container RSS under the same sustained load, not just heap or idle numbers. Use Native Memory Tracking (
-XX:NativeMemoryTracking=summaryandjcmd <pid> VM.native_memory summary) to see where non-heap memory goes. - Size the heap deliberately. By default the maximum heap is 25% of the memory available to the container (
MaxRAMPercentage); set-XmxorMaxRAMPercentageto what the service really needs. - Pick a GC for the size of the service. The JDK documentation calls the Serial collector "generally the best choice for small and simple applications". G1 can return unused committed memory to the OS when idle since JDK 12 (JEP 346, tuned with
G1PeriodicGCInterval). - Cut threads and classes. Smaller thread pools, or virtual threads, reduce stack memory; fewer framework features mean less metaspace.
- Consider ahead-of-time compilation. A GraalVM native image starts in milliseconds and has a much smaller footprint, at the cost of build complexity and some reflection limits.
When a rewrite is still right. If the service is small and stable, the team already runs Go, and the saving pays for the migration effort and the equivalence work, a rewrite can be the cheaper long-term option. The honest framing is to separate three effects: runtime, JVM configuration and architectural simplification.
What a senior answer sounds like. "I'd ask whether the 40x is idle or peak, heap or RSS, and what the JVM settings were. In that write-up, peak went down about 7x and they removed infrastructure too. Before a rewrite, I'd measure RSS with Native Memory Tracking, size the heap, try Serial GC or G1 uncommit, and maybe a native image. If the gap is still large and the rewrite pays for itself, then I'd port it, with an equivalence harness."
Alternate interview scenarios
"Our Spring Boot pod uses 500 MB at rest. Where does it go?"
Turn on Native Memory Tracking and compare heap, metaspace, code cache, thread stacks and GC overhead. Then check the heap settings and the thread pool sizes. Often the heap was sized by default ergonomics and the rest is classes and threads.
"Kubernetes keeps OOM-killing a Java pod even though the heap is well under -Xmx."
The container limit applies to RSS, not the heap. Non-heap memory such as metaspace, direct buffers and thread stacks pushed it over. Leave headroom between the heap maximum and the container limit and measure native memory.
Sources (5)
- Medium: Java to Go: How we cut memory 40x in 48 days without changing behaviour (Nov 2026)medium.com
- Oracle JDK 21 documentation: The java command (MaxRAMPercentage, UseSerialGC)docs.oracle.com
- OpenJDK JEP 346: Promptly Return Unused Committed Memory from G1openjdk.org
- Oracle JDK 21 documentation: Native Memory Trackingdocs.oracle.com
- GraalVM documentation: Native Imagegraalvm.org