SlideShare a Scribd company logo
Deploying Node.js at scale
A developer journey
@lucamaraschi
@matteocollina
DISCLAIMER
Nobody in this story, and no outfit or corporation, is
based upon an actual person or outfit in the real world.
The tale we are going to tell is completely fictional, but
based upon the combined experiences of the speakers
in building Node.js applications.
Meet bob
He is a .LAVA developer
He writes applications on the L2EE
stack, using SQLobster as a
database.
Bob reads:
Such speed
So enterprise
Wow JS
Bob decides:
Let’s rewrite my HUGE application in node.js
Using the MEAN stack
.js
How do I deploy my Javascript monolith?
I read StackOverflow!
SSH into the virtual machine
● snowflake servers
● git clone
● forever!
No Integration tests, but 100%
code coverage
The new product has huge success
Bob is happy
And the performance fall
Bob is SAAD
Such speed
So enterprise
Wow JS
But my schema is relational...
One MongoDB collection for Student
One MongoDB collection for Email populate
Facts
MongoDB has no
concept of relationship
We need relationships
in our application
Let’s build a JOIN
engine inside our
application!
Taken from the Mongoose website
Facts
MongoDB has no
concept of relationship
We need relationships
in our application
Let’s build a JOIN
engine inside our
application!
Let’s do TWO queries
to Mongo
If we used find() instead
of findOne(), we would
have done 1+N queries
Taken from the Mongoose website
NoSQL is hard!
Relational vs. NoSQL
It is not Node fault!
Deduplication is accepted
Don’t shoot in your own foot
{
"name": "Matteo",
"surname": "Collina",
"phone": "+39 347123456",
"emails": [{
"type": "university",
"address": "matteo.collina@unibo.
it"
}]
}
The fixed product has huge success
Bob is happy
again
...but my servers stop responding!!!!
Such speed
So enterprise
Wow JS
Exhausted file descriptors
Every incoming HTTP request is a file descriptor
Every outgoing HTTP request is a file descriptor
1. You receive an HTTP request call to /faulty
2. In faulty, you call service A on /doSomething
3. You pipe the result of /doSomething to the HTTP response
4. An error happens, and you do not close the HTTP response
Fixed amount
Exhausted file descriptors: solution
Replace a.pipe(b)
With pump(a, b)
We are back online!
Bob is happy
again
again
● Scaling the development team
from 1 (Bob) to 5
● Delivering more features in less
time
● 1000 unit tests!
● Serve more customers!
But the Business
(always) wants more...
Such speed
So enterprise
Wow JS
The new team
does not deliver
Bob is SAAD
MVC architecture
Really monolithic
Adding a feature means
changing all “layers” in an
application
Does not scale with the
team size
Equivalent VMs need to be
dimensioned to handle the
most demanding feature
Don’t push anything
till tomorrow..
Developing with modules
Really monolithic
Adding a feature means
changing all “layers” in an
application
Does not scale with the
team size up to a certain
point
Equivalent VMs need to be
dimensioned to handle the
most demanding feature
Productivity goes up again!
Bob is happy
again
again
again
● Scaling the development team
from 5 to 20
● Delivering even more features
in less time
● 10000 unit tests!
● Serve more customers!
But the Business
(always) wants more...
The NEW
new team
does not deliver
Bob is
DESPERATE
===
===
++
distribution
Missing Resiliency
Fault tolerance
&&
A pre-made “stack” might not be good
Let’s throw
everything away...
But .LAVA42 does it better! ;-)
Hipsters use
microservices
Such
modularity
So enterprise
Wow micro
Very
service
Microservices architecture
Really monolithic
Adding a feature means
changing all “layers” in an
application
Does not scale with the
team size up to a certain
point
Equivalent VMs need to be
dimensioned to handle the
most demanding feature
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
Queue in between
How we discover the queues?
How are the back channels / response handled?
The answer to
life
universe,
and everything
The answer to
life
universe,
and everything
The answer to
everything is
service discovery
Discovery with DNS:
Meet Consul
Etcd… but CoreOS
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
Scalable
Weakly consistent
Infection style
Membership protocol
● Weakly consistent vs.
strongly consistent
● Bornt for distributed
systems
● Failure detection over
the cluster
● Information
dissemination
● Equally distribution of
the workload
Advantages
Such
consistency
So infectious
Wow failure
detection
Very
distributed
Common implementations
Hashicorp SERF
If you are into GO
mrhooray/swim-js
If you are into JS ;-)
But a new cluster node is added...
How to rebalance the cluster topology?
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
Consistent hashring
PROBLEM
How can I find a server over
an unstable network?
SOLUTION
Each server and keys are
hashed in a circular
hashspace
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
Advantages
● Easier to avoid
hotspots
● Enable partitioning
● Predictable elasticity
● Easy replication
● Scalability and
Availability
● Local state
mcollina/upring
What if Bob was working for Uber? ;-)
Application-level sharding
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
The fourth secret of Fatima
“Hyperbahn enables service discovery and routing for large-scale systems
comprised of many microservices. Distributed, fault tolerant, and highly available,
it lets one service find and communicate with others simply and reliably without
having to know where those services run.”
Featuring...
● Configuration
Discovery
● Retries
● Load Balancing
● Rate Limiting
● Circuit Breaking
● Distributed tracing
But what about HTTP?
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
TChannel is a networking framing protocol used for general
RPC, supporting out-of-order responses at extremely high
performance where intermediaries can make a forwarding
decision quickly
Tracing as a first class resident...
https://github.com/openzipkin/zipkin
WHY RPC?
Functions
Distributed
Clustered
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
Operation Complexity
...but kills
DEVELOPMENT
WORKFLOW
“SERVERLESS”
is the new Hipster
Such servers
So hipster
Wow functions
Very
reactive
“FUNCTIONAL”
is the new Hipster
“DISTRIBUTED FUNCTIONS”
are the future!
Don’t be too late!
@lucamaraschi
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
matteo.collina@nearform.com
luca.maraschi@nearform.com
Conclusions
● Think about choosing a technology
● Node.js works at scale
● You can implement any architecture with Node.js

More Related Content

KEY
Why I Love TorqueBox (And Why You Will Too)
PPTX
A Tale of Two Apps
KEY
Scale like a pro with Gearman
PPTX
Gearman, Supervisor and PHP - Job Management with Sanity!
PPTX
Using Doctrine Migrations to Synchronize Databases
PPTX
Click’n’Deploy | SuperSpeakers @CodeCamp Iasi, 2014
PDF
Andrii Shumada "No excuses for not writing tests"
PDF
Improve the deployment process step by step
Why I Love TorqueBox (And Why You Will Too)
A Tale of Two Apps
Scale like a pro with Gearman
Gearman, Supervisor and PHP - Job Management with Sanity!
Using Doctrine Migrations to Synchronize Databases
Click’n’Deploy | SuperSpeakers @CodeCamp Iasi, 2014
Andrii Shumada "No excuses for not writing tests"
Improve the deployment process step by step

What's hot (20)

PDF
Madison PHP 2015 - DevOps For Small Teams
PDF
Web Leaps Forward
PPTX
vBrownBag DevOps Series: Puppetinabox
PDF
Background processes and tasks in an async world
PDF
Continuous Delivery in Java
PDF
Node & Express as Workflow Tools
PDF
WebRTC - Brings Real-Time to the Web
PDF
PDF
Tipping the scale - Eyal Eizenberg - Wix
PDF
Intro to React
PDF
Converting LotusScript Agents to Java Agents
PDF
Rapid Digital Innovation: How Node.js Delivers
PDF
High Productivity Web Development Workflow
PDF
Viktor Turskyi "Effective NodeJS Application Development"
PDF
DevOps For Small Teams
PDF
Isomorphic web application
PPTX
Engage 2019 - De04. Java with Domino After XPages
PPTX
Aspect oriented programming
PDF
The Web We Weave :: How Web Developers Think About Performance
PDF
The Shape of Speed
Madison PHP 2015 - DevOps For Small Teams
Web Leaps Forward
vBrownBag DevOps Series: Puppetinabox
Background processes and tasks in an async world
Continuous Delivery in Java
Node & Express as Workflow Tools
WebRTC - Brings Real-Time to the Web
Tipping the scale - Eyal Eizenberg - Wix
Intro to React
Converting LotusScript Agents to Java Agents
Rapid Digital Innovation: How Node.js Delivers
High Productivity Web Development Workflow
Viktor Turskyi "Effective NodeJS Application Development"
DevOps For Small Teams
Isomorphic web application
Engage 2019 - De04. Java with Domino After XPages
Aspect oriented programming
The Web We Weave :: How Web Developers Think About Performance
The Shape of Speed
Ad

Viewers also liked (20)

PDF
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017
PDF
Does Your Web App Speak Schadenfreude? - Greg Rewis - Codemotion Rome 2017
PDF
Reactive MVP - Giorgio Natili - Codemotion Rome 2017
PDF
Community in a nutshell for developers - Alessio Fattorini - Codemotion Rome ...
PDF
Cyber Wars in the Cyber Space - Andrea Pompili - Codemotion Rome 2017
PDF
Webhooks do's and dont's: what we learned after integrating +100 APIs - Giuli...
PDF
Web Based Virtual Reality - Tanay Pant - Codemotion Rome 2017
PDF
Component-Based UI Architectures for the Web - Andrew Rota - Codemotion Rome...
PDF
Kunos Simulazioni and Assetto Corsa, behind the scenes- Alessandro Piva, Fabr...
PDF
Invader Studios: sviluppatori da “Incubo” - Tiziano Bucci - Codemotion Rome ...
PPTX
Cyber Security in Multi Cloud Architecture - Luca Di Bari - Codemotion Rome 2017
PDF
Docker Inside/Out: the ‘real’ real-world of stacking containers in production...
ODP
Container orchestration: the cold war - Giulio De Donato - Codemotion Rome 2017
PDF
Comics and immersive storytelling in Virtual Reality - Fabio Corrirossi - Cod...
PDF
Barbarians at the Gate(way) - Dave Lewis - Codemotion Rome 2017
PDF
Galateo semi-serio dell'Open Source - Luigi Dell' Aquila - Codemotion Rome 2017
PDF
Il game audio come processo ingegneristico - Davide Pensato - Codemotion Rome...
PPTX
Commodore 64 Mon Amour(2): sprite multiplexing. Il caso Catalypse e altre sto...
PDF
Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017
PDF
Handle insane devices traffic using Google Cloud Platform - Andrea Ulisse - C...
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017
Does Your Web App Speak Schadenfreude? - Greg Rewis - Codemotion Rome 2017
Reactive MVP - Giorgio Natili - Codemotion Rome 2017
Community in a nutshell for developers - Alessio Fattorini - Codemotion Rome ...
Cyber Wars in the Cyber Space - Andrea Pompili - Codemotion Rome 2017
Webhooks do's and dont's: what we learned after integrating +100 APIs - Giuli...
Web Based Virtual Reality - Tanay Pant - Codemotion Rome 2017
Component-Based UI Architectures for the Web - Andrew Rota - Codemotion Rome...
Kunos Simulazioni and Assetto Corsa, behind the scenes- Alessandro Piva, Fabr...
Invader Studios: sviluppatori da “Incubo” - Tiziano Bucci - Codemotion Rome ...
Cyber Security in Multi Cloud Architecture - Luca Di Bari - Codemotion Rome 2017
Docker Inside/Out: the ‘real’ real-world of stacking containers in production...
Container orchestration: the cold war - Giulio De Donato - Codemotion Rome 2017
Comics and immersive storytelling in Virtual Reality - Fabio Corrirossi - Cod...
Barbarians at the Gate(way) - Dave Lewis - Codemotion Rome 2017
Galateo semi-serio dell'Open Source - Luigi Dell' Aquila - Codemotion Rome 2017
Il game audio come processo ingegneristico - Davide Pensato - Codemotion Rome...
Commodore 64 Mon Amour(2): sprite multiplexing. Il caso Catalypse e altre sto...
Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017
Handle insane devices traffic using Google Cloud Platform - Andrea Ulisse - C...
Ad

Similar to Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016 (20)

PDF
Maintainable Javascript carsonified
PDF
Responsive, adaptive and responsible - keynote at NebraskaJS
PDF
Practical WebAssembly with Apex, wasmRS, and nanobus
PPT
Scaling Your Web Application
PDF
Better and Faster: A Journey Toward Clean Code and Enjoyment
PDF
Node.JS Vs PHP: Which Is The Top Server-Side Programming Language?
PDF
Scaling Engineering with Docker
PDF
Node and Micro-Services at IBM
ODP
A Happy Cloud Friendly Java Developer with OpenShift
PDF
Cross platform engineering - Lessons Learned (Michael Asimakopoulos, Valadis ...
PDF
MongoDB World 2018: Tutorial - MongoDB Meets Chaos Monkey
PPTX
Исполнение JS на сервере при масштабировании - что может пойти не так, Brian ...
PDF
A Tale of Two Workflows - ChefConf 2014
PDF
Develop modern apps using Spring ecosystem at time of BigData
PDF
Building a full-stack app with Golang and Google Cloud Platform in one week
PPTX
Elm - Could this be the Future of Web Dev?
PDF
Advanced web application architecture - Talk
PPTX
A Developer Day 2014 - Durban
PPTX
Reactive web applications using MeteorJS
PDF
Build reactive systems on lambda
Maintainable Javascript carsonified
Responsive, adaptive and responsible - keynote at NebraskaJS
Practical WebAssembly with Apex, wasmRS, and nanobus
Scaling Your Web Application
Better and Faster: A Journey Toward Clean Code and Enjoyment
Node.JS Vs PHP: Which Is The Top Server-Side Programming Language?
Scaling Engineering with Docker
Node and Micro-Services at IBM
A Happy Cloud Friendly Java Developer with OpenShift
Cross platform engineering - Lessons Learned (Michael Asimakopoulos, Valadis ...
MongoDB World 2018: Tutorial - MongoDB Meets Chaos Monkey
Исполнение JS на сервере при масштабировании - что может пойти не так, Brian ...
A Tale of Two Workflows - ChefConf 2014
Develop modern apps using Spring ecosystem at time of BigData
Building a full-stack app with Golang and Google Cloud Platform in one week
Elm - Could this be the Future of Web Dev?
Advanced web application architecture - Talk
A Developer Day 2014 - Durban
Reactive web applications using MeteorJS
Build reactive systems on lambda

More from Codemotion (20)

PDF
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
PDF
Pompili - From hero to_zero: The FatalNoise neverending story
PPTX
Pastore - Commodore 65 - La storia
PPTX
Pennisi - Essere Richard Altwasser
PPTX
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
PPTX
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
PPTX
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
PPTX
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
PDF
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
PDF
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
PDF
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
PDF
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
PDF
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
PDF
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
PPTX
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
PPTX
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
PDF
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
PDF
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
PDF
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
PDF
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Pompili - From hero to_zero: The FatalNoise neverending story
Pastore - Commodore 65 - La storia
Pennisi - Essere Richard Altwasser
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019

Recently uploaded (20)

PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Electronic commerce courselecture one. Pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
cuic standard and advanced reporting.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Encapsulation theory and applications.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
KodekX | Application Modernization Development
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
The Rise and Fall of 3GPP – Time for a Sabbatical?
Building Integrated photovoltaic BIPV_UPV.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Big Data Technologies - Introduction.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
MYSQL Presentation for SQL database connectivity
Electronic commerce courselecture one. Pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Digital-Transformation-Roadmap-for-Companies.pptx
Encapsulation_ Review paper, used for researhc scholars
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
cuic standard and advanced reporting.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Encapsulation theory and applications.pdf
NewMind AI Monthly Chronicles - July 2025
KodekX | Application Modernization Development
Per capita expenditure prediction using model stacking based on satellite ima...
Reach Out and Touch Someone: Haptics and Empathic Computing

Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016