Top Banner
Hunting Performance Problems in Node.js APAC Tour 2016 Daniel Khan | @dkhan
64

Don't let just Node.js take the blame

Feb 18, 2017

Download

Internet

Daniel Khan
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Don't let just Node.js take the blame

Hunting Performance Problems in Node.jsAPAC Tour 2016

Daniel Khan | @dkhan

Page 2: Don't let just Node.js take the blame

@dkhan

Daniel [email protected]

Page 3: Don't let just Node.js take the blame

Node.js is what the Company Outlaws

use to finally introduce change

Page 4: Don't let just Node.js take the blame
Page 5: Don't let just Node.js take the blame
Page 6: Don't let just Node.js take the blame
Page 7: Don't let just Node.js take the blame

Node.js is what the Company Hipsters threw in

just to break everything

Page 8: Don't let just Node.js take the blame
Page 9: Don't let just Node.js take the blame

Proactive Defense

Page 10: Don't let just Node.js take the blame
Page 11: Don't let just Node.js take the blame

Node.js is a C++ program controlled by V8 JavaScript

Page 12: Don't let just Node.js take the blame
Page 13: Don't let just Node.js take the blame
Page 14: Don't let just Node.js take the blame
Page 15: Don't let just Node.js take the blame

Hunting Memory Problems

Page 16: Don't let just Node.js take the blame
Page 17: Don't let just Node.js take the blame

process.memoryUsage(){ rss: 4935680, heapTotal: 1826816, heapUsed: 650472 }

Page 18: Don't let just Node.js take the blame
Page 19: Don't let just Node.js take the blame
Page 20: Don't let just Node.js take the blame
Page 21: Don't let just Node.js take the blame
Page 22: Don't let just Node.js take the blame
Page 23: Don't let just Node.js take the blame

theThing

someMethod()

longStr

unused()

originalThing

Closure Context

Reference

Root

Page 24: Don't let just Node.js take the blame
Page 25: Don't let just Node.js take the blame
Page 26: Don't let just Node.js take the blame
Page 27: Don't let just Node.js take the blame
Page 28: Don't let just Node.js take the blame

http://bit.ly/1PvijIy

var snap = profiler.takeSnapshot();snap.serialize();

v8-profiler

Page 29: Don't let just Node.js take the blame

Delta

Page 30: Don't let just Node.js take the blame

Hunting CPUProblems

Page 31: Don't let just Node.js take the blame
Page 32: Don't let just Node.js take the blame

calculateFibonacci();

Page 33: Don't let just Node.js take the blame

http://bit.ly/1jQMbBR

profiler.startProfiling(id); profiler.stopProfiling(id);

v8-profiler

Page 34: Don't let just Node.js take the blame
Page 35: Don't let just Node.js take the blame
Page 36: Don't let just Node.js take the blame
Page 37: Don't let just Node.js take the blame
Page 38: Don't let just Node.js take the blame
Page 39: Don't let just Node.js take the blame

NODE_ENV=productionNODE_ENV=development

Blog: http://bit.ly/1flz0Xm

Page 40: Don't let just Node.js take the blame
Page 41: Don't let just Node.js take the blame
Page 42: Don't let just Node.js take the blame
Page 43: Don't let just Node.js take the blame
Page 44: Don't let just Node.js take the blame
Page 45: Don't let just Node.js take the blame
Page 46: Don't let just Node.js take the blame

Border Defense

Page 47: Don't let just Node.js take the blame

1980 20001995 2005 2010 2015

Stakeholders

Page 48: Don't let just Node.js take the blame
Page 49: Don't let just Node.js take the blame

“No man is an island”or … We need a holistic view.

Page 50: Don't let just Node.js take the blame

Browser Webserver Node Java Oracle

Page 51: Don't let just Node.js take the blame

Meet Application Performance Monitoring

Page 52: Don't let just Node.js take the blame
Page 53: Don't let just Node.js take the blame
Page 54: Don't let just Node.js take the blame

Node.js

Page 55: Don't let just Node.js take the blame
Page 56: Don't let just Node.js take the blame
Page 57: Don't let just Node.js take the blame
Page 58: Don't let just Node.js take the blame
Page 59: Don't let just Node.js take the blame

Transactional Tracing and Node.js

Page 60: Don't let just Node.js take the blame
Page 61: Don't let just Node.js take the blame
Page 62: Don't let just Node.js take the blame
Page 63: Don't let just Node.js take the blame

Takeaways• Node.js introduces change• If something breaks within Node.js it’s most probably a memory leak or a CPU hog• Protect your boundaries by actively monitoring incoming and outgoing transactions• Use APM Solutions like Dynatrace or Ruxit to get a holistic view for all transactions passing

through all tiers of your stack• There is more to come when Node.js’ tracing capabilities mature

Page 64: Don't let just Node.js take the blame

[email protected]

@dkhan