Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Troubleshooting Node.js

Troubleshooting Node.js

what to do when things go wrong

Igor Soarez

July 23, 2015
Tweet

Other Decks in Programming

Transcript

  1. TROUBLESHOOTING NODE.JS what to do when things go wrong Igor

    Soarez [email protected] @igorsoarez Hassy Veldstra [email protected] @hveldstra WDCNZ, July 2015
  2. HELLO HELLO • YLD! • Node.js Consultancy & Training •

    Digital transformation for enterprise clients
  3. TEST TEST TEST • Functional tests first • Good coverage

    for unit tests • Randomised testing & fuzz testing
  4. MONITORING & ALERTING • Resource monitoring • CPU • Memory

    • I/O • Application monitoring • Errors • Real-user monitoring • Latency • Availability
  5. LOAD TESTING • You should do it • Find the

    bottlenecks • Understand your system
  6. LOAD TESTING • You should do it • Find the

    bottlenecks • Understand your system
  7. IF YOU DO THIS • Analytics • Custom header •

    Cookie • Let Marketing know • Start outside of peak times
  8. IF YOU DO THIS • Analytics • Custom header •

    Cookie • Let Marketing know • Start outside of peak times • Start slow & ramp up
  9. ATTACK THE PROBLEM 1. Isolated test case * 2. Measure

    3. Change / Tweak / Improve 4. Goto 2 * If possible
  10. TYPES OF ISSUES • CPU-bound code • Memory leaks •

    GC pressure • I/O performance • Event loop lag (Node.js)
  11. KNOW THE TOOLS AVAILABLE • Platform-specific (Node.js) • V8 profiler

    • find hot-path functions that cannot be optimized • trace GC activity
  12. 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
  13. 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
  14. 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
  15. 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()