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!
Some research...
> 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/
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
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,670