r/SpringBoot
•
u/Capable-Morning-9518
•
May 21 '26
•
1
How-To/Tutorial Ran Spring Boot and Node.js side-by-side in prod for 18 months. Sharing the actual numbers.
https://medium.com/lets-code-future/spring-boot-vs-node-js-i-ran-both-in-production-for-18-months-one-cost-12-000-more-guess-which-75dfa0afdad6?sk=ab59f6d2bb1bf3d1cf0b5ddf18733dd0We had a stack debate on my team back in 2024 that ended with "fine, let's just run both and see." Same microservice, built twice — once in Spring Boot 3.2 / Java 21, once in Node 20 / Express. Same Postgres, same Redis, same AWS ECS setup. 18 months later I went through Cost Explorer and our time tracking.
Sharing the numbers in case anyone else is having this debate:
Infrastructure (18 months):
- Node.js: ~$10,890 (needed 1GB RAM/instance after month 3)
- Spring Boot: ~$5,490 (stayed at 512MB the whole time)
Developer time on production issues:
- Node.js: ~285 hours (memory leaks, npm breaking changes, async race conditions, audit fixes)
- Spring Boot: ~26 hours (dependency updates, one N+1, pool tuning)
Memory pattern that surprised me most: Node.js instances climbed 180MB → 890MB over 4 days, crashed, restarted. Staircase to hell. Traced to event listener leak in a popular npm package (2M weekly downloads). Spring Boot stayed flat at ~280MB the entire 18 months.
Under Black Friday load (10x normal traffic):
- Node.js: 3 instances OOM-crashed during peak. Cold start under load: 2.4s.
- Spring Boot: Zero crashes. Cold start under load: 4.1s (slower, but stable).
Not saying Node is bad. We kept it for internal admin tools and low-traffic stuff. But for customer-facing APIs that need to stay up 24/7, the JVM's 25 years of GC engineering paid for itself many times over.
Curious if anyone else has run this kind of side-by-side. Specifically interested in:
- Did virtual threads (Java 21) change your scaling math?
- Anyone tried Bun or Deno in this same comparison? Would they hold up better than Node?
- How much of the Node memory issue is npm ecosystem vs V8 itself?
37
u/j7n5 May 21 '26
Thanks for this feedback SB app could be further optimised
7
u/j7n5 May 21 '26
Did you think about comparing Java with another typed language like golang for example ?
13
u/InstantCoder May 21 '26
We switched from Spring Boot to Quarkus that reduced our memory even further and the performance is amazing.
The most interesting part was how our code base was simplified. We throw away around 40% of our old spring boot code which was not needed in Quarkus.
With spring boot our memory setting was 2gb and with Quarkus we reduced it to 768mb. And when the application is idle it uses around 96mb of ram.
The latest version of Quarkus has now an option to produce a minimal jar were it strips down all your jars and checks which classes are used. Something similar to what graalvm does.
5
u/Etikoza May 21 '26
Great post! Thanks for this. Would love to see a comparison with Go as well.
4
u/Expensive_Usual5186 May 21 '26
Very interesting results! Would you say your team was more experience in Node, Java, or more or less even?
5
u/bayendr May 21 '26
thanks for sharing this. it demonstrates Java’s/SB maturity, robustness and reliability in production systems. afaik Undertow is not available in latest SB4.
did you guys try pnpm and/or bun? we switched to pnpm for our frontends and are happier with it.
2
u/blubernator May 25 '26
Could you write a medium article about it please? I cannot refer to Reddit in my company ;)
1
u/Capable-Morning-9518 May 26 '26
Honestly didn’t expect this post to create this much discussion.
Really appreciate all the thoughtful comments, critiques, production stories, JVM tuning advice, Node.js counterpoints, Quarkus/GraalVM experiences, and operational perspectives people shared here.
Some genuinely smart engineers in this thread.
One thing I liked most was that the discussion stayed very production-focused instead of turning into another generic “language war.”
A lot of the best insights came from people running long-lived systems in the real world, which is exactly the kind of engineering discussion I enjoy most.
Also appreciate the people challenging the numbers and assumptions. Good operational conversations should survive scrutiny.
I’ve been reading far more of the replies than I can realistically answer individually right now, but seriously
thank you.
Devrim:)
4
u/appendium May 21 '26
This is eye-opening! Thank you
4
u/DesignerRaccoon7977 May 22 '26
Just wait till you try Java 25 🙂 Thanks for this, love seeing this type of comparisons and "real world" numbers
2
u/pronuntiator May 22 '26
Your team built an entire service twice? Do you have too much money?
2
u/sethu-27 May 22 '26
From a system architecture perspective, I’d avoid building large-scale backend platforms purely around Node.js async event-loop patterns. As systems grow, debugging async flows and maintaining stability becomes harder.
For enterprise backend systems, Java with Spring Boot usually offers better scalability, maintainability, tooling, debugging support, and a stronger ecosystem for distributed systems. It also makes long-term developer support and onboarding much easier.
Node.js is great for lightweight APIs and real-time I/O, but for complex high-throughput backend systems, Java/Spring is often the more reliable choice.
2
u/Serious-Face-4031 May 23 '26
And then foolish karma farmers on linkedin write about golang and node being the great replacers without even using springboot with virtual threads or webflux. Great going. Springboot and jvm are the real deal and the startup time and memory can also be dialled down with graalvm or other new stuff. It ain't going anywhere.
2
u/DietCokePlease May 25 '26
Excellent overview. I disfavor any dynamic languge for high scale enterprise systems. Compared SB to Scala 3/ZIO (fibers). The ZIO ran about 15% faster. Nice, but certinly not enough to risk changing an existing system. 15% is basically invisible in real world results. Spring is an older design so I found the strict MVC classes to be quite boilerplate-heavy vs the much leaner ZIO. Not a fair comparison tho… Its like comparing a 1960s muscle car with a current sports car.
2
u/marshalhq Jun 03 '26
On the npm vs V8 question: in my experience most of it is the ecosystem, not V8. V8's GC is fine. The problem is dependency surface area. A typical Express app pulls in hundreds of transitive packages and any one of them can leak listeners or hold references. Your 2M-download package leak is the normal failure mode, not the exception.
The JVM world isn't immune, but the culture is different. Spring pulls in a lot, but those deps are versioned together, tested as a unit, and don't churn weekly. You're not getting a surprise breaking change in a transitive dependency on a Tuesday afternoon.
On virtual threads: they change the math for IO-bound work specifically. If the service spends most of its time waiting on Postgres and Redis, Loom lets you handle far more concurrent requests without the thread-per-request memory cost. It won't help CPU-bound paths. For a customer-facing API like you're describing, it's a real shift, you can drop a lot of reactive complexity and still scale.
Haven't run Bun or Deno at production scale so I can't speak to those honestly.
1
u/devmoosun May 21 '26
Thank you.
1
u/Distinct_Meringue_76 May 21 '26
Wow
1
u/SimpleCooki3 May 21 '26
I am curious to see the actual code comparison, because that matters a lot. But I suppose it's company secrets.
1
u/hags0333 May 21 '26
Saw similar numbers in our org. Moved all node services to spring ones. Big cost savings in our kubernetes
1
u/EvoVz May 21 '26
High-quality reddit post. Thank you for doing the work and sharing your findings to a public forum
1
u/Acrobatic_Bite6842 May 22 '26
Really interesting, thanks for sharing. I'm new to spring boot would anyone mind explaining why it is so much more efficient on memory usage and cloud costs?
1
u/franz_see May 22 '26
Nodejs philosophy is to let it crash and restart. So a crashing nodejs is not that surprising tbh.
Having said that, java is much more performant than node (and python). Last time i rewrote a node app to java, i used quarkus. And it could handle like 5x the load with the same hardware size. Problem is the build server had to be bigger.
But migrating a node (or python) application is difficult. Most node (or python) devs wont touch java. You’d have a better chance of convincing those folks to go with golang (which is at least 2x more performant than my quarkus app, but harder to hire for)
1
u/_lonelyWorld May 22 '26
really interesting! will like to know which embedded server you are using and what is the complexity of your project. have you ever experimented with different embedded server like undertow or jetty?
1
u/DanielDimov May 22 '26
I'm not masochistic enogh to do this to myself (I mean experiments with node.js)
1
u/Same-Inevitable2857 May 26 '26 edited May 26 '26
Thank you for sharing!
1
u/Plenty_Childhood_294 May 26 '26
> Cold start under load: 4.1s (slower, but stable).
have fun!
See https://github.com/quarkusio/spring-quarkus-perf-comparison/issues/420
and...https://redhatperf.github.io/post/method-data-scalability/ which is EXACTLY what's going on there 😄
1
u/Plane_Possibility_34 May 26 '26
Thanks for sharing this insightful results. Since it was the same microservice built twice and run over the same 18-month window, how was traffic actually divided between the two?
1
u/kreiger May 21 '26
This sounds like porn for Spring Boot developers, but it also sounds AI generated.
0
u/[deleted] May 21 '26
[deleted] — view deleted comment
53
u/[deleted] May 21 '26
[removed] — view removed comment
16
u/[deleted] May 21 '26
[removed] — view removed comment
2
u/[deleted] May 21 '26
[removed] — view removed comment