288 1 21347
Yunong Xiao shares the tools and methodologies Netflix uses in production to diagnose and fix performance issues, bugs and memory leaks -- all without having to restart or change the Node application. Details include profiling and post mortem tools such as perf events and mdb, visualizations like flame graphs and latency distributions, and how they help Netflix keep it's Node stack efficient.
By oneweekwonder 2018-03-14
Whenever I see something like this I think of the 2015 video netflix gave also using flamegraphs but for node.
Personally I want something like this for py.
In searching for the vid I see netflix also have a medium post(2014) about it.
By anonymous 2017-09-20
A lot of great answers here, but I'd like to add my view (based on how my approach evolved)
Let's face it, we all love a good
console.log('Uh oh, if you reached here, you better run.') and sometimes that works great, so if you're reticent to move too far away from it at least add some bling to your logs with Visionmedia's debug.
As handy as console logging can be, to debug professionally you need to roll up your sleeves and get stuck in. Set breakpoints, step through your code, inspect scopes and variables to see what's causing that weird behaviour. As others have mentioned, node-inspector really is the bees-knees. It does everything you can do with the built-in debugger, but using that familiar Chrome DevTools interface. If, like me, you use Webstorm, then here is a handy guide to debugging from there.
By default, we can't trace a series of operations across different cycles of the event loop (ticks). To get around this have a look at longjohn (but not in production!).
With Node.js we can have a server process expected to stay up for considerable time. What do you do if you think it has sprung some nasty leaks? Use heapdump and Chrome DevTools to compare some snapshots and see what's changing.
For some useful articles, check out
If you feel like watching a video(s) then
- Netflix JS Talks - Debugging Node.js in Production
- Interesting video from the tracing working group on tracing and debugging node.js
- Really informative 15-minute video on node-inspector
Whatever path you choose, just be sure you understand how you are debugging
It is a painful thing
To look at your own trouble and know
That you yourself and no one else has made it