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
Scaling NodeJS beyond the ordinary
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Abhinav Rastogi
March 02, 2018
Technology
0
310
Scaling NodeJS beyond the ordinary
These are the slides to accompany the talk I gave at JSConf Iceland 2018.
Abhinav Rastogi
March 02, 2018
Tweet
Share
More Decks by Abhinav Rastogi
See All by Abhinav Rastogi
Next Gen Web: Scaling Progressive Web Apps
abhinavrastogi
57
14k
Other Decks in Technology
See All in Technology
フロントエンド刷新 4年間の軌跡
yotahada3
0
470
ソフトバンク流!プラットフォームエンジニアリング実現へのアプローチ
sbtechnight
1
180
OSC仙台プレ勉強会 AlmaLinuxとは
koedoyoshida
0
180
[JAWSDAYS2026]Who is responsible for IAM
mizukibbb
0
780
わからなくて良いなら、わからなきゃだめなの?
kotaoue
1
370
【Oracle Cloud ウェビナー】【入門編】はじめてのOracle AI Data Platform - AIのためのデータ準備&自社用AIエージェントをワンストップで実現
oracle4engineer
PRO
1
150
1GB RAMのラズピッピで何ができるのか試してみよう / 20260319-rpijam-1gb-rpi-whats-possible
akkiesoft
0
100
GCASアップデート(202601-202603)
techniczna
0
200
Kiro Powers 入門
k_adachi_01
0
100
Keycloak を使った SSO で CockroachDB にログインする / CockroachDB SSO with Keycloak
kota2and3kan
0
150
us-east-1 に障害が起きた時に、 ap-northeast-1 にどんな影響があるか 説明できるようになろう!
miu_crescent
PRO
13
4.4k
JAWS DAYS 2026 ExaWizards_20260307
exawizards
0
440
Featured
See All Featured
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
250
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.3k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
200
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
390
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
980
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
140
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
160
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.5k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Tell your own story through comics
letsgokoyo
1
850
Agile that works and the tools we love
rasmusluckow
331
21k
Transcript
Scaling NodeJS Beyond the ordinary Abhinav Rastogi Lead UI Engineer
_abhinavrastogi
None
150M Registered Users 500K Phones sold in 15 seconds 200M
Visits over 5 days during annual sale event
– Andre Bondi “Scalability is the capability of a system
to handle a growing amount of work, or its potential to be enlarged to accommodate that growth.”
Why should it concern the JS community?
Why should it concern the JS community? • JS is
running on servers now • Failure is shifting to application code • Failure is better handled by devs
Types of Scalability x y z Add more machines Add
more resources Application layer
Horizontal Scaling
Horizontal Scaling Machine Node API
Horizontal Scaling Machine Node API Machine Node ELB
Vertical Scaling
Vertical Scaling Machine Node API
Vertical Scaling Machine Node API Node ??
Application Layer Optimisations
The Optimisation Cycle Load Test Find Bottleneck Fix Issues
network, cpu, memory, disk
network bandwidth
network bandwidth
1000 kb per page 100 rps per machine 100 machines
= 10gbps
compression
const app = express() app.use(compression)
co-hosted nginx
co-hosted nginx Machine Node Node PM2 nginx API ELB
network profiling
netstat / ss lsof watch
everything is a file in unix!
ulimit
ulimit core file size (blocks, -c) 0 file size (blocks,
-f) unlimited pending signals (-i) 32767 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 1024 max user processes (-u) 50
increase the limits / reduce the usage
keep-alive header
keep-alive header Object.assign(headers, { 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=200' });
connection pooling
connection pooling const http = require('http'); fetch(url, { agent: new
http.Agent({ keepAlive: true, maxSockets: 24 }) });
ephemeral ports
tcp connection states
tcp connection states source: http://cnp3book.info.ucl.ac.be/1st/html/transport/transport.html
tcp connection states
cpu
cpu profiling
node --prof app.js
import crypto from 'crypto'; app.get('/auth', (req, res) => { const
hash = crypto.pbkdf2Sync(password, users[username].salt, 100, 512); if (users[username].hash.toString() === hash.toString()) { res.sendStatus(200); } else { res.sendStatus(401); } });
[Summary]: ticks total nonlib name 79 0.2% 0.2% JavaScript 36703
97.2% 99.2% C++ 7 0.0% 0.0% GC 767 2.0% Shared libraries 215 0.6% Unaccounted
[C++]: ticks total nonlib name 19557 51.8% 52.9% node::crypto::PBKDF2(v8) 4510
11.9% 12.2% _sha1_block_data_order 3165 8.4% 8.6% _malloc_zone_malloc
None
$ npm install -g 0x $ 0x app.js
None
disk
memory
real-time monitoring
load, profile, fix, repeat!
thank you @_abhinavrastogi http://tiny.cc/scalingnodejs