Most people agree that measuring performance is quite subjective, but still it is often a requirement (arbitrary but not always).
When tracking down performance bottlenecks in an application, everyone has their own approach.
Adding debug logs in the code is the most common amongst these.
There are two possibilities:
- You already have an idea of where the issue is, a reasonable amount of logs is added.
- You don’t have a clue and you fill in virtually all methods.
In the era of aspect-oriented programming, there must be a better approach.
Well, the guys at SpringSource came up with their own way of achieving just this.
Enter Spring Insight
Spring Insight uses AspectJ to track what calls are done. The statistics are gathered in a fancy dashboard where you have access to nice charts as well as detailed trace information.
All this is done without touching your applications.
To get Spring Insight running, you need to get the tc Server Developer Edition (http://www.springsource.org/insight).
Don’t try to do the installation on a machine other than your own desktop, Spring Insight (Developer) won’t work if it is not accessed from localhost.
The installation itself is simple:
- Unpack the archive
- Create an instance with template ‘insight’
- tcruntime-istance.sh create myInstance -t insight
- Deploy your application (place the war in myInstance/webapps)
- Start the instance
- tcruntime-ctl.sh myInstance start
To get going
As soon as you start using your application, Spring Insight does its job. Spring Insight uses default threshold for the response times, however you can change that in the Administration tab.
When you are done, go back to the insight dashboard and click on your application, you now have access to a fancy graph with an health check on your application.
A graph with response times for the invocation is available, by clicking on one of them you can see all the details.
The typical flow you would go through is:
- What are the ‘frustrating’ invocation in terms of response time?
- Open the details
- Select an invocation in the histogram
- Review the trace detail, you should be able to see method calls as well as JDBC queries
From there you can start the required optimization.
When you want even more
If you need even more control, you can easily extend Spring Insight with various plugins.
To name a few for example, for the Axonframework we have created a plugin to monitor the commands, events and sagas (A blog post about this will follow soon) and Jeroen Reijn has written about creating a plugin for monitoring Hippo; read more in his own blogpost Get in control with Spring Insight.