Where I want to go with Node next...

This post is more than 2 years old.

This post probably isn't terribly useful to anyone else but me, but I wanted to write this down to help direct me and keep me on target. I've been spending a lot of time with StrongLoop lately and while I feel like I've covered the "API stuff" pretty well, I want to turn my attention to performance stuff - both in StrongLoop of course and generically across the Node.js ecosystem. Let me give some context.

As folks may know, I spent most of my development life working with ColdFusion. I'm mostly moved away from that and outside of side work for clients I don't write any new code in it. It should come as no surprise that I now recommend Node.js to developers looking to build server-side applications. It is easy to pick up, for the most part, and free and open source. There's one thing that ColdFusion did really well though that I'd like to replicate on the Node.js side.

Out of the box, you could enable server-side reporting of performance metrics in your ColdFusion application. This was reported in an easy to read format at the bottom of a CFM page. This report would break down all kinds of useful information:

  • How long did the entire request take to process?
  • Given your request called various component methods, how long did they take to execute?
  • Given your request called a database, what queries were used, how many records were returned, and how long did they take to process?

As an example, I could see when a request wasn't performing well because it was calling the database for the same data multiple times in one request. That seems like a silly mistake to make, but as we all know, an application grows over time and is touched by many developers. Sometimes you may not realize you're repeating the same method calls and basically refetching the same request every time.

Another example - you may see that a database query is performing slowly when it doesn't make sense that it should. That could be a number of things - but probably a bad index. Yes - this is something MySQL itself can tell you, but you may not even realize you have a problem till you see the numbers in front of you. Or perhaps your returning N rows when you realize you should be returning 1. Again, a "simple" mistake that can be overlooked.

The service ColdFusion provided was also configurable in terms of what was reported and you could modify it to add your own flair to it.

All in all - it is a darn good feature. While it doesn't cover everything and doesn't replace "deep" tools like Fusion Reactor, it is good for getting a quick look at your site performance and making some immediate fixes. That's where I want to go with Node next. I'm assuming it may not be as easy, but I can hope, right?

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by Kurt Wiersma posted on 11/30/2015 at 7:14 PM

For .Net apps I have used Glimpse to provide this built in profiling interface in the past. I believe at one point they were working on Node support but it doesn't look like it has been updated since 2013.


Comment 2 (In reply to #1) by Raymond Camden posted on 11/30/2015 at 7:16 PM

That's too bad - Glimpse looks pretty sweet.

Comment 3 by David Fekke posted on 12/2/2015 at 2:11 PM

There is a tool I like called MiniProfiler. You can install it as an NPM module, and they also have a nuget package for .NET.


Comment 4 (In reply to #3) by Raymond Camden posted on 12/2/2015 at 2:22 PM

Interesting. The docs on the GitHub page are pretty slim. Anyway we can learn more?

Comment 5 (In reply to #4) by David Fekke posted on 12/2/2015 at 2:36 PM

While I have been using Node for a couple of years now, I have not used MiniProfiler with Node. I have used MiniProfiler with a ASP.NET project, and I know it is pretty popular in the Ruby community as well.

The Node version of MiniProfiler probably needs some open source love. I am going to play around with it with Node, and I will push an example to GitHub.

Comment 6 (In reply to #5) by Raymond Camden posted on 12/2/2015 at 2:42 PM

I'd appreciate it if you could share any example of the output.

Comment 7 by Phillip Senn posted on 12/3/2015 at 4:54 PM

How do you do the following in Node.js?

svc = new Query();
svc.setSQL('SELECT * FROM Table');
obj = svc.execute();
qry = obj.getResult();

Comment 8 (In reply to #7) by Raymond Camden posted on 12/3/2015 at 8:56 PM

That really isn't on topic for this blog post. To use databases, there are libraries available for all major DB platforms. I've used one for MySQL before and it was relatively easy. Add the library. Include it in your code. Good to go.

Comment 9 (In reply to #6) by Guilherme Oenning posted on 5/27/2016 at 11:44 PM

I just started working on new versions of MiniProfiler for Node.js. While it's still a draft (but it works!), I would appreciate some feedback on it. Feel free to ask any questions, let's make it as good as MiniProfiler for ASP.NET! https://github.com/MiniProf...