-
Notifications
You must be signed in to change notification settings - Fork 1
Perfmon4j Demo
Objective: In this first step we will install the perfmon4j java agent on apache tomcat 9.x. We will then demonstrate the perfmon4j valve and request filter. This filter will add request duration timings to the apache server log.
The demo is running on Linux Mint 19.1, however perfmon4j is supported on any platform where Java 1.8 or greater can be installed. Linux Mint comes bundled with OpenJDK 11.0.3, however perfmon4j also works with the Oracle JVM.
Although we are using an Apache Tomcat version for this example the perfmon4j agent can be installed in any java application. The perfmon4j servlet "valve" being demonstrated is available for Apache Tomcat, JBoss and Wildfly application servers.
Short cut: Download Apache Tomcat 2.0.21 here...
- Go to Apache Tomcat download page
- Select zip file from the Core Binary Distribution
- Unzip and copy the tomcat (once copied rename the "apache-tomcat-9.?.?" folder to "tomcat") install into your home folder.
- (Linux only) Marc shell scripts as executable "chmod +x ~/tomcat/bin/*.sh"
- In a terminal window execute "./tomcat/bin/catalina.sh run" to start the server
- Verify tomcat started successfully by opening a browser and going to http://localhost:8080
- In the terminal window press [CTRL-C] to stop tomcat
To obtain the latest javaagent distribution:
Short cut: Download Perfmon4j 1.4.3 Binary here...
- Go to the Perfmon4j Github homepage
- Scroll toward the bottom of the page where the README.md file is displayed
- Under releases select the link for the latest stable release
- In JFrog Bintray click on the files link
- Select and download the *bin.zip file.
- Open the zip file and copy perfmon4j.jar into "~/tomcat/bin" folder
- In a command window execute "export CATALINA_OPTS=-javaagent:./bin/perfmon4j.jar"
- Restart tomcat with "./tomcat/bin/catalina.sh run"
- You should see the Perfmon4j banner displayed
After this step we have installed the perfmon4j agent, however it is not yet "doing" anything useful. In this next step we will install a servlet valve to print out detailed information about incoming web requests.
- If tomcat is running shutdown with [CTRL-C]
- In a command window execute "export CATALINA_OPTS=-javaagent:./bin/perfmon4j.jar=-eVALVE,-f./conf/perfmonconfig.xml"
- In a text editor create a file "~/tomcat/conf/perfmonconfig.xml" with the following contents:
<Perfmon4JConfig enabled='true'>
<boot>
<servletValve outputRequestAndDuration='true' />
</boot>
</Perfmon4JConfig>