Interpreting flame graphs
A flame graph is a visual tool that allows us to identify "hot code paths" within our application. The term "hot code path" is used to describe execution paths in the program that consume a relatively large amount of time, which can indicate a bottleneck in an application.
Flame graphs provide a visualization of an application's call stack during execution. From this visualization, it is possible to determine which functions are spending the most time on the CPU while the application is running.
In this recipe, we're going to use the 0x
flame graph tool (https://github.com/davidmarkclements/0x) to generate a flame graph for our Node.js application.
Getting ready
We need to create an application that we can profile. Profiling is a type of program analysis that measures how frequently and for how long functions or methods in our program are being used. We will use the Express.js generator to create a base application...