SlideShare a Scribd company logo
1 of 57
Download to read offline
Let us first understand…
3 HY NODEJS? 
Little’s Law for Scalability and Fault Tolerance 
L = λW 
λ - Average request arrival rate W -Average time each request is processed by the system 
L - Number of concurrent requests handled by the system 
In our system, 1000 requests, on average, arrive each second 
Each takes 0.5 seconds to process 
How many requests does our system need to handle concurrently? 
1000*0.5 = 500 
1. If we know and we can figure out the rate of requests we can support 
2.To handle more requests, we need to increase , our capacity, or decrease , our processing time, or latency
4 HY NODEJS? 
Time 
WEB CLIENT 
SERVER 
FOO 
BAR 
MICROSERVICES 
HTTP SERVICE 
•FOO and BAR, each take 500ms on average to return a response, 
•Processing latency, is 1 second. That’s our 
•We’ve allowed the web server to spawn up to 2000 threads (that’s now our ) 
How many requests can our system handle per second ? 
λ = L/W = 2000/1 = 2000
5 HY NODEJS? 
L is a feature of the environment (hardware, OS, etc.) and its limiting factors. 
It is the minimum of all limits constraining the number of concurrent requests. 
What Dominates the Capacity (L) ? A server can support several tens-of-thousands requests A server can support 100K to over a million concurrent requests Assuming a request size of 1 MB this can be over several hundreds-of- thousands requests Again, this can be over several hundreds-of-thousands requests So, L is somewhere between 100K and 1 million requests? Oh no no… Wait a minute… It usually has somewhere between 2K and 15K threads. With thread- per-connection model a server can serve < 20K requests 
L = MIN(1,2,3,4,5 ) L is completely dominated by the number of threads the OS can support without adding latency
6 HY NODEJS? 
Time 
WEB CLIENT 
SERVER 
FOO 
BAR 
MICROSERVICES 
HTTP SERVICE 
•FOO and BAR, each take 500ms on average to return a response, 
•Processing latency, is 1 second. That’s our 
•We’ve allowed the web server to spawn up to 2000 threads (that’s now our ) 
If we call FOO and BAR parallely or asynchronously 
How many requests can our system handle per second ? 
λ = 2000/500 = 4000 per second
7 HY NODEJS? 
•Even with multiple threads Context switching is not free 
•Execution stacks(threads) take up memory 
•Cannot use an OS thread for each connection 
Problem 1 
Problem 2 
We do I/O which is or synchronous Typical blocking things:- 
•Calls out to web services 
•Reads/Writes on the Database
8 HAT IS NODEJS? 
•Server side Javascript runtime 
•It has Google Chrome’s V8 under the hood 
•Nodejs.org: “Node.js is a platform built on Chrome’s JavaScript runtime for easily building fastnetwork applications. Node.js uses an , model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.” 
Little’s Law...huh
9 
NodeJS under the hood… 
Callbacks + Polling Epoll, POSIX AIO,Kqueue … 
Socket,http etc… 
Open source JavaScript engine, platform Optimizer, JIT, inline caching, GC 
Cross-platform asychronous I/O. Event Loop,Worker Thread Pool
10 hy Google Chrome ?
ultithreaded Server | Architecture Summary 
Synchronous, blocking I/O = simpler way of performing I/O. More threads because of the direct association to connections. This causes more memory and higher CPU usage due to more context switching among threads
12 ultithreaded server
inglethreaded Server | Architecture Summary 
Event loop (main thread) at the front and asynchronous I/O at the kernel level. By not directly associating connections and threads, needs only a main event loop thread and (kernel) threads to perform I/O. Fewer threads , consequently yield , it uses less memory and also less CPU.
14 inglethreaded Server
And the war begins…
Case Study
17 
THE PAYPAL STORY 
•On November 22, 2013 PayPal's engineering team posted on the PayPal engineering blog a post about PayPal's move from Java back end to Node.js back end for its web applications. 
•The first web application to get the node treatment was the 
•Two teams were building the same application with the exact same functionality one in Java and other in Javascript. 
•The application contained three routes and each route made a between 2-5 API requests, orchestrated the data and rendered the page.
18 
The PAYPAL STORY 
•Double the requests per second vs. the Java application. 
•35% decrease in the average response time for the same page. This resulted in the pages being served 200ms faster— something users will definitely notice.
19 
THE BENEFITS Using JavaScript on both the front- end and the back-end removed an artificial boundary between the browser and server, allowing engineers to code both. 
2.Built almost 
3.Written in 
4.Constructed with vs. the Java application. time for the same page
Wohoooooo……… 
Should I use NodeJS 
for everything now? 
No…
SCALABILITY
22 
NODE.JS SCALES ON A PER PROCESSOR BASIS AS WELL AS ACROSS SERVERS. 
Independently scale the subsystems A JavaEE 3-tier app is actually not written with Horizontal clustering in mind
23 
Case Study - The Playfield 
Reference: http://www.techferry.com/eBooks/NodeJS-vs-J2EE- Stack.html Two small applications simulating following use cases were written. One using Spring/Hibernate running on Tomcat with MySQL database at backend and another application using NodeJS with MySQL database at backend. Jmeter has been used to fire similar test load with varying load patterns to both the applications. 1.Use Case - Write a record : A module to insert a record into one single DB table and the backend returns a success/decline json response. 2.Use Case - Read a record : A module to read the same record by passing a query parameter and the backend returns the record as json string.
24 
BENCHMARKING – CPU & MEMORY 
Average CPU and memory usage were very low for NodeJS for serving same load pattern 
WRITE A RECORD - User/Loops (100/1000) 
READ A RECORD - User/Loops (100/1000)
25 
BENCHMARKING – HITS PER SEC(Scales may differ) 
NodeJs was able to server better hits per second smoothly over time 
WRITE A RECORD - User/Loops (100/1000)
26 
BENCHMARKING – Response Times vs Threads (Scales may differ) 
NodeJs was able to server better hits per second smoothly over time.(Scales below are different) 
READ A RECORD - User/Loops (100/1000)
27 
Scenario 
NODE JS 
JAVA/J2EE 
System Resource usage 
NodeJS consistently uses comparatively very low CPU and Memory because of 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 can 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. 
NodeJS vs JEE - Comparison Summary
28 
Scenario 
NODE JS 
JAVA/J2EE 
CPU Intensive operations 
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 request will be performed sequentially even though they are independent. So initially it may scale up to some parallel threads or requests after which waiting time will keep most of the threads waiting (blocking resources) 
NodeJS vs JEE - Comparison Summary
ECOSYSTEM
30 
ECOSYSTEM 1-1 
NODEJS (Upcoming) 
JAVA/J2EE(Mature) 
Language 
Javascript 
Java 
Runtime 
Node JS 
JVM 
Server/Middleware 
Express.JS(Async) 
J2EE compliant Web Server(Non Async) 
Module Repository 
Node Packaged Modules 
Mostly Maven 
Paas Support 
Multiple… 
•Cloudbees 
•GoGrid 
•Cloudcat 
Full Stack 
Javascript 
all across 
•No Java only stack 
Libraries 
MODULES Package.json 
JARS 
MANIFEST.MF
31 
NODEJS (Upcoming) 
JAVA/J2EE(Mature) 
Unit Testing Frameworks 
NodeUnit 
Mocha(TDD) + Chai(assertion library) 
Nock(Mock Http Services) 
Junit 
EasyMock 
Build Tools 
•Grunt 
•node-ant (Apache Ant adapter ) 
Ant, Maven, Gradle 
Configuration 
config-js 
Mostly XML based 
Standardization of Code Structure 
KrakenJS 
Maven/ pattern based 
Auto Restart 
•forever 
•Supervisor 
•Needs to be explicitly scripted 
ECOSYSTEM 1-1
32 
NODEJS (Upcoming) 
JAVA/J2EE(Mature) 
Web MVC 
Angular.js 
Ember.js 
Backbone.js 
• Struts 
•Spring MVC 
•JSF 
IOC Framework 
Event loop and handlers yield an IOC 
Spring 
ORM frameworks 
Support exists all across, but still nascent 
•JPA 
•Hibernate 
•EJB Entity Beans 
IDE Support 
•Sublime Text 
•Eclipse 
•Eclipse 
•IntelliJ 
Debugging 
•Cluster2 – Live Production Debugging 
•node-inspector 
•Eclipse v8 Plugin 
•JDT 
Profiling 
•V8-profiler 
•node -profiler 
•JProfiler 
•JMeter 
ECOSYSTEM 1-1
33 
ECOSYSTEM 1-1 
NODEJS (Upcoming) 
JAVA/J2EE(Mature) 
Logging frameworks 
Winston 
Bunyan 
Log4Js 
log4j 
logback slf4j 
Monitoring 
node-monitor 
APPDynamics 
Dynatrace, JMX console 
API Support(Persistance, Cache, MQ/File System) 
HTTP 
File System 
Socket.io 
Redis 
MongoDB 
MySQL 
PostgreSQL 
Memcached 
Cassandra 
RabbitMQ 
Riak 
Oracle etc.. and counting… 
Most backend systems
34 
MODULE COUNT
SO WHEN SHOULD I USE NODE?
36 
NODE IS GOOD FOR… 
CHAT 
JSON API on top of an object 
based DB (such as MongoDB). 
QUEUED 
INPUTS 
DATA STREAMING 
PROXY 
APPLICATION MONITORING DASHBOARD 
BROKERAGE - STOCK TRADER’S DASHBOARD 
SYSTEM MONITORING DASHBOARD
BUT I HAVE QUESTIONS…
? 
What about the Callback Challenges?
39 
ASYNC and PROMISES
40 
Can Node be used for Compute Intensive tasks?
41 
COMPUTE INTENSIVE WITH NODE 
*Courtesy: http://neilk.net/blog/2013/04/30/why-you-should-use-nodejs-for-CPU-bound-tasks/ 
Yohooo!!…Worker pools, Cluster, Web Workers to the rescue..
42 
What About Transactions?
43 
NODE.JS TRANSACTION/CONNECTION POOLING SUPPORT 
Knex.js is a "batteries included" SQL query builder for Postgres, MySQL, MariaDB and SQLite3, designed to be flexible, portable, and fun to use. It features both traditional node style callbacks as well as a promise interface for cleaner async flow control, a stream interface, full featured query and schema builders, transaction support, connection pooling and standardized responses between different query clients and dialects. 
Still unconquered 
to the rescue…
44 
How about Java NIO?
45 
WHY JAVA NIO FAILS 
Java still has downsides compared to Node.js in that many core Java libraries are not non-blocking friendly (such as JDBC). 
Async in Node.js is completely different. Everything is non-blocking, from file reads to database access
46 
What about Design Patterns in Javascript?
47 
DESIGN PATTERNS EXIST!!!
48 
What are WebSockets?
49 
WEB SOCKETS 
TCP
AND THE GROWTH CONTINUES…
51 
BUSINESS BENEFITS 
Motivation 
•Fast Prototyping 
•Continuous Delivery Productivity 
•An Enterprise Scale Web Server In 5 Lines 
•>80K Modules On NPM (Growing Ecosystem) Developer Joy More Happy, Works Better, More Developers Join Cost Savings 
•Fewer Developers 
•Smaller Iterations 
•Less Hardware footprint
52 
SUCCESS STORIES
53 
INDUSTRY SUPPORT
54 
NODE IS GROWING FASTER THAN EVER
55 
WRAPPING UP NODE.JS
56 
References 
•http://blog.paralleluniverse.co/2014/02/04/littles- law/ 
•http://www.google.com/googlebooks/chrome/small_16.html 
•http://blog.cloudfoundry.org/2012/06/27/future- proofing-your-apps-cloud-foundry-and-node-js/ 
•http://strongloop.com/node-js/infographic/
Thank You

More Related Content

What's hot

〈야생의 땅: 듀랑고〉 서버 아키텍처 Vol. 3
〈야생의 땅: 듀랑고〉 서버 아키텍처 Vol. 3〈야생의 땅: 듀랑고〉 서버 아키텍처 Vol. 3
〈야생의 땅: 듀랑고〉 서버 아키텍처 Vol. 3Heungsub Lee
 
Best Practice-React
Best Practice-ReactBest Practice-React
Best Practice-ReactYang Yang
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node jsAkshay Mathur
 
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버Heungsub Lee
 
The Enterprise Case for Node.js
The Enterprise Case for Node.jsThe Enterprise Case for Node.js
The Enterprise Case for Node.jsNodejsFoundation
 
Windows Registered I/O (RIO) vs IOCP
Windows Registered I/O (RIO) vs IOCPWindows Registered I/O (RIO) vs IOCP
Windows Registered I/O (RIO) vs IOCPSeungmo Koo
 
Accelerate Your Apache Spark with Intel Optane DC Persistent Memory
Accelerate Your Apache Spark with Intel Optane DC Persistent MemoryAccelerate Your Apache Spark with Intel Optane DC Persistent Memory
Accelerate Your Apache Spark with Intel Optane DC Persistent MemoryDatabricks
 
오픈스택 커뮤니티 소개 및 기술 동향
오픈스택 커뮤니티 소개 및 기술 동향오픈스택 커뮤니티 소개 및 기술 동향
오픈스택 커뮤니티 소개 및 기술 동향Nalee Jang
 
Introduction to Node JS.pdf
Introduction to Node JS.pdfIntroduction to Node JS.pdf
Introduction to Node JS.pdfBareen Shaikh
 
YOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at NetflixYOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at NetflixBrendan Gregg
 
Micro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - PlansoftMicro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - PlansoftMiki Lombardi
 
Twitter의 snowflake 소개 및 활용
Twitter의 snowflake 소개 및 활용Twitter의 snowflake 소개 및 활용
Twitter의 snowflake 소개 및 활용흥배 최
 
Engage 2019: Introduction to Node-Red
Engage 2019: Introduction to Node-RedEngage 2019: Introduction to Node-Red
Engage 2019: Introduction to Node-RedPaul Withers
 
What Is Express JS?
What Is Express JS?What Is Express JS?
What Is Express JS?Simplilearn
 
Ivan Jovanovic - Micro Frontends - Codemotion Rome_2019
Ivan Jovanovic - Micro Frontends - Codemotion Rome_2019Ivan Jovanovic - Micro Frontends - Codemotion Rome_2019
Ivan Jovanovic - Micro Frontends - Codemotion Rome_2019Codemotion
 
Redis cluster
Redis clusterRedis cluster
Redis clusteriammutex
 
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)Esun Kim
 

What's hot (20)

〈야생의 땅: 듀랑고〉 서버 아키텍처 Vol. 3
〈야생의 땅: 듀랑고〉 서버 아키텍처 Vol. 3〈야생의 땅: 듀랑고〉 서버 아키텍처 Vol. 3
〈야생의 땅: 듀랑고〉 서버 아키텍처 Vol. 3
 
Best Practice-React
Best Practice-ReactBest Practice-React
Best Practice-React
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
 
Micro-frontends – is it a new normal?
Micro-frontends – is it a new normal?Micro-frontends – is it a new normal?
Micro-frontends – is it a new normal?
 
The Enterprise Case for Node.js
The Enterprise Case for Node.jsThe Enterprise Case for Node.js
The Enterprise Case for Node.js
 
Windows Registered I/O (RIO) vs IOCP
Windows Registered I/O (RIO) vs IOCPWindows Registered I/O (RIO) vs IOCP
Windows Registered I/O (RIO) vs IOCP
 
Accelerate Your Apache Spark with Intel Optane DC Persistent Memory
Accelerate Your Apache Spark with Intel Optane DC Persistent MemoryAccelerate Your Apache Spark with Intel Optane DC Persistent Memory
Accelerate Your Apache Spark with Intel Optane DC Persistent Memory
 
오픈스택 커뮤니티 소개 및 기술 동향
오픈스택 커뮤니티 소개 및 기술 동향오픈스택 커뮤니티 소개 및 기술 동향
오픈스택 커뮤니티 소개 및 기술 동향
 
Introduction to Node JS.pdf
Introduction to Node JS.pdfIntroduction to Node JS.pdf
Introduction to Node JS.pdf
 
YOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at NetflixYOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at Netflix
 
Micro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - PlansoftMicro Front-End & Microservices - Plansoft
Micro Front-End & Microservices - Plansoft
 
Twitter의 snowflake 소개 및 활용
Twitter의 snowflake 소개 및 활용Twitter의 snowflake 소개 및 활용
Twitter의 snowflake 소개 및 활용
 
Engage 2019: Introduction to Node-Red
Engage 2019: Introduction to Node-RedEngage 2019: Introduction to Node-Red
Engage 2019: Introduction to Node-Red
 
What Is Express JS?
What Is Express JS?What Is Express JS?
What Is Express JS?
 
Express js
Express jsExpress js
Express js
 
Ivan Jovanovic - Micro Frontends - Codemotion Rome_2019
Ivan Jovanovic - Micro Frontends - Codemotion Rome_2019Ivan Jovanovic - Micro Frontends - Codemotion Rome_2019
Ivan Jovanovic - Micro Frontends - Codemotion Rome_2019
 
Redis cluster
Redis clusterRedis cluster
Redis cluster
 
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
 

Viewers also liked

Searching for the framework of my dreams in node.js ecosystem by Mykyta Semen...
Searching for the framework of my dreams in node.js ecosystem by Mykyta Semen...Searching for the framework of my dreams in node.js ecosystem by Mykyta Semen...
Searching for the framework of my dreams in node.js ecosystem by Mykyta Semen...Binary Studio
 
Node home automation with Node.js and MQTT
Node home automation with Node.js and MQTTNode home automation with Node.js and MQTT
Node home automation with Node.js and MQTTMichael Dawson
 
Node Security: The Good, Bad & Ugly
Node Security: The Good, Bad & UglyNode Security: The Good, Bad & Ugly
Node Security: The Good, Bad & UglyBishan Singh
 
Kraken js at paypal
Kraken js at paypalKraken js at paypal
Kraken js at paypalLenny Markus
 
Postroenie sechenij mnogogrannikov
Postroenie sechenij mnogogrannikovPostroenie sechenij mnogogrannikov
Postroenie sechenij mnogogrannikovDimon4
 
Вячеслав Бирюков - Как Linux работает с памятью
Вячеслав Бирюков - Как Linux работает с памятьюВячеслав Бирюков - Как Linux работает с памятью
Вячеслав Бирюков - Как Linux работает с памятьюYandex
 
Сечения призмы и пирамиды
Сечения призмы и пирамидыСечения призмы и пирамиды
Сечения призмы и пирамидыDmitry Bulgakov
 
Node.js Enterprise Middleware
Node.js Enterprise MiddlewareNode.js Enterprise Middleware
Node.js Enterprise MiddlewareBehrad Zari
 
Apache spark linkedin
Apache spark linkedinApache spark linkedin
Apache spark linkedinYukti Kaura
 
Tecnologia web
Tecnologia webTecnologia web
Tecnologia webMeli Vidal
 
Scaling and securing node.js apps
Scaling and securing node.js appsScaling and securing node.js apps
Scaling and securing node.js appsMaciej Lasyk
 
Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture AppDynamics
 
Microservices Workshop All Topics Deck 2016
Microservices Workshop All Topics Deck 2016Microservices Workshop All Topics Deck 2016
Microservices Workshop All Topics Deck 2016Adrian Cockcroft
 
MicroServices at Netflix - challenges of scale
MicroServices at Netflix - challenges of scaleMicroServices at Netflix - challenges of scale
MicroServices at Netflix - challenges of scaleSudhir Tonse
 
10 Tips for failing at microservices
10 Tips for failing at microservices10 Tips for failing at microservices
10 Tips for failing at microservicesDavid Schmitz
 
Node.js Express
Node.js  ExpressNode.js  Express
Node.js ExpressEyal Vardi
 
Principles of microservices velocity
Principles of microservices   velocityPrinciples of microservices   velocity
Principles of microservices velocitySam Newman
 

Viewers also liked (20)

Searching for the framework of my dreams in node.js ecosystem by Mykyta Semen...
Searching for the framework of my dreams in node.js ecosystem by Mykyta Semen...Searching for the framework of my dreams in node.js ecosystem by Mykyta Semen...
Searching for the framework of my dreams in node.js ecosystem by Mykyta Semen...
 
Node home automation with Node.js and MQTT
Node home automation with Node.js and MQTTNode home automation with Node.js and MQTT
Node home automation with Node.js and MQTT
 
Node Security: The Good, Bad & Ugly
Node Security: The Good, Bad & UglyNode Security: The Good, Bad & Ugly
Node Security: The Good, Bad & Ugly
 
Kraken js at paypal
Kraken js at paypalKraken js at paypal
Kraken js at paypal
 
Postroenie sechenij mnogogrannikov
Postroenie sechenij mnogogrannikovPostroenie sechenij mnogogrannikov
Postroenie sechenij mnogogrannikov
 
Вячеслав Бирюков - Как Linux работает с памятью
Вячеслав Бирюков - Как Linux работает с памятьюВячеслав Бирюков - Как Linux работает с памятью
Вячеслав Бирюков - Как Linux работает с памятью
 
Сечения призмы и пирамиды
Сечения призмы и пирамидыСечения призмы и пирамиды
Сечения призмы и пирамиды
 
Node.js Enterprise Middleware
Node.js Enterprise MiddlewareNode.js Enterprise Middleware
Node.js Enterprise Middleware
 
Tecnologias web
Tecnologias webTecnologias web
Tecnologias web
 
Apache spark linkedin
Apache spark linkedinApache spark linkedin
Apache spark linkedin
 
Tecnologia web
Tecnologia webTecnologia web
Tecnologia web
 
Scaling and securing node.js apps
Scaling and securing node.js appsScaling and securing node.js apps
Scaling and securing node.js apps
 
Node.js security
Node.js securityNode.js security
Node.js security
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture
 
Microservices Workshop All Topics Deck 2016
Microservices Workshop All Topics Deck 2016Microservices Workshop All Topics Deck 2016
Microservices Workshop All Topics Deck 2016
 
MicroServices at Netflix - challenges of scale
MicroServices at Netflix - challenges of scaleMicroServices at Netflix - challenges of scale
MicroServices at Netflix - challenges of scale
 
10 Tips for failing at microservices
10 Tips for failing at microservices10 Tips for failing at microservices
10 Tips for failing at microservices
 
Node.js Express
Node.js  ExpressNode.js  Express
Node.js Express
 
Principles of microservices velocity
Principles of microservices   velocityPrinciples of microservices   velocity
Principles of microservices velocity
 

Similar to NodeJS ecosystem

Scalability using Node.js
Scalability using Node.jsScalability using Node.js
Scalability using Node.jsratankadam
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJSUttam Aaseri
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate
 
Building Applications With the MEAN Stack
Building Applications With the MEAN StackBuilding Applications With the MEAN Stack
Building Applications With the MEAN StackNir Noy
 
ASP.NET MVC Performance
ASP.NET MVC PerformanceASP.NET MVC Performance
ASP.NET MVC Performancerudib
 
Understanding the Single Thread Event Loop
Understanding the Single Thread Event LoopUnderstanding the Single Thread Event Loop
Understanding the Single Thread Event LoopTorontoNodeJS
 
Node.js: A Guided Tour
Node.js: A Guided TourNode.js: A Guided Tour
Node.js: A Guided Tourcacois
 
GlobalsDB: Its significance for Node.js Developers
GlobalsDB: Its significance for Node.js DevelopersGlobalsDB: Its significance for Node.js Developers
GlobalsDB: Its significance for Node.js DevelopersRob Tweed
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN StackRob Davarnia
 
Top 30 Node.js interview questions
Top 30 Node.js interview questionsTop 30 Node.js interview questions
Top 30 Node.js interview questionstechievarsity
 
NodeJS guide for beginners
NodeJS guide for beginnersNodeJS guide for beginners
NodeJS guide for beginnersEnoch Joshua
 
Node.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel AvivNode.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel AvivRon Perlmuter
 
3rd Generation Web Application Platforms
3rd Generation Web Application Platforms3rd Generation Web Application Platforms
3rd Generation Web Application PlatformsNaresh Chintalcheru
 
Production Debugging War Stories
Production Debugging War StoriesProduction Debugging War Stories
Production Debugging War StoriesIdo Flatow
 

Similar to NodeJS ecosystem (20)

Node js internal
Node js internalNode js internal
Node js internal
 
Scalability using Node.js
Scalability using Node.jsScalability using Node.js
Scalability using Node.js
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect Guide
 
Building Applications With the MEAN Stack
Building Applications With the MEAN StackBuilding Applications With the MEAN Stack
Building Applications With the MEAN Stack
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
Node
NodeNode
Node
 
ASP.NET MVC Performance
ASP.NET MVC PerformanceASP.NET MVC Performance
ASP.NET MVC Performance
 
Understanding the Single Thread Event Loop
Understanding the Single Thread Event LoopUnderstanding the Single Thread Event Loop
Understanding the Single Thread Event Loop
 
Meanstack overview
Meanstack overviewMeanstack overview
Meanstack overview
 
Introduction to Node.JS
Introduction to Node.JSIntroduction to Node.JS
Introduction to Node.JS
 
Node.js: A Guided Tour
Node.js: A Guided TourNode.js: A Guided Tour
Node.js: A Guided Tour
 
GlobalsDB: Its significance for Node.js Developers
GlobalsDB: Its significance for Node.js DevelopersGlobalsDB: Its significance for Node.js Developers
GlobalsDB: Its significance for Node.js Developers
 
Node js
Node jsNode js
Node js
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
 
Top 30 Node.js interview questions
Top 30 Node.js interview questionsTop 30 Node.js interview questions
Top 30 Node.js interview questions
 
NodeJS guide for beginners
NodeJS guide for beginnersNodeJS guide for beginners
NodeJS guide for beginners
 
Node.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel AvivNode.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel Aviv
 
3rd Generation Web Application Platforms
3rd Generation Web Application Platforms3rd Generation Web Application Platforms
3rd Generation Web Application Platforms
 
Production Debugging War Stories
Production Debugging War StoriesProduction Debugging War Stories
Production Debugging War Stories
 

More from Yukti Kaura

Cloud computing saas
Cloud computing   saasCloud computing   saas
Cloud computing saasYukti Kaura
 
Cloud computing - Basics and Beyond
Cloud computing - Basics and BeyondCloud computing - Basics and Beyond
Cloud computing - Basics and BeyondYukti Kaura
 
Hadoop and big data
Hadoop and big dataHadoop and big data
Hadoop and big dataYukti Kaura
 
Web services for Laymen
Web services for LaymenWeb services for Laymen
Web services for LaymenYukti Kaura
 
Clean code - Agile Software Craftsmanship
Clean code - Agile Software CraftsmanshipClean code - Agile Software Craftsmanship
Clean code - Agile Software CraftsmanshipYukti Kaura
 
Basics of Flex Components, Skinning
Basics of Flex Components, SkinningBasics of Flex Components, Skinning
Basics of Flex Components, SkinningYukti Kaura
 

More from Yukti Kaura (8)

Cloud computing saas
Cloud computing   saasCloud computing   saas
Cloud computing saas
 
Cloud computing - Basics and Beyond
Cloud computing - Basics and BeyondCloud computing - Basics and Beyond
Cloud computing - Basics and Beyond
 
Hadoop and big data
Hadoop and big dataHadoop and big data
Hadoop and big data
 
Web services for Laymen
Web services for LaymenWeb services for Laymen
Web services for Laymen
 
Spring batch
Spring batch Spring batch
Spring batch
 
Clean code - Agile Software Craftsmanship
Clean code - Agile Software CraftsmanshipClean code - Agile Software Craftsmanship
Clean code - Agile Software Craftsmanship
 
Maven overview
Maven overviewMaven overview
Maven overview
 
Basics of Flex Components, Skinning
Basics of Flex Components, SkinningBasics of Flex Components, Skinning
Basics of Flex Components, Skinning
 

Recently uploaded

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 

Recently uploaded (20)

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

NodeJS ecosystem

  • 1.
  • 2. Let us first understand…
  • 3. 3 HY NODEJS? Little’s Law for Scalability and Fault Tolerance L = λW λ - Average request arrival rate W -Average time each request is processed by the system L - Number of concurrent requests handled by the system In our system, 1000 requests, on average, arrive each second Each takes 0.5 seconds to process How many requests does our system need to handle concurrently? 1000*0.5 = 500 1. If we know and we can figure out the rate of requests we can support 2.To handle more requests, we need to increase , our capacity, or decrease , our processing time, or latency
  • 4. 4 HY NODEJS? Time WEB CLIENT SERVER FOO BAR MICROSERVICES HTTP SERVICE •FOO and BAR, each take 500ms on average to return a response, •Processing latency, is 1 second. That’s our •We’ve allowed the web server to spawn up to 2000 threads (that’s now our ) How many requests can our system handle per second ? λ = L/W = 2000/1 = 2000
  • 5. 5 HY NODEJS? L is a feature of the environment (hardware, OS, etc.) and its limiting factors. It is the minimum of all limits constraining the number of concurrent requests. What Dominates the Capacity (L) ? A server can support several tens-of-thousands requests A server can support 100K to over a million concurrent requests Assuming a request size of 1 MB this can be over several hundreds-of- thousands requests Again, this can be over several hundreds-of-thousands requests So, L is somewhere between 100K and 1 million requests? Oh no no… Wait a minute… It usually has somewhere between 2K and 15K threads. With thread- per-connection model a server can serve < 20K requests L = MIN(1,2,3,4,5 ) L is completely dominated by the number of threads the OS can support without adding latency
  • 6. 6 HY NODEJS? Time WEB CLIENT SERVER FOO BAR MICROSERVICES HTTP SERVICE •FOO and BAR, each take 500ms on average to return a response, •Processing latency, is 1 second. That’s our •We’ve allowed the web server to spawn up to 2000 threads (that’s now our ) If we call FOO and BAR parallely or asynchronously How many requests can our system handle per second ? λ = 2000/500 = 4000 per second
  • 7. 7 HY NODEJS? •Even with multiple threads Context switching is not free •Execution stacks(threads) take up memory •Cannot use an OS thread for each connection Problem 1 Problem 2 We do I/O which is or synchronous Typical blocking things:- •Calls out to web services •Reads/Writes on the Database
  • 8. 8 HAT IS NODEJS? •Server side Javascript runtime •It has Google Chrome’s V8 under the hood •Nodejs.org: “Node.js is a platform built on Chrome’s JavaScript runtime for easily building fastnetwork applications. Node.js uses an , model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.” Little’s Law...huh
  • 9. 9 NodeJS under the hood… Callbacks + Polling Epoll, POSIX AIO,Kqueue … Socket,http etc… Open source JavaScript engine, platform Optimizer, JIT, inline caching, GC Cross-platform asychronous I/O. Event Loop,Worker Thread Pool
  • 10. 10 hy Google Chrome ?
  • 11. ultithreaded Server | Architecture Summary Synchronous, blocking I/O = simpler way of performing I/O. More threads because of the direct association to connections. This causes more memory and higher CPU usage due to more context switching among threads
  • 13. inglethreaded Server | Architecture Summary Event loop (main thread) at the front and asynchronous I/O at the kernel level. By not directly associating connections and threads, needs only a main event loop thread and (kernel) threads to perform I/O. Fewer threads , consequently yield , it uses less memory and also less CPU.
  • 15. And the war begins…
  • 17. 17 THE PAYPAL STORY •On November 22, 2013 PayPal's engineering team posted on the PayPal engineering blog a post about PayPal's move from Java back end to Node.js back end for its web applications. •The first web application to get the node treatment was the •Two teams were building the same application with the exact same functionality one in Java and other in Javascript. •The application contained three routes and each route made a between 2-5 API requests, orchestrated the data and rendered the page.
  • 18. 18 The PAYPAL STORY •Double the requests per second vs. the Java application. •35% decrease in the average response time for the same page. This resulted in the pages being served 200ms faster— something users will definitely notice.
  • 19. 19 THE BENEFITS Using JavaScript on both the front- end and the back-end removed an artificial boundary between the browser and server, allowing engineers to code both. 2.Built almost 3.Written in 4.Constructed with vs. the Java application. time for the same page
  • 20. Wohoooooo……… Should I use NodeJS for everything now? No…
  • 22. 22 NODE.JS SCALES ON A PER PROCESSOR BASIS AS WELL AS ACROSS SERVERS. Independently scale the subsystems A JavaEE 3-tier app is actually not written with Horizontal clustering in mind
  • 23. 23 Case Study - The Playfield Reference: http://www.techferry.com/eBooks/NodeJS-vs-J2EE- Stack.html Two small applications simulating following use cases were written. One using Spring/Hibernate running on Tomcat with MySQL database at backend and another application using NodeJS with MySQL database at backend. Jmeter has been used to fire similar test load with varying load patterns to both the applications. 1.Use Case - Write a record : A module to insert a record into one single DB table and the backend returns a success/decline json response. 2.Use Case - Read a record : A module to read the same record by passing a query parameter and the backend returns the record as json string.
  • 24. 24 BENCHMARKING – CPU & MEMORY Average CPU and memory usage were very low for NodeJS for serving same load pattern WRITE A RECORD - User/Loops (100/1000) READ A RECORD - User/Loops (100/1000)
  • 25. 25 BENCHMARKING – HITS PER SEC(Scales may differ) NodeJs was able to server better hits per second smoothly over time WRITE A RECORD - User/Loops (100/1000)
  • 26. 26 BENCHMARKING – Response Times vs Threads (Scales may differ) NodeJs was able to server better hits per second smoothly over time.(Scales below are different) READ A RECORD - User/Loops (100/1000)
  • 27. 27 Scenario NODE JS JAVA/J2EE System Resource usage NodeJS consistently uses comparatively very low CPU and Memory because of 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 can 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. NodeJS vs JEE - Comparison Summary
  • 28. 28 Scenario NODE JS JAVA/J2EE CPU Intensive operations 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 request will be performed sequentially even though they are independent. So initially it may scale up to some parallel threads or requests after which waiting time will keep most of the threads waiting (blocking resources) NodeJS vs JEE - Comparison Summary
  • 30. 30 ECOSYSTEM 1-1 NODEJS (Upcoming) JAVA/J2EE(Mature) Language Javascript Java Runtime Node JS JVM Server/Middleware Express.JS(Async) J2EE compliant Web Server(Non Async) Module Repository Node Packaged Modules Mostly Maven Paas Support Multiple… •Cloudbees •GoGrid •Cloudcat Full Stack Javascript all across •No Java only stack Libraries MODULES Package.json JARS MANIFEST.MF
  • 31. 31 NODEJS (Upcoming) JAVA/J2EE(Mature) Unit Testing Frameworks NodeUnit Mocha(TDD) + Chai(assertion library) Nock(Mock Http Services) Junit EasyMock Build Tools •Grunt •node-ant (Apache Ant adapter ) Ant, Maven, Gradle Configuration config-js Mostly XML based Standardization of Code Structure KrakenJS Maven/ pattern based Auto Restart •forever •Supervisor •Needs to be explicitly scripted ECOSYSTEM 1-1
  • 32. 32 NODEJS (Upcoming) JAVA/J2EE(Mature) Web MVC Angular.js Ember.js Backbone.js • Struts •Spring MVC •JSF IOC Framework Event loop and handlers yield an IOC Spring ORM frameworks Support exists all across, but still nascent •JPA •Hibernate •EJB Entity Beans IDE Support •Sublime Text •Eclipse •Eclipse •IntelliJ Debugging •Cluster2 – Live Production Debugging •node-inspector •Eclipse v8 Plugin •JDT Profiling •V8-profiler •node -profiler •JProfiler •JMeter ECOSYSTEM 1-1
  • 33. 33 ECOSYSTEM 1-1 NODEJS (Upcoming) JAVA/J2EE(Mature) Logging frameworks Winston Bunyan Log4Js log4j logback slf4j Monitoring node-monitor APPDynamics Dynatrace, JMX console API Support(Persistance, Cache, MQ/File System) HTTP File System Socket.io Redis MongoDB MySQL PostgreSQL Memcached Cassandra RabbitMQ Riak Oracle etc.. and counting… Most backend systems
  • 35. SO WHEN SHOULD I USE NODE?
  • 36. 36 NODE IS GOOD FOR… CHAT JSON API on top of an object based DB (such as MongoDB). QUEUED INPUTS DATA STREAMING PROXY APPLICATION MONITORING DASHBOARD BROKERAGE - STOCK TRADER’S DASHBOARD SYSTEM MONITORING DASHBOARD
  • 37. BUT I HAVE QUESTIONS…
  • 38. ? What about the Callback Challenges?
  • 39. 39 ASYNC and PROMISES
  • 40. 40 Can Node be used for Compute Intensive tasks?
  • 41. 41 COMPUTE INTENSIVE WITH NODE *Courtesy: http://neilk.net/blog/2013/04/30/why-you-should-use-nodejs-for-CPU-bound-tasks/ Yohooo!!…Worker pools, Cluster, Web Workers to the rescue..
  • 42. 42 What About Transactions?
  • 43. 43 NODE.JS TRANSACTION/CONNECTION POOLING SUPPORT Knex.js is a "batteries included" SQL query builder for Postgres, MySQL, MariaDB and SQLite3, designed to be flexible, portable, and fun to use. It features both traditional node style callbacks as well as a promise interface for cleaner async flow control, a stream interface, full featured query and schema builders, transaction support, connection pooling and standardized responses between different query clients and dialects. Still unconquered to the rescue…
  • 44. 44 How about Java NIO?
  • 45. 45 WHY JAVA NIO FAILS Java still has downsides compared to Node.js in that many core Java libraries are not non-blocking friendly (such as JDBC). Async in Node.js is completely different. Everything is non-blocking, from file reads to database access
  • 46. 46 What about Design Patterns in Javascript?
  • 47. 47 DESIGN PATTERNS EXIST!!!
  • 48. 48 What are WebSockets?
  • 50. AND THE GROWTH CONTINUES…
  • 51. 51 BUSINESS BENEFITS Motivation •Fast Prototyping •Continuous Delivery Productivity •An Enterprise Scale Web Server In 5 Lines •>80K Modules On NPM (Growing Ecosystem) Developer Joy More Happy, Works Better, More Developers Join Cost Savings •Fewer Developers •Smaller Iterations •Less Hardware footprint
  • 54. 54 NODE IS GROWING FASTER THAN EVER
  • 55. 55 WRAPPING UP NODE.JS
  • 56. 56 References •http://blog.paralleluniverse.co/2014/02/04/littles- law/ •http://www.google.com/googlebooks/chrome/small_16.html •http://blog.cloudfoundry.org/2012/06/27/future- proofing-your-apps-cloud-foundry-and-node-js/ •http://strongloop.com/node-js/infographic/