FastAOP together with Perfmon is able to collect performance data with nearly no overhead. It can even profile applications running in production. This 10 minutes How-To present a slow Hotel Booking Example. This are the steps to run it on your machine:
Add this line of code to your run.bat/run.sh
rem Enable FastAOP with JBoss set JAVA_OPTS=%JAVA_OPTS% -Xbootclasspath/a:%JBOSS_HOME%\lib\fastaop-1.0.jar -Dfastaop-path=%JBOSS_HOME%\fast-aop-aspects -javaagent:%JBOSS_HOME%\lib\fastaop-1.0.jar
Create in $JBossInstallDir$/fast-aop-aspects directory a file named workflow-def.properties and add the following content into it:
slow-method-threshold-ms=50 frequent-method-invocation-threshold=4 aggregate-call.1.from=BEAN aggregate-call.1.to=DAO workflow.1.name=Seam-Login workflow.1.class=org.jboss.seam.example.booking.AuthenticatorAction workflow.1.method=authenticate workflow.2.name=Hotel-Query-First-Page workflow.2.class=org.jboss.seam.example.booking.HotelSearchingAction workflow.2.method=find workflow.3.name=Hotel-Query-Next-Page workflow.3.class=org.jboss.seam.example.booking.HotelSearchingAction workflow.3.method=nextPage
This file defines in which workflows you are interested in. A workflow in this case is simply a number of consecutive method calls starting with a defined entry method. Such workflow specification starts the report generation for all executions of methods occurring until the entry method is finished. Once this method is finished the report will be written to the file system.
Start the server and open http://localhost:8080/seam-booking/ . Now register a user, login as this user and search a hotel. Now you will find in $JBossInstallDir$/fast-aop-aspects/reports generated reports telling you exactly which methods are slow. If you want to see the source code of the hotel booking application you can download the fast-aop-example-booking-src.zip and open it in Eclipse. You will see that the report points you to the right places - slow layers in your app.
We introduced slow code into the hotel booking example (JBoss Seam is in reality fast!). You see by opening the reports exactly which methods in which layers are slow. If a layer is making calls to other layers, the time spent in these layers is automatically subtracted from the time for the caller. This behavior is very important to detect the performance.
To see how the how the layer mapping is defined you should checkout the example project from our Subversion repository. You will see that only 4 classes are required to profile a Ejb3/ JBoss-Seam based architecture.