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=ab59f6d2bb1bf3d1cf0b5ddf18733dd07
u/j7n5 May 21 '26
Did you think about comparing Java with another typed language like golang for example ?
5
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
May 21 '26
[removed] — view removed comment
7
u/InstantCoder May 21 '26
The config biolerplate most of the part indeed. Especially the security & rest client config is much much simpler and neat in Quarkus.
We also switched to active record pattern (Quarkus Panache) for data access and removed all the repositories.
Furthermore we removed Lombok, since this is also not needed with Quarkus and as a matter of fact the Quarkus team highly discourages Lombok.
3
u/explorethemetaverse May 21 '26
Most of the devs are not using Lombok these days.
2
u/InstantCoder May 21 '26
You would be surprised how much I see it used wherever I go.
2
u/explorethemetaverse May 21 '26 edited May 21 '26
It has a little performance issue and debugging complexity. I worked in a highly concurrent, distributed, low latency, high throughput systems over the last decade.
2
u/Swamplord42 May 26 '26
Lombok is completely irrelevant when it comes to performance unless you're doing very weird things with it.
1
u/Plenty_Childhood_294 May 26 '26
https://github.com/quarkusio/spring-quarkus-perf-comparison/issues/521
There are lot of interesting things to said :)
5
4
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?
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
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.
1
u/Aromatic_Ad3754 May 21 '26
I don't think you should trust bun, they migrated to rust in 1 week using AI. And the codebase passed one million lines of code.
1
2
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/blubernator May 25 '26
Could you write a medium article about it please? I cannot refer to Reddit in my company ;)
1
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
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
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
1
u/ch34p3st May 22 '26
I think also some things like the nodejs runtime being "eager" is something that bites a lot of devs. Promise.all tries to do as much as possible, often leading to the memory GC kicking in and dramatically slowing down things. Same with array.map. I do not see (async) generators and/or streams being used often enough which would alleviate some of those issues by stabilizing the memory load a bit. Point is that some lack of knowledge is punished hard or polished away by 3rd party libs that might have their own flaws.
Those issues are less apparent on FE, because your dev machine is often fast and memory leaks and GC are limited to a browser tab of one of your users (and the browser gets blamed often), not the shared process used by many clients. I am sure you can squeeze more stability and performance out of nodejs if your team has a lot of knowledge of the stack, the issues mentioned are still valid points overall I would say.
Altough I love nodejs, would probably go for something boring as well. I salute the CTO for the experiment!
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
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
May 21 '26
[deleted]
12
u/ducki666 May 21 '26
Thats not a race or synthetic benchmark.
It compares 2 of the most used stacks nowadays. Very valuable.
0
May 21 '26
[deleted]
10
u/ducki666 May 21 '26
Wtf. The op had these 2 in PROD use. Do you expect that he will implement a 3rd for you?
0
May 21 '26
[deleted]
2
u/BikingSquirrel May 21 '26
When will you provide a more valuable comparison? Looking forward to it!
53
May 21 '26
[removed] — view removed comment
1
May 24 '26
[removed] — view removed comment
1
u/Plenty_Childhood_294 May 26 '26
rofile your system using tools like k6 -> it drops silently requests when it cannot keep up.
It fail to both record "coordinated omission free latencies" and push enough load
1
May 26 '26
[removed] — view removed comment
1
u/Plenty_Childhood_294 May 27 '26
Wouldn't be better if they use the intended start time (if there's a schedule) and record the response time accordly to that? that's what the https://www.scylladb.com/2021/04/22/on-coordinated-omission/ is all about. That said, it is fine if there's an explicit and easy for users to detect "failures" of this type - but last time I've checked I had to inspect the logs of the load gen to find it out ^^
16
May 21 '26
[removed] — view removed comment
8
u/rack88 May 21 '26
I start trying to be helpful to my front end dev by bringing dependencies up to date, then I typically start to cry.
2
May 21 '26
[removed] — view removed comment
2
u/eosterlund May 22 '26
I love this kind of real world evaluations. Sometimes, it is tempting to use benchmarks to compare which system is better. But the benchmarks run in such a short amount of time that there is never need for things like defragmentation, which Java has invested much into. You never see the pay off in benchmarks, but you do see it after a couple of days in a real world deployment.
In fact, most of the environment of a benchmark tends to be the opposite to how reality looks. You don’t run an interactive application at 100% CPU. Latency profile is much different then. You run it for many days, not a couple of minutes. Fragmentation matters. You don’t just burn CPU, there is IO as well. So it’s really helpful to look at a real deployment instead.
37
u/j7n5 May 21 '26
Thanks for this feedback SB app could be further optimised
change GC. Try G1 or ZGC
choose better embedded web server for SB. Default is tomcat, try light one like jetty or undertow
Jdeps and jlink tools to build custom JRE with only needed modules. This could reduce app size and even memory usage
slim docker image
native images with AOT and GraalVM