We have all experienced the frustration of waiting for an application to finish a task. Slow loading webpages, timeouts on database queries, unresponsive ui’s and hangs are just a few of the many issues that could indicate an underlying performance issue.
But just how easy is it to identify where the problem actually lies ?
The answer to this is very easy thanks to Application Metrics for Node.js (appmetrics), a free and open source monitoring solution.
It provides out of the box monitoring visualising areas such as CPU and Memory consumption, CPU profiling, GC activity, Event loop statistics and crucially for web based applications, the performance of incoming and outgoing communications
The target audience is anyone from the developer using it for the very first line of code they write through to large production systems running in a cloud. If you are developing an application that someone else will ultimately be using (be it serving web pages or writing to a database) you are going to care about performance. You immediately need to know how long your application took to respond to a request.
Appmetrics has been designed to be as simple as possible to use with as minimal install steps as possible.
In fact, just 3 simple steps are all the is required to build monitoring into your application
npm install -S appmetrics-dash
The latest release of appmetrics-dash features a built in CPU profiler. This provides the ability to visualise your applications performance via a flame graph. Flame graphs are a graphical interpretation of your profiled application. The “hottest” or “most frequent” code paths can be very easily identifed. Once you know where your application is spending its time, you know where to focus your optimisation changes.
Each column represents a call stack with each single frame being a method in that stack. The wider a frame is, the more times that frame has appeared in the stack.
CPU Profiling is not on by default, to enable it you must select the “Enable Profiling” option from the pull down menu in the top left of the screen. Once enabled, the profiling tab will display the flame graphs as well as the full stack trace if you select on of the frames.
Click here for more information on Application Metrics for Node.js