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
Abhinav Rastogi
March 02, 2018
Technology
320
0
Share
Scaling NodeJS beyond the ordinary
These are the slides to accompany the talk I gave at JSConf Iceland 2018.
Abhinav Rastogi
March 02, 2018
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
全社統制を維持しながら現場負担をどう減らすか〜プラットフォームチームとセキュリティチームで進めたSecurity Hub活用によるAWS統制の見直し〜/secjaws-security-hub-custom-insights
mhrtech
1
550
AIAgentと取り組むKaggle
508shuto
2
190
"うちにはまだ早い"は本当? ─ 小さく始めるPlatform Engineering入門
harukasakihara
6
620
AI飲み会幹事エージェントを作っただけなのに
ykimi
0
230
2026-05-14 要件定義からソース管理まで!IBM Bob基礎ハンズオン
yutanonaka
0
160
O'Reilly Infrastructure & Ops Superstream: Platform Engineering for Developers, Architects & the Rest of Us
syntasso
0
230
Databricks 月刊サービスアップデートまとめ 2026年04月号
tyosi1212
0
130
エムスリーテクノロジーズ株式会社 エンジニア向け紹介資料 / M3 Technologies Company Deck
m3_engineering
0
180
Purview Endpoint DLP 動かしてみた
kozakigh
0
440
Gaussian Splattingの表現力を拡張する — 高周波再構成とインタラクションへのアプローチ —
gpuunite_official
0
190
データモデリング通り #5オンライン勉強会: AIに『ビジネスの文脈』を教え込むデータモデリング
datayokocho
0
290
PdM・Eng・QAで進めるAI駆動開発の現在地/aidd-with-pdm-eng-qa
shota_kusaba
0
250
Featured
See All Featured
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.2k
Music & Morning Musume
bryan
47
7.2k
4 Signs Your Business is Dying
shpigford
187
22k
Utilizing Notion as your number one productivity tool
mfonobong
4
300
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
380
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
The Cult of Friendly URLs
andyhume
79
6.9k
The Pragmatic Product Professional
lauravandoore
37
7.3k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
360
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
360
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
44k
The Cost Of JavaScript in 2023
addyosmani
55
9.9k
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