Live Diagnostics

Anyone who looks out from .NET from time to time will know that our libraries are missing quite a lot that other platforms take for granted.  A decent embeddable web server is one.  Thankfully, the Nancy team have addressed this issue with the Nancy self-hosting engine.  It’s far from the fastest thing on the planet, it’s no substitute for IIS, and it’s not going to give the authors of Jetty any sleepless nights, but it does hit one sweet spot that is close to my heart: live diagnostics.

You see, even if you do your logging and your alerting well, these diagnostics are after the fact and rarely contain detailed enough information to solve certain kinds of problems.  These are the problems where you need to know what’s going on right now and why?  There’s two reasons for this:

  • Typically you don’t have live access to the in-memory structure of the application
  • There’s just too much information. You need some way to drill down.

The too much information problem is serious.  Quite simply, you can’t sensibly log the level of detail for every last transaction you sometimes wish you had for just one or two.  The in-memory problem is so large many don’t even notice it’s there.  Rather than take a look at what their program is doing, they accept that they’re just going to have to theorize about what state it is in and how it got there.  An embedded web server solves both problems.  You might be thinking that this kind of quality control can be achieved by unit testing, and you’d be right, except that you wouldn’t have captured the amount of time it takes to develop a test when you’re not sure what’s wrong.  I recently (successfully) put an automated trading system live, and I would estimate that 40% of the test suite was developed with the aid of the live diagnostics the system provided.

Next time you’re writing a back-end service, try embedding a small web server that just prints up a single page of information about what’s happening.  Once you’ve had a taste, I’m sure you’ll find it addictive.

Technorati Tags: ,

Published by

Julian Birch

Full time dad, does a bit of coding on the side.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s