Workshop: Production Diagnostics for Node Applications

Location: Victoria, 2nd flr.

Duration: 1:00pm - 4:00pm

Day of week: Thursday

Level: Intermediate

Prerequisites

  • experience with Node.js application development or operations
  • bring a laptop with a modern browser - hands-on labs will be performed through the browser

Node.js, the popular cross-platform JavaScript server framework, has grown in popularity and scale to the point where very challenging, non-trivial, production-only issues pop up in complex deployment environments. Although Node.js is equipped with the built-in V8 profiler, it is limited in scope to CPU time, which doesn’t account for the majority of Node.js performance issues. Also, profiling in production environments requires non-invasive tools with a low overhead, which do not require an application restart for the sake of profiling. In this workshop, we will learn, understand, and experiment with Node.js profiling tools designed for production use.

We will experiment with the built-in V8 profiler, and learn how to analyze its log output to zoom-in on CPU hot-spots in the V8 runtime, your JavaScript code, or external modules. We will also explore the Linux perf multi-tool, which can perform general-purpose CPU profiling, and how to get the Node.js runtime to generate symbolic information required to resolve stack traces emitted by perf. We will visualize stack traces using flame graphs, and understand where the CPU bottlenecks lie. We will also look at core dump analysis for crashes and memory leaks, and identify heap objects using the llnode plugin for lldb. In the second half of this workshop, we will talk about more complicated scenarios: diagnosing intermittent errors when connecting to a database or running queries, monitoring system I/O load, understanding the reasons for excessive V8 garbage collection, figuring out why your event loop thread is blocked, and more.

Outline:

  • Node.js observability tools
  • CPU profiling with V8
  • Linux perf and CPU sampling
  • Visualizing CPU profiles with flame graphs
  • Introduction to BPF
  • BPF scenarios and the BCC toolkit
  • USDT probes
  • Blocked-time analysis

Speaker: Sasha Goldshtein

CTO of Sela Group, a Microsoft MVP and Regional Director

Sasha Goldshtein is the CTO of Sela Group, a Microsoft MVP and Regional Director, Pluralsight and O'Reilly author, and international consultant and trainer. Sasha is the author of two books and multiple online courses, and a prolific blogger. He is also an active open source contributor to projects focused on system diagnostics, performance monitoring, and tracing -- across multiple operating systems and runtimes. Sasha authored and delivered training courses on Linux performance optimization, event tracing, production debugging, mobile application development, and modern C++. Between his consulting engagements, Sasha speaks at international conferences world-wide.

Find Sasha Goldshtein at

Tracks