Javamelody is run in the Java Web container to monitor Java memory and J Server CPU usage, number of user sessions, number of JDBC connections, and HTTP requests, SQL requests, execution count, average execution time, percentage of errors, and so on.
Charts can be viewed by day, week, month, year, or custom time period.
How to use
Https://github.com/javamelody/javamelody/releases
Maven Dependency
<Dependency> <groupId>Net.bull.javamelody</groupId> <Artifactid>Javamelody-core</Artifactid> <version>1.60.0</version></Dependency>
How to use
Directly put the downloaded jar package in the project Web-inf/lib directory can be, without any configuration, start the container after the monitoring program has been running.
As for why no configuration is required, the Javamelody program runs automatically, as described below.
User interface
In the browser address bar, enter the URL of the following style, you can access the monitoring graphical interface.
Http://
Javamelody Starting principle
Following normal use steps, in addition to importing Javamelody jar packages, you also need to configure filter filters and filter-mapping in the Web. XML configuration file, as well as a listener listener.
Why now just import the jar package, do not need any configuration, start the container monitoring program also follow up? This is to be said from the Servlet3.0 norm.
Servlet3.0
SERVLET3.0 for Modular Support
This means that we can now separate the Web Components for development, and then put them into the corresponding jar packages in the main project, rather than the previous-all the content must be defined in the Web. xml file. With the support of modularization, we can define the filter, Listener and servlet of some common functions as a separate Web module in the actual application, and add the corresponding jar package in the project that need to use them. Isn't it useful? Next, let's look at how these Web components are modular.
The file structure requirements for the contents of the jar package that the Web module hits are as follows:
|--meta-inf
| |--web-fragment.xml
| |--resources
| | |--jsp, images, etc., equivalent to the root directory of the Web
Files under the |--class file and Classpath
When the container starts, it reads the information under the Meta-inf of each jar package
Looking at the Javamelody-core jar package, you will find that there is a web-fragment.xml under the Meta-inf folder, which means that the jar package itself is a Web module
Open this file, you will find that actually running the monitoring of the filter and listener, has been defined in this file. That's why you don't need to do the configuration again.
Servlet 3.0 requires Tomcat 7.0 or later (7.0 included)
Java Application Monitoring Javamelody