Download - Hunting Performance Problems in Node.js
![Page 1: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/1.jpg)
@dkhan
![Page 2: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/2.jpg)
![Page 3: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/3.jpg)
![Page 4: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/4.jpg)
My Startup
![Page 5: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/5.jpg)
The moment that you find out about a problem …
![Page 6: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/6.jpg)
What is Node.js?
![Page 7: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/7.jpg)
Node.js is a C++ program controlled by V8 JavaScript
![Page 8: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/8.jpg)
![Page 9: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/9.jpg)
Your Code
Node Standard Library
Node Bindings
V8 Thread Pool Event Loop
JavaScript
C++
![Page 10: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/10.jpg)
![Page 11: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/11.jpg)
![Page 12: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/12.jpg)
![Page 13: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/13.jpg)
![Page 14: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/14.jpg)
![Page 15: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/15.jpg)
process.memoryUsage(){ rss: 4935680, heapTotal: 1826816, heapUsed: 650472 }
![Page 16: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/16.jpg)
![Page 17: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/17.jpg)
char * buffer;buffer = (char*) malloc (42);
// Do something with buffer
free (buffer);
Allocate
Deallocate
![Page 18: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/18.jpg)
![Page 19: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/19.jpg)
![Page 20: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/20.jpg)
![Page 21: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/21.jpg)
Scavenge Compact
![Page 22: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/22.jpg)
Mark Sweep
![Page 23: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/23.jpg)
node-gc-profiler
http://bit.ly/1Ll6dhb
![Page 24: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/24.jpg)
![Page 25: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/25.jpg)
![Page 26: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/26.jpg)
![Page 27: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/27.jpg)
![Page 28: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/28.jpg)
![Page 29: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/29.jpg)
![Page 30: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/30.jpg)
![Page 31: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/31.jpg)
![Page 32: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/32.jpg)
This is where I’ll spend my weekend
![Page 33: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/33.jpg)
http://bit.ly/1PvijIy
var snap = profiler.takeSnapshot();snap.serialize();
v8-profiler
![Page 34: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/34.jpg)
theThing = null;
![Page 35: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/35.jpg)
Delta
![Page 36: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/36.jpg)
![Page 37: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/37.jpg)
![Page 38: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/38.jpg)
![Page 39: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/39.jpg)
![Page 40: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/40.jpg)
calculateFibonacci();
![Page 41: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/41.jpg)
![Page 42: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/42.jpg)
http://bit.ly/1jQMbBR
profiler.startProfiling(id); profiler.stopProfiling(id);
v8-profiler
![Page 43: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/43.jpg)
![Page 44: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/44.jpg)
![Page 45: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/45.jpg)
![Page 46: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/46.jpg)
![Page 47: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/47.jpg)
![Page 48: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/48.jpg)
![Page 49: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/49.jpg)
NODE_ENV=productionNODE_ENV=development
Blog: http://bit.ly/1flz0Xm
![Page 50: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/50.jpg)
Let’s put this all together
Process v8-profiler
Memory Usage Heap Dumps
CPU Dumps
Chrome Developer Tools
Your Monitoring Dashboard
Trigger
![Page 51: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/51.jpg)
• ab –c 5 –n 10000 https://yoursite.com• JMeter• Keynote• http://bit.ly/1NkX1Ku
Do load testing!
![Page 52: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/52.jpg)
Slides? Blog!? Tweets?!!1
![Page 53: Hunting Performance Problems in Node.js](https://reader035.vdocument.in/reader035/viewer/2022081520/58a790ef1a28ab5f6c8b5491/html5/thumbnails/53.jpg)
Daniel Khan
@dkhan
http://apmblog.dynatrace.com/author/daniel-khan/
Thank you!