beyond profilers: tracing node.js transactions

30
Beyond Profilers: Tracing Node.js Transactions TR Jordan October 2014

Upload: terral-r-jordan

Post on 19-Jun-2015

237 views

Category:

Software


0 download

DESCRIPTION

Node.js is fast, but once the code is in production, how can you make sure it's still fast? In this talk from the Boston node.js meetup on October 9th, I talk about various strategies for monitoring node in production, with an obvious bias towards transaction tracing.

TRANSCRIPT

Page 1: Beyond Profilers: Tracing Node.js Transactions

Beyond Profilers:Tracing Node.js Transactions

TR JordanOctober 2014

Page 2: Beyond Profilers: Tracing Node.js Transactions

users’ data

users

Page 3: Beyond Profilers: Tracing Node.js Transactions

webserver

application

cachedatabase

external API

internet

browser

users

Page 4: Beyond Profilers: Tracing Node.js Transactions

webserver

application

cachedatabase

external API

internet

browser

users

Page 5: Beyond Profilers: Tracing Node.js Transactions

Throughput vs. Network Capacity

Page 6: Beyond Profilers: Tracing Node.js Transactions

webserver

application

cachedatabase

external API

internet

browser

users

Page 7: Beyond Profilers: Tracing Node.js Transactions
Page 8: Beyond Profilers: Tracing Node.js Transactions
Page 9: Beyond Profilers: Tracing Node.js Transactions
Page 10: Beyond Profilers: Tracing Node.js Transactions
Page 11: Beyond Profilers: Tracing Node.js Transactions

webserver

application

cachedatabase

external API

browser

users

internet

Page 12: Beyond Profilers: Tracing Node.js Transactions

Request ID+

Operation IDs+

Other Stuff™

Page 13: Beyond Profilers: Tracing Node.js Transactions
Page 14: Beyond Profilers: Tracing Node.js Transactions
Page 15: Beyond Profilers: Tracing Node.js Transactions
Page 16: Beyond Profilers: Tracing Node.js Transactions
Page 17: Beyond Profilers: Tracing Node.js Transactions
Page 18: Beyond Profilers: Tracing Node.js Transactions

Code

Page 19: Beyond Profilers: Tracing Node.js Transactions

var http = require('http');var shimmer = require('shimmer');

shimmer.wrap(http, 'request', function (original) { return function () { console.log("Starting request!"); var returned = original.apply(this, arguments) console.log("Done setting up request"); return returned; };});

Page 20: Beyond Profilers: Tracing Node.js Transactions

shimmer.wrap(collection.prototype, 'update', function (fn) { return function (query, doc, options, callback) { if (typeof options === 'function') { callback = options options = {} } var run = fn.bind(this, query, doc, options) return attempt(run, this.collectionName, this.db, { QueryOp: 'update', Query: JSON.stringify(query), Update_Document: JSON.stringify(doc) }, callback) }})

Page 21: Beyond Profilers: Tracing Node.js Transactions

Challenges

Page 22: Beyond Profilers: Tracing Node.js Transactions

Initial Function

Callback

Callback

Callback

Callback

User

Page 23: Beyond Profilers: Tracing Node.js Transactions

Initial Function

Callback

Callback

Callback

Callback

User

Page 24: Beyond Profilers: Tracing Node.js Transactions

Node

QueueWork Callback

Page 25: Beyond Profilers: Tracing Node.js Transactions

NodeC++ OS

QueueWork Callback

Page 26: Beyond Profilers: Tracing Node.js Transactions
Page 27: Beyond Profilers: Tracing Node.js Transactions

Initial Function

Callback

Callback

Callback

Callback

User

Page 28: Beyond Profilers: Tracing Node.js Transactions

Tracelyzer via UDP

Page 29: Beyond Profilers: Tracing Node.js Transactions

Tracelyzer via UDP

500

Page 30: Beyond Profilers: Tracing Node.js Transactions

Thanks!Connect.

@[email protected]

Read.

• On the Blog:happneta.com/blog/x-trace-introduction/

• On GitHub:github.com/appneta/node-traceview

We’re Hiring!