Quick revision
The short answer
I would start with our own measurements, because the footprint gap has narrowed with CDS and the AOT cache, right-sized heaps, compact object headers and native image. Then I would put the language choice in its full cost: hiring, shared libraries, security tooling, observability and on-call skills, which a second platform doubles. A small memory saving per service is often outweighed by that, so I would keep Java as the default, allow Go as an exception with clear criteria, invest in fleet-wide Java footprint work, and revisit the decision with data.
What to remember
In this answer, we responded to the footprint argument by measuring our own services, showing how CDS, the AOT cache, right-sizing, compact object headers and native image have narrowed the gap, and adding the organisation-wide costs of a second language: hiring, shared libraries, security tooling, observability and on-call. With rough arithmetic, a modest memory saving rarely pays for a second platform, so Java stays the default, Go gets clear exception criteria, and fleet-wide footprint work and a yearly data review keep the decision honest.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would start with our own measurements, because the footprint gap has narrowed with CDS and the AOT cache, right-sized heaps, compact object headers and native image. Then I would put the language choice in its full cost: hiring, shared libraries, security tooling, observability and on-call skills, which a second platform doubles. A small memory saving per service is often outweighed by that, so I would keep Java as the default, allow Go as an exception with clear criteria, invest in fleet-wide Java footprint work, and revisit the decision with data.
Why this question is asked
This debate appears in almost every Java organisation that has grown into many small services. The people raising it are usually right about the symptom: an idle Spring Boot service can use ten times the memory of an idle Go service. A senior leader's job is not to win the argument for Java, but to turn it into a decision the organisation can defend in three years. Interviewers ask it to see whether we can weigh a visible, per-service cost against invisible, organisation-wide ones. In this answer, we will start with measurements, look at how the gap has changed, add up the costs that do not show on a memory graph, do the arithmetic, define exceptions, and plan the investment and review.
1Starting With Our Own Numbers
The argument usually starts with a comparison like 40 MB for a Go service against 400 MB for a Java one. Before accepting or rejecting it, we measure our actual services: container requests, actual peak memory, live heap and startup time, for a sample of the small services in question. Often the Java number is inflated by configuration rather than the language: a 1 GiB heap setting from a template, 200 Tomcat threads for a service that handles five requests a second, and starters nobody uses.
So the first useful step is to tune a few representative Java services properly and measure again. That gives an honest comparison between a well-run Java service and a Go service, instead of between a default Java service and a well-written Go one.
2How the Gap Has Changed
The JVM platform has spent several years on exactly this problem. CDS and the AOT cache from JDK 24 and 25 cut startup and share class data between JVMs on a node. Right-sized heaps and virtual threads remove much of the slack. Compact object headers, a product feature in JDK 25, shrink every object. GraalVM native image, supported by Spring Boot 3, compiles a service into an executable that starts in milliseconds and uses a fraction of the memory.
| Option | Typical memory | Startup |
|---|---|---|
| Spring Boot, template defaults | 400 to 600 MB | 3 to 6 s |
| Spring Boot, tuned JVM | 200 to 300 MB | 2 to 4 s, less with AOT cache |
| Spring Boot, native image | 60 to 120 MB | under 0.2 s |
| Go service | 20 to 60 MB | under 0.1 s |
The numbers in this table are illustrative ranges, not benchmarks; the point is the shape. A tuned JVM closes part of the gap, and native image closes most of it, for services where its build and compatibility costs are acceptable.
3The Costs That Do Not Show on a Memory Graph
A language is not only a runtime; it is a whole platform around it. Our organisation has shared libraries for authentication, tracing, configuration and messaging written for Java. It has security tooling, dependency scanning and patching processes tuned for Maven and Gradle. Its dashboards and alerts assume JVM metrics. Its on-call engineers know how to read a thread dump and a GC log at three in the morning. And its hiring pipeline, interviews and training are built for Java engineers.
Introducing Go for new services means building and maintaining a second copy of all of this, or accepting that Go services are second-class citizens without the shared libraries and tooling. Either way, the cost does not fall on the team that writes the first Go service; it falls on the platform, security and on-call teams for as long as those services exist.
4Doing the Arithmetic
Suppose 150 new small services are planned over three years, each with two instances, and Go would save 200 MB per instance compared with a tuned Java service. That is 150 x 2 x 200 MB, about 60 GB of memory. At a cloud price of a few dollars per GB per month, that is perhaps a few thousand dollars a month, a real but modest sum.
Against it, keeping a second platform up to date, with shared libraries, security scanning, base images, observability integration and training, plausibly needs one or two engineers' time permanently, plus slower moves of people between teams. In many organisations that costs more than the memory saved. The numbers will differ for us, which is exactly why we write them down rather than argue from preference.
- Does a tuned Java service meet its memory and startup needs?YesJava, standard platformNoContinue
- Would Java native image meet them at acceptable build cost?YesJava native imageNoContinue
- Is it small, stable, with few shared-library needs?YesGo exception, with named ownerNoJava, revisit the design
3 steps in order. Play them, or step through them one at a time.
The exception path exists, but it is not the default.
5Exceptions With Clear Criteria
A flat refusal would be wrong, because some services really are better in Go: a tiny sidecar or agent deployed on every node, a command-line tool, or an edge proxy where memory per instance is multiplied by thousands. So we write criteria for exceptions, such as a strict footprint requirement that tuned Java and native image cannot meet, a small and stable scope, and little need for the Java shared libraries. Each exception has a named owning team that accepts responsibility for its tooling and on-call.
This keeps the decision honest in both directions. Teams with a real need get a path, and the organisation does not drift into two platforms by accident, one service at a time.
6Investing in the Fleet and Revisiting
The constructive answer to the footprint complaint is to fix footprint for everyone. A platform investment in right-sized defaults in the service template, CDS or AOT cache in the shared build, virtual threads and native image support for suitable services benefits hundreds of existing services, not just the new ones. That is usually a much bigger saving than writing a few new services in another language.
Finally, we agree to revisit the decision with data, for example once a year: fleet memory per service, how many exceptions were requested and granted, and what the Go services actually cost to run and support. If the data shows the exceptions doing well and the platform cost staying low, we can widen them. If not, we have evidence instead of opinions.
7Follow-up questions
What if the team is simply more productive in Go?
Productivity matters, but it is measured across the whole life of a service, including the shared libraries it cannot use, the security tooling it lacks and the on-call engineers who must support it. If a team's case rests on productivity, we can include it in the exception criteria, but the team must also accept the cost of owning the extra tooling.
Is native image the answer to the footprint argument?
For some services. It closes most of the gap for small, stable services, but brings longer builds and native testing. For the rest, a tuned JVM with the AOT cache is usually enough. The point is that the Java platform offers several options before we need another language.
How would you keep the decision from feeling like a mandate?
By publishing the measurements and the arithmetic, inviting the teams who raised it to help define the exception criteria and the fleet improvements, and committing to a review date. People accept a decision more readily when they can see the numbers and know it will be checked.
8Conclusion
In this answer, we responded to the footprint argument by measuring our own services, showing how CDS, the AOT cache, right-sizing, compact object headers and native image have narrowed the gap, and adding the organisation-wide costs of a second language: hiring, shared libraries, security tooling, observability and on-call. With rough arithmetic, a modest memory saving rarely pays for a second platform, so Java stays the default, Go gets clear exception criteria, and fleet-wide footprint work and a yearly data review keep the decision honest.
Open with
I would take the concern seriously, because idle Java services really do use more memory, but I would start with our own numbers. Often the Java figure is inflated by templates: a gigabyte heap, 200 Tomcat threads, unused starters.
Then, if they want more
A tuned service with CDS or the AOT cache, right-sized heap and threads, and compact object headers on JDK 25 closes part of the gap, and native image closes most of it for small stable services. Then I would put the language choice in its full cost.
We have shared libraries for auth, tracing and messaging, security scanning and patching built around Maven, dashboards built on JVM metrics, on-call engineers who read thread dumps, and hiring built for Java. A second language means a second copy of all of that, paid by the platform and security teams for years.
If we do the arithmetic, say 150 services saving 200 MB per instance, that is a few thousand dollars a month, which is often less than one or two engineers maintaining a second platform.
So I would keep Java as the default, write clear exception criteria for things like node agents or tiny edge services with a named owner, invest in footprint improvements that help the whole fleet, and agree to revisit it yearly with real data.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Java 24, Java 25, Spring Boot 3
- 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 "Some teams argue that Java's memory footprint justifies writing new small services in Go...": https://scrivio-interview-library.netlify.app/java/startup-and-footprint/ef8bc176b7/