# Gathering metrics on performance

Setting up the adapter with Perf4J

What’s the most important thing when performance tuning the adapter; it’s information, having a gut feeling about where the adapter is slow is all well and good, but you’ll need to prove it. After all premature optimization is the root of all evil.

In addition to having Perf4J (http://perf4j.codehaus.org) annotations on Workflows, and Producers (which can be enabled using aspectj AOP); 2.7.1 introduced the a new service Perf4jTimingService that can wrap any arbitrary service and gather performance metrics about that service’s throughput.

It’s very simple to configure. You simply need to have wrap the service within the Perf4jTimingService

Where the tag is the name that you see in the log file, and log-category is the log4j category that will be used to print the information.

After that, you’ll need to configure perf4j using log4j.xml; the instructions on their website are very good, but I will briefly summarise them here.

• Configure an appender for writing out the performance information.
• Configure a Perf4j Appender to use the PERFORMANCE_LOG
• Now make the appropriate categories log to the perf4j appender

Once that’s done; you’ll get additional information in the log file specified (in our case stats.log)

Powered by Hydejack v6.6.1