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
Troubleshooting Node.js
Search
Igor Soarez
July 23, 2015
Programming
0
260
Troubleshooting Node.js
what to do when things go wrong
Igor Soarez
July 23, 2015
Tweet
Share
Other Decks in Programming
See All in Programming
デミカツ切り抜きで面倒くさいことはPythonにやらせよう
aokswork3
0
250
CSC509 Lecture 03
javiergs
PRO
0
340
あなたとKaigi on Rails / Kaigi on Rails + You
shimoju
0
170
登壇は dynamic! な営みである / speech is dynamic
da1chi
0
350
Foundation Modelsを実装日本語学習アプリを作ってみた!
hypebeans
0
120
『毎日の移動』を支えるGoバックエンド内製開発
yutautsugi
2
250
All About Angular's New Signal Forms
manfredsteyer
PRO
0
190
ソフトウェア設計の実践的な考え方
masuda220
PRO
4
610
他言語経験者が Golangci-lint を最初のコーディングメンターにした話 / How Golangci-lint Became My First Coding Mentor: A Story from a Polyglot Programmer
uma31
0
250
開発生産性を上げるための生成AI活用術
starfish719
3
1.4k
PHPに関数型の魂を宿す〜PHP 8.5 で実現する堅牢なコードとは〜 #phpcon_hiroshima / phpcon-hiroshima-2025
shogogg
1
270
Flutterで分数(Fraction)を表示する方法
koukimiura
0
130
Featured
See All Featured
Leading Effective Engineering Teams in the AI Era
addyosmani
7
480
Balancing Empowerment & Direction
lara
5
690
Fireside Chat
paigeccino
40
3.7k
Building Applications with DynamoDB
mza
96
6.7k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.2k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
A better future with KSS
kneath
239
18k
Gamification - CAS2011
davidbonilla
81
5.5k
It's Worth the Effort
3n
187
28k
A designer walks into a library…
pauljervisheath
209
24k
Mobile First: as difficult as doing things right
swwweet
225
10k
Code Review Best Practice
trishagee
72
19k
Transcript
TROUBLESHOOTING NODE.JS what to do when things go wrong Igor
Soarez
[email protected]
@igorsoarez Hassy Veldstra
[email protected]
@hveldstra WDCNZ, July 2015
HELLO HELLO • YLD! • Node.js Consultancy & Training •
Digital transformation for enterprise clients
FIRES Someone has to put them out
BE PREPARED
LOG EVERYTHING Make it easy to grep & visualise
TEST TEST TEST • Functional tests first • Good coverage
for unit tests • Randomised testing & fuzz testing
MONITORING & ALERTING • Resource monitoring • CPU • Memory
• I/O • Application monitoring • Errors • Real-user monitoring • Latency • Availability
AUTOMATED DEPLOYMENTS
PAIR PROGRAMMING
TAKE YOUR TIME WHEN BUILDING YOUR APPLICATION Tight deadlines are
the root of all evil
LOAD TESTING
LOAD TESTING • You should do it
LOAD TESTING • You should do it • Find the
bottlenecks
LOAD TESTING • You should do it • Find the
bottlenecks • Understand your system
LOAD TESTING • You should do it • Find the
bottlenecks • Understand your system
LOAD TESTING
LOAD TESTING
YOU SHOULD DO IT IN PRODUCTION
IN PRODUCTION??? I must have heard you wrong
WHY NOT? Why — Reason 1
STAGING IS NEVER THE SAME Why — Reason 1I
GAIN EXTRA CONFIDENCE Why — Reason 1II
IF YOU DO THIS • Analytics
IF YOU DO THIS • Analytics • Custom header •
Cookie
IF YOU DO THIS • Analytics • Custom header •
Cookie • Let Marketing know
IF YOU DO THIS • Analytics • Custom header •
Cookie • Let Marketing know • Start outside of peak times
IF YOU DO THIS • Analytics • Custom header •
Cookie • Let Marketing know • Start outside of peak times • Start slow & ramp up
LOAD TESTING TOOLS • JMeter
LOAD TESTING TOOLS • JMeter • Tsung
LOAD TESTING TOOLS • JMeter • Tsung • Minigun -
https://artillery.io/minigun
AFTER THE FIRE STARTS how to approach it
PERFORMANCE PROBLEMS
ATTACK THE PROBLEM 1. Isolated test case * 2. Measure
3. Change / Tweak / Improve 4. Goto 2 * If possible
TYPES OF ISSUES • CPU-bound code • Memory leaks •
GC pressure • I/O performance • Event loop lag (Node.js)
KNOW THE TOOLS AVAILABLE • OS-level • perf • sysstat,
netstat, netmon, ps, top • sysdig
KNOW THE TOOLS AVAILABLE • Platform-specific (Node.js)
KNOW THE TOOLS AVAILABLE • Platform-specific (Node.js) • V8 profiler
• find hot-path functions that cannot be optimized • trace GC activity
KNOW THE TOOLS AVAILABLE • Platform-specific (Node.js) • V8 profiler
• find hot-path functions that cannot be optimized • trace GC activity • heapdump • find memory leaks
MEMORY • ps • top / htop • Heapdumps
KNOW THE TOOLS AVAILABLE • Platform-specific (Node.js) • V8 profiler
• find hot-path functions that cannot be optimized • trace GC activity • heapdump • find memory leaks • flamegraphs • see what's hot on the CPU
CPU • ps • top / htop • Flamegraphs
KNOW THE TOOLS AVAILABLE • Platform-specific (Node.js) • V8 profiler
• find hot-path functions that cannot be optimized • trace GC activity • heapdump • find memory leaks • flamegraphs • see what's hot on the CPU • node-toobusy-js • track the event loop lag
FLAMEGRAPHS
PERF aka Performance Counters
Collected stack frames h() c() h() c() c() z() c()
b() f() b() b() f() b() y() b() b() a() a() a() m() a() m() x() m() a() main() main() main() main() main() main() main() main() main()
Collapsed stack frames h() c() h() c() z() b() f()
b() y() a() m() x() main()
DEMO!
THANK YOU! @hveldstra @igorsoarez