Java and Spring development

Monitoring a web application with tcServer developer edition

with 8 comments

The tcServer developer edition is a Tomcat server with monitor support. The monitor support is provided through a tcServer template called Spring insight. The template is a web application. The monitor data from your application are gathered with AspectJ load-time weaving, stored in memory and presented on the Spring insight web site deployed on the tcServer developer edition server. For local monitoring, you can find the insight application here: http://localhost:8080/insight.

The screenshot shows all the recent traffic to the demo application’s servlets. A click on one of the bars gives you access to detailed information about the requests processed in that time period.

The other view is application health. The screenshot below shows the application health for the “findBalance” web service.

The service monitored above behave quite well and Spring insight claims its health is excellent.

If you click on one of the bars, you can drill down to each response and see details for that response:

The example is from a web service and shows which parameters and return types my monitored beans are invoked with. Almost all the execution time for this request was used in the repository and you can see that the repository throwed an exception back. You can even read the exception message. If you’re using the WEB browser inside Spring Tool Suite (STS), you can also jump directly into the source code through the “Go to STS” link.

For a full introduction into monitoring with tcServer and Spring insight, you should see this presentation. It shows that you can see all the SQLs sent to the database and all the HTTP request and response messages handled by your application’s servlets.

How it works

The Spring insight application uses load-time weaving to monitor your application. Out of the box, Spring insight monitors the SQLs and HTTP request/response messages. To monitor your own classes, you have to add an @Component annotation above your class or preferably a specification like @Controller, @Service or @Repository. For Spring insight, these annotations are just marker annotations that tells AspectJ which classes to weave.

These annotations can also be used to define your Spring beans with component scanning. But it’s not related to the way Spring insight uses them since Spring insight uses them at load-time, which is before the Spring container is started (runtime).

A class that will be monitored because of the @Service annotation:

public class AccountServiceImpl implements AccountService {

Some examples

The screenshot below shows a server that increases the load with ten clients every fifth second. In the beginning, the throughput increases with a low increase in response time. With more clients the throughput still improves, but the average response time increases much more.

The last image shows the same application with the number of clients doubled every fifth second. After a while it results in bad and unstable response time. The graph isn’t 100% correct since I run the clients on the same machine as the server. But the tests indicates quite clear that this application shouldn’t have unlimited number of server threads.

You can see the response time is very unstable and Spring insight claims the application has bad health. With less server threads the application health improves.


The tcServer developer edition is an excellent choice for monitoring web applications that can run on Tomcat. With an annotation over all the classes you’re interested in monitoring, you get access to detailed information like execution time, parameters, exceptions and return types. And you’re only a click away from inspecting the code you find something interesting.

The code used in this article was developed in my work time at Redpill Linpro.

Redpill Linpro is the leading provider of Professional Open Source services and products in the Nordic region.

Written by Espen

March 9, 2010 at 19:52

8 Responses

Subscribe to comments with RSS.

  1. Hello,

    I would like to know whether the spring-insight will allow me to monitor a spring 2.5.6 based application?


    Prasad Khandekar

    November 18, 2010 at 14:13

    • All you need is an @Component annotation or a specification of it like @Repository or @Service as a dependency for the application.

      The process with adding monitoring functionality is done by the tcServer with AspectJ load-time weaving. The @Component annotation will be the pointcut for the monitoring AspectJ advices.

      The @Componentand its specializations are part of the Spring 2.5 framework.


      November 18, 2010 at 14:49

  2. Can you tell me if Spring Insight can be used directly with Tomcat ? I see on Spring Insight site that they claim it can but I dont see any documentation about it anywhere. Can you point me to some?


    September 13, 2012 at 13:49

    • I believe you have to use the tcServer. tcServer is 100% Tomcat compatible with some Springs support.

      You can download the developer edition from here:

      Information about how to install it:


      September 13, 2012 at 18:23

      • The problem is i can use tc server in dev mode but not in prod mode. Thats beyond my hands to mandate the tools and technologies. We have to use tomcat. Also i do see that it can be used with tomcat but doesnt know how. If you can provide me some ointers it will be really good.


        Anuj kumar

        September 13, 2012 at 19:00

    • My best tip is to contact the SpringSource support team and pay them for help.

      Obviously you have to weave the Spring insight AspectJ advises into your code. That can be done at compile-time as part of your build script or with load-time weaving when you start Tomcat with a java agent.
      That should be enough to add logic before and after methods marked with the @Component annotation.

      That’s my best tips. If some of the logic are in the tcServer that the advice logic is dependent on, it will probably never work. Else I believe Spring insight works best in test and development environment. And with your external limitations, I don’t believe it’s worth your time to try to get it working in production environment.


      September 14, 2012 at 14:26

  3. Thank Espen for the tips. Can you please tell me what you think might be the reason why Insight will not work in prod envt. Does spring tc server uses something other than insight in their prod envt? I will ask Spring source the same question but was wondering if you might already be knowing the answer.


    September 14, 2012 at 19:05

    • No, they use Spring insight in both the development and production edition. My comment was about tcServer developer edition and a clean Tomcat edition.

      I just did a search on Spring insight and according to the documentation, Spring insight works with Tomcat.

      The documentation also explains the difference between the developer and production server regarding Spring insight. The production edition handles performance issues especially in a clustered environment better.


      September 14, 2012 at 19:51

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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: