Debugging Node.js in Production (Fluent slides)

Thanks to all who attended my talk at Fluent today on “Debugging Node.js in Production”. The slides are available here. There’s some extra content there that I didn’t have time to cover in just 40 minutes, most notably some implementation notes about mdb_v8 and the DTrace ustack helper. Please leave questions, comments, or feedback below (or @dapsays)!

Posted on May 31, 2012 at 4:43 pm by dap · Permalink
In: Node.js

2 Responses

Subscribe to comments via RSS

  1. Written by Geoff Flarity
    on June 1, 2012 at 10:15 am

    Thanks for posting an answering questions.

    1) The fact V8 JIT compiles javascript to optimized assembly makes it very fast. However in JavaScript ‘Numbers’ are really doubles and this limits the biggest integer a number can store. This is one reason to use C over JavaScript (assuming this is an issue for your problem). Are there other gotchas like this? I guess what I’m looking for is more insight into when Node can replace something in C.

    2) You list a bunch core infrastructure being displaced by node. Is the source code for this stuff available, if not can you tell us how many lines of code the generic bits are?

  2. Written by dap
    on June 1, 2012 at 12:06 pm


    Good questions. In JS, integers up to 2^53 are represented exactly, and V8 uses ints under the hood at least up to 2^31 for performance. The only place I know we’ve run into numbers that large that must be represented exactly in our systems are in stat counters that count nanoseconds or bytes transferred since system boot. The other big “gotcha” is not exactly language-specific, but relates to the concurrency model: while the event-oriented model has a lot of upsides, you still have to consider what happens when you do reach capacity. Often this leads to growing queues that exhaust all available memory. Such failure modes need to be planned for, monitored, and dealt with differently. I’m not sure what other “gotchas” there are — to some extent, that depends on the kind of software you’re building.

    As for the pieces I mentioned, some are open source:
    DNS (still a work in progress):

    Our DHCP server is not open, more for reasons of apathy and because it’s pretty special-purpose, but it’s about 2100 LOC.

    I neglected to mention a small ssh agent module we’re using:
    This makes use of a great module called node-ctype that makes it easy to translate JS objects to C structs and vice versa.


Subscribe to comments via RSS