The NodeSource Blog

Understanding Heap Usage in Node.js Applications with N|Solid

Heap snapshots are extremely helpful for debugging issues memory-based in Node.js applications quickly and effectively.

A heap snapshot is just what it sounds like — a static snapshot of memory usage details at a moment in time — and it provides a glimpse at the heap usage of V8, the JavaScript runtime that powers Node.js. By looking at these snapshots, you can begin to understand where and how memory is being used.

Because each snapshot shows you a single historical state, heap snapshots are most useful when you compare two or more of them side by side. It is helpful to compare a snapshot that lies outside the bounds of expected heap usage (when your app is misbehaving) and another snapshot showing heap usage within the expected parameters. By looking for differences between the two snapshots, you can really dig in and find the source of memory usage issues.

We recently published a video on how to understand heap snapshots and automatically trigger them in your production Node.js applications, under real-world conditions, with N|Solid. Follow along with Joe Doyle:

One Last Thing...

If you’ve got any questions about Node.js and memory, performance, or optimization, feel free to reach out to the team on Twitter at @NodeSource - we’re always interested in helping the Node.js ecosystem become more secure and reliable.

If you’d like some hands-on guidance around Node.js and improving application performance, you should take a look at our performance consulting and Node.js training - we'll be able to help make your Node.js apps performant, and enable you and your team to make your apps fast in the long-term.