I'm using node as a http server with the following code:
http.createServer(function(req, res) {}).listen(8181);
I'm looking for a simple way to monitor a node js http server from within the same process. For me it would be enough to have a own function which just outputs the current resource usage and connection count as json. For now I don't need deep measuring or real time performance monitoring.
What are the key performance indicators for a node http server and is it possible to get them from node? If yes how? What you think of the folling kpi's:
Just need to know which variables/functions I need to get the data?
Thx I really appreciate your help
JS uses a single thread with an event-loop. In this way, Node can handle 1000s of concurrent connections without any of the traditional detriments associated with threads.
No matter what size instance we use Node always appears to max out at 1000 concurrent connections (this is NOT 1000 per second, but 1000 it can handle at 1 time).
JS can handle 10,000 concurrent requests they are essentially non-blocking requests i.e. these requests are majorly pertaining to database query.
You can get the amount of connection using a built in function of NodeJS. Check getConnections. Bellow an example how to use it:
var server = http.createServer(app);
server.getConnections(function(error, count) {
console.log(count);
});
I hope this is what you were looking for :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With