Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
The Node.js Scalability Myth
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Felix Geisendörfer
May 02, 2012
Technology
1.6k
4
Share
The Node.js Scalability Myth
Presentation given on 26.04.2012 at MixIT conference in Lyon, France.
Felix Geisendörfer
May 02, 2012
More Decks by Felix Geisendörfer
See All by Felix Geisendörfer
tus.io - Resumable File Uploads (Lightning Talk)
felixge
2
830
Programming flying robots with JavaScript
felixge
2
1k
Programming flying robots with JavaScript
felixge
0
650
Programming an AR Drone Firmware with JS (de)
felixge
1
660
Faster than C?
felixge
1
1.3k
Flying robots over a 10.000 mile distance with JavaScript.
felixge
0
540
Faster than C?
felixge
1
700
The power of node.js (with quadcopters)
felixge
0
540
Faster than C?
felixge
0
470
Other Decks in Technology
See All in Technology
React Compiler導入から21ヶ月、いま始めるならこうやる
astatsuya
2
250
なぜ、IAMロールのプリンシパルに*による部分マッチングが使えないのか? / 20260518-ssmjp-iam-role-principal
opelab
1
130
Purview 勉強会報告 Microsoft Purview 入門しようとしてみた
masakichixo
1
440
LookerとADKで作る社内AIエージェント
chanyou0311
0
260
10サービス以上のメール到達率改善を地道に継続的に進めている話 / Continue to improve email delivery rates across multiple services
yamaguchitk333
6
2.1k
おいらのAWSアップデートの追い方〜Slack×AgentCore〜
yakumo
1
110
Loadbalancing exporter internals
ymotongpoo
1
100
Terragrunt x Snowflake + dbt で作るマルチテナントなデータ基盤構築プラットフォーム
gak_t12
0
420
論文紹介:Pixal3D (SIGGRAPH 2026)
tenten0727
0
240
JTCでRedmine利用者2700人を実現した手法 第二部
nobuonakamura
0
130
最新技術を"今は選ばない"という技術選定
leveragestech
PRO
0
190
サイボウズ、プラットフォームエンジニアリング始めるってよ ― プラットフォームチームの事業貢献と組織アラインメントの強化
ueokande
0
120
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
690
エンジニアに許された特別な時間の終わり
watany
106
240k
So, you think you're a good person
axbom
PRO
2
2k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
550
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
SEO for Brand Visibility & Recognition
aleyda
0
4.5k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
180
Faster Mobile Websites
deanohume
310
31k
Test your architecture with Archunit
thirion
1
2.2k
Transcript
The Node.js Scalability Myth Felix Geisendörfer 26.04.2012 at MixIT Conference
(Lyon, France)
(@)felixge(.de)
core contributor
transloadit.com (using node since v0.0.6)
History
Ryan Dahl starts the node project (first commit) Feb 16,
2009
Discovered node.js (v0.0.6) ~June, 2009
None
Core Contributor & Module Author node-mysql node-formidable + 30 other
modules
Isaac Schlueter starts the npm package manager (first commit) Sep
29, 2009
Ryan’s talk at JSConf.EU gets people excited about node Nov
7, 2009
(c) @substack Jan 30, 2012 Ryan appoints Isaac to lead
node.js
Topic of this Talk
I need to build an über-scalable web service. It will
be the next big thing!
Easy! I will use node.js and MongoDB!
Easy! I will use node.js and MongoDB!
Because node.js is “scalable”, right?
None
Audience?
Node.js?
Are you measuring app performance in production?
1000 req / s
100 req / s
10 req / s
10 requests / per second = 864000 requests / day
10 req / s
The End?
I REALLY need to build an über-scalable web service!!11!1
Scalability
(c) @substack
The Node.js Scalability Myth • Threads don’t scale • Event
loops do
The Node.js Scalability Myth • Threads don’t scale • Event
loops do (Probably) not true in 2012 (Very likely) not relevant
More relevant • Understanding your tools • Using the right
tool for the job
Node’s Concurrency Model
Node’s Concurrency Model 1 var http = require('http'); 2 3
http.createServer(function(req, res) { 4 res.end('Hello World'); 5 }).listen(8080); server.js
Node’s Concurrency Model $ node server.js
Node’s Concurrency Model • Node loads server.js from disk ->
v8 compiles & executes • listen() allocates and binds a file descriptor • Event Loops starts running
Node’s Concurrency Model 1 while (true) { 2 int r
= select(nfds, readfds, writefds, errorfds, 0); 3 if (r === 0) { 4 continue; 5 } 6 7 // Figure out which fds had activity, accept() on server fds, read() on // connection fds, write() queued writes 8 } Abstracted by libuv Different on Windows
Node’s Concurrency Model • Cooperative multitasking • Low memory usage
• Fast / efficient • Simple (compared to threads)
Vertical Scalability
Adding more resources to a single node
Vertical Scalability • CPU • GPUs • Memory • Disk
• Network
CPU
CPU (v8) • V8 compiles JS to Assembly • Just-in-time
compilation (JIT) • Does pretty well in those language benchmarks
Computers of the future will have hundreds of cores!
CPU • Node is single threaded (runs on a single
CPU) • No shared memory
But ...
Does your problem require shared memory?
If yes: Don’t use node
And: Good Luck
If no: child_process.fork()
Redis / ZeroMQ are your friends
GPUs
GPUs • No support in node itself • node-cuda addon
by Kashif Rasul
Memory
Memory • No hard memory limit on 64 bit (since
node-0.6 / v8-3.7) • JS is a garbage collected language (avoid huge heaps) • Buffers do not count towards heap
Network
Network • Node’s concurrency model is optimized for networking •
Good at fully saturating available network resources
Disk
Disk • Done in thread pool • Unfortunately along with
DNS at this point • Throughput ok, but not ideal yet • sendfile() not working yet
Does node scale vertically?
Yeah, good enough
Horizontal Scalability
Adding more nodes to a system
Bad News
Node.js has no horizontal scaling features
Even worse
This s#@t is really hard
Problems • De-coupling / encapsulation • CAP Theorem • System
Automation
...
Good Luck
One tip
Monitor & Measure! • Collect: node-measured, statsd, ... • Analyze:
Graphite, Librato Metrics, ... • Debug
So if node doesn’t have magic scaling, what is it
good for?
<Live Coding>
tl;dr • Know your requirements • There are no silver
bullets
Questions? Slides will be available at felixge.de
Thanks
Feedback