beyond profilers: tracing node.js transactions
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
Beyond Profilers:Tracing Node.js Transactions
TR JordanOctober 2014
users’ data
users
webserver
application
cachedatabase
external API
internet
browser
users
webserver
application
cachedatabase
external API
internet
browser
users
Throughput vs. Network Capacity
webserver
application
cachedatabase
external API
internet
browser
users
webserver
application
cachedatabase
external API
browser
users
internet
Request ID+
Operation IDs+
Other Stuff™
Code
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; };});
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) }})
Challenges
Initial Function
Callback
Callback
Callback
Callback
User
Initial Function
Callback
Callback
Callback
Callback
User
Node
QueueWork Callback
NodeC++ OS
QueueWork Callback
Initial Function
Callback
Callback
Callback
Callback
User
Tracelyzer via UDP
Tracelyzer via UDP
500
Thanks!Connect.
Read.
• On the Blog:happneta.com/blog/x-trace-introduction/
• On GitHub:github.com/appneta/node-traceview
We’re Hiring!