Talk given at the Munich Node.js Meetup on 14.06.2012.
The Node.jsScalabilityMythFelix Geisendörfer14.06.2012 at Munich node.js user group
View Slide
Felix Geisendörfer
transloadit.com
core contributor
npm modules
node-formidable
node-mysql
~50 modules total
(@)felixge(.de)
Background
I need to build anüber-scalable webservice. It will bethe next big thing!
Easy! I will usenode.js andMongoDB!
Because node.js is“scalable”, right?
This Talk
#1Consider Reality
Using node forperformancereasons?
Measuringperformance inproduction?
1000req / s
100req / s
10req / s10req / s
~1 millionrequests perday
~1 millionunits of value
#2Node ScalesVertically
Adding more resourcesto a single node
CPU
Google V8
JS -> Assembly
Crankshaft JIT
Fast
Single Threaded** For most parts
Computers of thefuture will havehundreds of cores!
Node’s Multi-Core Story
Pre-fork
IPC
Like Ruby, Python,PHP, etc.
But ... shared memory?
Your problem requiresshared memory?
JavaScriptis not your language
Good Luck
Memory
No hard limit on 64bit(since node-0.6 / v8-3.7)
However
Avoid huge heaps
Disk
Done in thread pool
Along with DNS
No sendfile()
Network
Non-blocking I/O
tl;dr
pre-fork&non-blocking i/o
#3HorizontalScaling is hard
CAP
NetworkPartitions
Consistency
Availability
Some Tips
SharedNothing
Messaging
Monitoring
The Node.jsScalabilityMyth
Threads do not scaleNode.js scales
Node is a tool
If you can’t duc itF#@k it
Questions?Slides will be available at felixge.de
Thanks
Tool Demo