java tutorial - What is the difference between Nodejs and Java | Java Vs Nodejs - java programming - learn java - java basics - java for beginners
Difference between Nodejs and Java
SCENARIO | NODEJS | JAVA/J2EE |
---|---|---|
System Resource usage | NodeJS consistently uses comparatively very low CPU and Memory due to fewer threads used for processing. | J2EE model scales with threads and hence it is CPU and memory hungry. CPU and Memory usage was comparatively very high. |
Simple URL based read/writes and increasing User Load | As the load and concurrency grow, NodeJS’s scalability potential for lightweight operations improves. | Since each request executes as thread, thread pool size con not be set infinite so with a given thread pool size requests will have to wait for their turn which work well on moderate load but performance degrades on Extremely high twitter kind of loads. |
CPU intensive operations | It should be very carefully chosen in this scenario. | Should be preferred due to multi threading capabilities that can execute such operations in parallel without blocking other requests. |
Independent and Blocking Asynchronous I/O operations. Like mix of DB calls, web service calls, file read/write etc. | Such operations can be executed in parallel while NodeJS instead of waiting on blocking I/O operations can process more requests. | Performance degrades on higher loads. All sub operations in each and every request will be performed sequentially even though they are independent. So originally it may scale up to some parallel threads or request after that waiting time will keep most of the threads waiting (blocking resources). |
Language | Javascript | Java |
Runtime | NodeJS | JVM |
Server/Middleware | Express.JS(Async) | J2EE Compliant Web Server (non async). |
Module Repository | Node Package Modules (NPM) | Mostly maven |
Pass support | Nodejitsu | Multiple… Cloudbees GoGrid CloudCat |
Full Stack | Javascript all across | No java only stack |
Libraries | MODULES Package.json | JARS MANIFEST.MF |
Learn Java - Java tutorial - nodejs processing model - Java examples - Java programs