Monitoring the performance of a Node.js web application
- In this article, we will build a tool that will monitor how much time is spent in MongoDB when a simple Node.js application answers an HTTP request.
- For this article, let’s look at the simple Express/Mongoose application here: – – For this application, we want to monitor the time spent in MongoDB for each HTTP request.
- If we focus on a smaller version of our application: – – We can monitor the time spent in MongoDB by simply overriding the method: – – When we start the process and curl on http://localhost:9090/cats , the console displays: – – However, this patch has several issues: – -…
- Our hook will be pretty simple: – – Then we will place this in a new Async Hook: – – Now we need to create a new context for each HTTP request and to provide a way to access the current context from everywhere.
- In this article, we have seen that building an Application Performance Monitoring tool for modern Node.js applications is not complicated anymore, using two new Node features, the Async Hooks API, and the Performance Hooks API.
Building a tool to monitor Node.js application performance is easy with Async Hooks API and Performance Hooks API. Learn how in this tutorial.
Building a tool to monitor how an application performs is not very difficult anymore.
Two recent additions to Node.js, the Async Hooks API and the Performance Hooks API, allow anyone to closely monitor the performance of their app with just a little code.
This article explains the key elements to building such a tool, from instrumenting code to reporting collected data in a clear visualisation.
The final project is available on Github and features:
When running a web application in production, performance is important. Slow web servers provide degraded user experience and can threaten a whole company’s business.
In order to fully understand how a web application runs in production, load testing is not enough. Even if tools like ab can give measures regarding how fast a server answers under a specific load, they can’t tell you where the bottlenecks are.
In this article, we will build a tool that will monitor how much time is spent in MongoDB when a simple Node.js application answers an HTTP request.
As a developer, I want to be able to know how much time my server spends in external services when answering an HTTP request.
For this article, let’s look at the simple Express/Mongoose application here: