Objective
This article refers to Javamelody's userguide writing, some of the text is from the document, adding a personal understanding. and carry out practical operation
The javamelody is a monitoring Java application (such as a project War,ear package) and an application server (such as Tomcat or JBoss WebLogic, etc.). Monitoring data can be given through the chart.
Software Download Reference Google website:http://code.google.com/p/javamelody/downloads/list
It supports the monitoring of Java memory usage, garbage collection, Session,jdbc,sql,http requests, business methods, and many other information.
Javamelody describes the javamelody for monitoring the QA and development environment of Java applications or application servers. It is not a stress test tool that simulates requests like jmeter, but rather a tool that measures and calculates operational information on the application, that is,
It is only responsible for monitoring the behavior and is not responsible for triggering the action。 Javamelody generates simulation graphs based on request statistics and provides the following help for our application in QA or development:1 gives the average response time and the number of executions2 hints before certain operational trends become severe3 Optimized response4 Finding the root of the response bottleneck5 Verify the effectiveness of the optimization strategy
JDK versionRequirement: Requires Java JDK to be 1.6 or more than 1.6. Support in the following
Application ServerDeployment and monitoring of:servlet API is above 2.4Tomcat 5.5 6 or 7GlassFish v2 or v3JBoss 4,5,6,7Jonas 4 or 5Jetty 6 or 7WebLogic 9,10,11If you want to monitor other servers need to install some plug-ins, read more about the userguide used
BrowserPreferably Firefox Chrome or IE9 javamelody installation test javamelody requires a web app, a Javamelody war package, and two jar packages. 1
Web Apps: I've provided a simple example of a Web project that contains a index.html 2
Javamelody.war: These files are available for download on Google, but given some friends who are not FQ, it is stored in the Baidu cloud.Javamelody.war This is the app package used for deploymentJavamelody.zip This contains the Userguide user manual and the source code3
two jar packages required, located inside the zip package. 4 application packages used in the test are also put here. It is important to note that Javamelody monitoring is very simple and deployment is fast. Usually the whole of javamelody and application is automatically completed by the software and does not require any action by the user. You only need to modify a little configuration file. Monitoring and applicationconsolidation is typically no more than 10 seconds, and is usually automatically discovered by the compiled environment:
You need to do the knowledge to copy two jar packages, add 10 lines of XML code. If the application you are publishing is not a relative directory, but a war package, then you need to read the following chapters below. If it is ear (EJBs), then you need to read some of the following User Guide advanced content.
1 jar PackageThere are two jar packages in Javamelody.zip, one is Javamelody.jar and the other is Jrobin-x.jar. Copy the two jar packages to the Web-inf/lib directory in the webapp corresponding to the war package. Or use Maven to add Javamelody-core dependent file pom.xml.
2 Web. xml fileIf your SERVLETAPI is 3.0, want to TOMCAT7 GlassFish v3 jboss6 and so on, then you need to configure the XML. Otherwise, you need to add the following filter to the Web. Xml that applies the war package
1<filter>2<filter-name>monitoring</filter-name>3<filter-class>net.bull.javamelody.monitoringfilter</filter-class>4</filter>5<filter-mapping>6<filter-name>monitoring</filter-name>7<url-pattern>/*</url-pattern>8 </filter-mapping>9 <listener>Ten <listener-class>net.bull.javamelody.SessionListener</listener-class> One </listener>
If you are servlet3.0, you also need to add <async-supported>true</async-supported> to support asynchronous requests
ViewMonitoring Results
You can now start the application server to open the URL to view the monitoring effect. Url:
http://
1 8080 or 127. 0.0. 1 : 8080 specifically see your own application server 2 <context> is the name of your Web app.
Note:If an error occurs during startup, the error message contains window server, so check to see if you are using a different version of the server. and add system parameters-djava.awt.headless=trueIf the amount used is Tomcat, then add the java.awt.headless=true in the Conf/catalina.propertiesthen restart the server. A preliminary study of 4 javamelody as my test uses a war package that has only one simple page, so only the number of connections to the HTTP request can be tested, a manual refresh of the page sends an HTTP request, and the number of clicks in the following list is visible. And the type of the request. Once again, the data is still there and must be stored somewhere in the local area. Lookup data Discovery cache files are stored in the temp under Tomcat and the directory is
tomcat/temp/javamelody/Application Name _ Host nameDelete the two files and start Tomcat again to find that the data is empty. This also proves that all the recorded monitoring information is in this folder, so what is there? Although it is an RRD file, it cannot be read directly, but you can see what data it records from the name. such as the number of SQL threads, memory and so on. The following will continue to study the monitoring of various projects, as well as the source code. Hand code is not easy, reproduced please specify: Xingoo
Javamelody Application Monitoring User Guide