Upload
codemotion
View
324
Download
1
Embed Size (px)
Citation preview
Hunting Performance Problems in Node.jsCodeMotion Amsterdam 2016
Daniel Khan | @dkhan
Node.js is what the Company Outlaws
use to finally introduce change
Node.js is what the Company Hipsters threw in
just to break everything
Proactive Defense
Node.js is a C++ program controlled by V8 JavaScript
Hunting Memory Problems
process.memoryUsage(){ rss: 4935680, heapTotal: 1826816, heapUsed: 650472 }
How to build a Memory Leak
theThing
someMethod()
longStr
unused()
originalThing
Closure Context
Reference
Root
http://bit.ly/1PvijIy
var snap = profiler.takeSnapshot();snap.serialize();
v8-profiler
Delta
Hunting CPU Problems
calculateFibonacci();
http://bit.ly/1jQMbBR
profiler.startProfiling(id); profiler.stopProfiling(id);
v8-profiler
NODE_ENV=productionNODE_ENV=development
Blog: http://bit.ly/1flz0Xm
get(‘/routeA’, function(){})
get(‘/routeB’, function(){})
get(‘/routeC’, function(){})
get(‘/routeD’, function(){})
get(‘/routeE’, function(){})
get(‘/routeA’, function(){})
get(‘/routeX’, function(){})
get(‘/^(route|router)\/(.+)’, function(){})
HTTP GET /routeX
get(‘/routeA’, function(){})
get(‘/routeX’, function(){})
O(n)
Finding the route
1980 20001995 2005 2010 2015
Stakeholders
Browser Webserver Node Java Oracle
“No man is an island”or … We need a holistic view.
Meet Application Performance Monitoring
Takeaways• Node.js introduces change• Use dedicated tools like N|Solid to monitor Node.js specific metrics like CPU and Memory
Usage• 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