Saturday, January 8, 2011

dynaTrace Enlightenment

My company recently sent me for dynaTrace training.  dynaTrace is a tool that allows you to instrument your code in real time in order to measure and monitor performance.  I'm not going to go into detail about what it can do, you can read all about it on the dynaTrace website.  If your company has the money, however, I highly recommend it.  It is impressive to say the least.

One of the things dynaTrace offers is the ability to see all the exceptions being thrown in your application, not just the the ones being propagated to your code.  This is important in our applications because we use third-party libraries, and we don't always know what they are doing.  In instrumenting the application we are working on, we found that Spring was throwing hundreds of thousands of exceptions and burying them.  Now each one of these is small in cost, and the application works as expected.  The cost of the exceptions, however, was starting to get expensive - one, two or even a few hundred probably wouldn't be cause for concern, but hundreds of thousands?

So What was the cause?

This application is also a Web application that uses Struts2.  The application was set to use annotation-based configuration.  But when we looked at the Exceptions, it appeared that Spring was ignoring the configuration and attempting to configure itself using other methods, throwing exceptions, and then trying the next one. Multiple exceptions occurred every time the application accessed a Spring managed bean.

As it turns out, there is another flag in Struts 2 to set that says, "No we really, really want to use this configuration."  Once that flag was set, the exceptions disappeared.

So What's the Point?

In todays development environment, we are heavily reliant on 3rd party libraries in order to leverage previous code and get things done faster.  Many applications use dozens of libraries from many different sources.  In some ways, this is a necessary evil.  Could you imagine the time it would take to write a Web application completely from scratch?  I mean completely, no application container, no MVC, nothing.  Start with the sockets to listen to requests.  So, as engineers, we decide to use a component created from another source that matches the criteria we need.  We use application containers, M-V-C frameworks, JavaScript toolkits, Persistence mappers, Logging libraries.... The list goes on and on.

While all of this is generally a good thing, sometimes its not because we don't truly know what's going on in our black boxes.  I think tools like dynaTrace are going to become more popular as companies look to improve quality while still enjoying the advantage of third party software.

That's it for now, it's time to go figure out why the Struts taglibs are adding 500 ms to our page rendering times....


  1. Ben did you go for the full four day training session? We've recently purchased dynatrace and are arranging training but the idea of four full days to learn a tool like this seems like a lot. Time well spent or is the tool learn-able enough to avoid?

  2. The company I work for had a trainer come out for 4 full days and teach a room full of us. I thought the 4 day training was just about right, TBH. Realistically, once you have the system set up, configured and monitoring how you like, it is very simple, but in order to do that correctly and completely, there is quite a bit of nuance involved with it. Each application is going to be unique in its needs, so having a solid understanding of the tool is important. I would spend the time/money on the full 4 days, you will be glad you did.