Node.js
compared to traditional
Java EE Application Servers
Niko Köbler
Independent Software-Architect, Developer & Trainer
> niko@n-k.de > www.n-k.de > @dasniko
Why?
> Node.js hipster app!
![](https://s3.amazonaws.com/media-p.slid.es/uploads/43555/images/1654563/Bildschirmfoto_2015-08-20_um_13.17.04.png)
Some research...
![](https://s3.amazonaws.com/media-p.slid.es/uploads/43555/images/1654593/Bildschirmfoto_2015-08-20_um_13.22.23.png)
> Node.js performance +20% vs. Java
...but no async code in Java...!
http://blog.shinetech.com/2013/10/22/performance-comparison-between-node-js-and-java-ee/
![](https://s3.amazonaws.com/media-p.slid.es/uploads/43555/images/1654607/Bildschirmfoto_2015-08-20_um_13.23.57.png)
Rock-solid foundation
Cross-compiling from one to the other
Node.js
Java
Topic winning
Remote debugging
Database queries
JSON
Solid engineering
Speed
Threads
Momentum
Ubiquity
Better IDEs
Build process simplified
Libraries
![](https://s3.amazonaws.com/media-p.slid.es/uploads/43555/images/1654607/Bildschirmfoto_2015-08-20_um_13.23.57.png)
About UseCases and MicroServices
The Customer
The UseCase
Create a MicroService!
I'm a JavaScript fanboy!
(server-side, not necessarily front-end!)
Let's use Node.js!
> one, lightweight, independent process
> good and easy-to-use redis/sentinel communication
(also asnychronously)
> few lines of code
> solution was ready after 30mins of coding
No!
Unfortunately, the customer said:
But..!
I tried to convince:
You have to use Java!
> No, only JBoss EAP 6 (Java EE 6 with Java 7)
> But that's a heavy-weighted, old-fashioned application server, and everybody is claiming:
> Do I really have to use such a rhinoceros for such a small "no-brainer"?
How did we solve it?
Let's have a look into the code...
Thanks to @Suspend!
> Java EE 6 / JAX-RS 1.x doesn't support async requests
> synchronous requests result in many HTTP worker threads
> Resteasy provides @Suspend annotation
> Asynchronous processing becomes true in JAX-RS 1.x
> For the sake of completeness:
use an asynchronous redis connector
50 threads | min | tps |
---|---|---|
Node.js | 1ms | ~2.000 req/sec |
JBoss EAP | 1ms | ~2.000 req/sec |
Where to next?
Think about...
> using more http-worker-threads
> optimizing your code/infrastructure
> using Wildfly Swarm (or Spring Boot, Vert.x, whatever) instead of EAP
> ...you name it!
It doesn't matter
which technology you use.
Use it right!
Thank you!
Any Questions?
Niko Köbler
Independent Software-Architect, Developer & Trainer
> niko@n-k.de > www.n-k.de > @dasniko
Node.js compared to Java App Servers
By Niko Köbler
Node.js compared to Java App Servers
- 3,564