Dont let just Node.js Take the Blame @NodeInteractive Austin

74

Transcript of Dont let just Node.js Take the Blame @NodeInteractive Austin

Page 1: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 2: Dont let just Node.js Take the Blame @NodeInteractive Austin

Don’t let just Node.js take the Blame

Daniel Khan, Dynatrace

Page 3: Dont let just Node.js Take the Blame @NodeInteractive Austin

@dkhan

Page 4: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 5: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 6: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 7: Dont let just Node.js Take the Blame @NodeInteractive Austin

@dkhan

Page 8: Dont let just Node.js Take the Blame @NodeInteractive Austin

Node.js is what the Company Outlaws

use to finally introduce change

Page 9: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 10: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 11: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 12: Dont let just Node.js Take the Blame @NodeInteractive Austin

Node.js is what the Company Hipsters threw in

just to break everything

Page 13: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 14: Dont let just Node.js Take the Blame @NodeInteractive Austin

Proactive Defense

Page 15: Dont let just Node.js Take the Blame @NodeInteractive Austin

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

Page 16: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 17: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 18: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 19: Dont let just Node.js Take the Blame @NodeInteractive Austin

Hunting Memory Problems

Page 20: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 21: Dont let just Node.js Take the Blame @NodeInteractive Austin

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

Page 22: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 23: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 24: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 25: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 26: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 27: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 28: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 29: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 30: Dont let just Node.js Take the Blame @NodeInteractive Austin

How to build a Memory Leak

Page 31: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 32: Dont let just Node.js Take the Blame @NodeInteractive Austin

theThing

someMethod()

longStr

unused()

originalThing

Closure Context

Reference

Root

Page 33: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 34: Dont let just Node.js Take the Blame @NodeInteractive Austin

http://bit.ly/1PvijIy

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

v8-profiler

Page 35: Dont let just Node.js Take the Blame @NodeInteractive Austin

Delta

Page 36: Dont let just Node.js Take the Blame @NodeInteractive Austin

Hunting CPU Problems

Page 37: Dont let just Node.js Take the Blame @NodeInteractive Austin

The Node.js Event Loop!

Page 38: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 39: Dont let just Node.js Take the Blame @NodeInteractive Austin

calculateFibonacci();

Page 40: Dont let just Node.js Take the Blame @NodeInteractive Austin

http://bit.ly/1jQMbBR

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

v8-profiler

Page 41: Dont let just Node.js Take the Blame @NodeInteractive Austin

NODE_ENV=productionNODE_ENV=development

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

NODE_ENV=development NODE_ENV=production

Page 42: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 43: Dont let just Node.js Take the Blame @NodeInteractive Austin

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)

Page 44: Dont let just Node.js Take the Blame @NodeInteractive Austin

Finding the route

Page 45: Dont let just Node.js Take the Blame @NodeInteractive Austin

Tools for Node.js Monitoring

Page 46: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 47: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 48: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 49: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 50: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 51: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 52: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 53: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 54: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 55: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 56: Dont let just Node.js Take the Blame @NodeInteractive Austin

1980 20001995 2005 2010 2015

Stakeholders

Page 57: Dont let just Node.js Take the Blame @NodeInteractive Austin

Backpressure

Page 58: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 59: Dont let just Node.js Take the Blame @NodeInteractive Austin

1000 RPS

Node.js

10 RPS

Ancient Legacy Backend

Page 60: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 61: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 62: Dont let just Node.js Take the Blame @NodeInteractive Austin

Browser Webserver Node Java Oracle

Page 63: Dont let just Node.js Take the Blame @NodeInteractive Austin

We who cut mere stones must always be envisioning cathedrals.

—Quarry worker's creed

Page 64: Dont let just Node.js Take the Blame @NodeInteractive Austin

Meet Application Performance Monitoring

Page 65: Dont let just Node.js Take the Blame @NodeInteractive Austin

Transactional Tracing in Node.js

Page 66: Dont let just Node.js Take the Blame @NodeInteractive Austin

Complete Transaction CoverageBrowser / Native Mobile Java/

.NET

PerformanceWarehouse

PurePathCollector

DynatraceServer

DynatraceClient

SessionsStore

ExportedSession

OfflineSession Analysis

Web Server/ PHP/ Node.js

C++, VB, ADK

CICS

Mainframez/OS

MQ/ESB

Database

Page 67: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 68: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 69: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 70: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 71: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 72: Dont let just Node.js Take the Blame @NodeInteractive Austin
Page 73: Dont let just Node.js Take the Blame @NodeInteractive Austin

Dedi

cate

d M

onito

ring

and

Debu

ggin

g To

ols

Summary

Use Tracing Tools that follow your Transactions

Page 74: Dont let just Node.js Take the Blame @NodeInteractive Austin

@dkhan

Daniel [email protected]