I’m sure that application monitoring is a very important aspect of a project which helps to react fast when problems happen, as well as proactive measures that can highlight issues before they become serious. This keeps you in control of your service delivery, tells you when an application is not working properly and have your application performance issues solved quickly and easily.
So today we’ll talk about one of the best such tools for Java apps. It’s Spring Insight! It’s really great Web application which gives you real-time visibility into application behavior and performance.You can use Spring Insight in development and testing stages to verify immediately whether your newly-written code is behaving as designed. QA engineers can pinpoint specific causes for “what just happened” and relay detailed information to developers. Stress testing of application typically tells you which URL areas are slow. By combining Spring Insight with your existing tools, you can see not only which URLs are slow, but why, thus accelerating your time to production. You can see your services executed for any page request, find pages which are executing slowly and drill into the cause, verify your application’s transactions are working as designed and much more.
It’s time to show you how to deploy and use Spring Insight in the Cloud. Let’s start!
Create the environment
1. Go to jelastic.com and sign up if you haven’t done it yet or log in with your Jelastic credentials by clicking the Sign In link on the page.
2. Click on Create environment to set up a new environment in Jelastic.
3. In the Environment topology window, specify the resource limits you want to be set for the environment (e.g. 16 cloudlets), select Tomcat 6 as your application server and JDK 7 as your jvm, type your environment name, for example, springinsight, and click on Create.
In a minute your environment with both Tomcat 6 and JDK 7 will be successfully created and appears in the environments list.
Upload Java package
1. Go to Springsource web site, navigate to downloads and download VFABRIC TC SERVER DEVELOPER EDITION.
2. Extract the files from the package you have just downloaded.
3. Switch back to the Jelastic dashboard and upload insight.war to the Deployment manager.
4. Once the package is in Jelastic, deploy it to the environment you have just created. Let’s call our context insight.
5. Upload and deploy the application, which you would like to monitor using Spring Insight, to the ROOT context of the same environment. In our case we use simple Hello World.
6. Open your application in a web browser.
Configure Spring Insight
1. Click config button for Tomcat. Navigate to context.xml file (server directory) and add the following before the closing the context tag.
<Loader loaderClass="com.springsource.insight.collection.tcserver.ltw. TomcatWeavingInsightClassLoader" useSystemClassLoaderAsParent="false"/> <Listener className= "com.springsource.insight.collection.tcserver.lifecycle. ApplicationLifecycleCollectionListener"/>
2. Navigate to server.xml and add the following Valve to the Engine block.
<Valve className="com.springsource.insight.collection.tcserver.request. HttpRequestOperationCollectionValve"/>
3. Pick the home directory and create a new folder in it. Let’s call it insight.
4. Select insight directory and create a new folder in it. Let’s name it collection-plugins. After that upload all collection plugin jar files from vfabric-tc-server-developer-x.x.x.RELEASE/templates/insight/collection-plugins folder to collecton-plugins folder that you have just created.
5. Create one more folder home/insight/conf and upload the following configuration files to this folder: ehcache.xml, gemfire-cache.xml, gemfire.properties, insight.properties and log4j.xml. You can find them here: vfabric-tc-server-developer-x.x.x.RELEASE/templates/insight/conf.
6. Specify the following variables in the variables.conf file.
7. Upload the next libraries to the lib folder of Tomcat:
- com.springsource.org.apache.tomcat.jdbc.jar (you can find it in the package you have downloaded earlier: vfabric-tc-server-developer-x.x.x.RELEASE/tomcat-6.x.x.B.RELEASE/lib);
- aspectjweaver-1.6.12.M2.jar, insight-annotation-1.8.3.RELEASE.jar, insight-collection-tcserver-1.8.3.RELEASE.jar, insight-intercept-1.8.3.RELEASE.jar, insight-util-1.8.3.RELEASE.jar and spring-instrument-tomcat-3.0.5.RELEASE.jar (they are located here: vfabric-tc-server-developer-x.x.x.RELEASE/templates/insight/lib)
Don’t forget to restart Tomcat in order to apply the new configuration parameters.
8. Open Spring Insight in a web browser and you’ll get a fully functional monitoring solution up and running within minutes.
Spring Insight is a great choice for monitoring web applications that can run on Tomcat in Jelastic Cloud. Obvious and easy to navigate UI provides you with an annotation over all the classes you want to monitor, so you can access the detailed information like execution time, parameters, exceptions and return types. You can simply get the insights you need to track all your apps аnd ensure they continue optimal performing. Overcome all challenges of application monitoring with Spring Insight and Jelastic!