Question
After configuring your application to use the Contrast agent in Assess mode, what is the anticipated performance impact on the application?
Answer
When running in Assess mode, Contrast's analysis will make your application run a little slower. But, the time difference is usually minimal, and the results are definitely worth it.
It's probably more important to think about how Contrast affects the round-trip time. In typical applications, Contrast adds most time to a request that contains a lot of business logic. Round trip times for static resources typically don't get measurably worse. In requests where the total round-trip time is dominated by database or Web Service calls, Contrast's effect will be less noticeable.
Performance tuning
The following steps can be taken to tune the agent's performance in Assess mode:
- Ensure that the server meets the recommended system requirements and the server has enough free memory before the Java agent is installed.
- Run Contrast in Sampling mode, and change sampling frequency to be less frequent.
- Run Contrast during nightly integration tests.
- Run Contrast in an alternate environment (QA system or DEV environment).
- Run Contrast on a single node in a load balanced environment.
While the options above should provide the biggest boost to performance, you can try the following steps to tune performance further.
- Check that the agent's logging level is set to
WARN
orERROR
. - Turn off response scanning by setting:
-Dcontrast.assess.enable_scan_response=false
(Please note that this will lead to certain findings, such as those around misconfigured headers for the application, to no longer be reported). -
Disable inventory features by setting:
-Dcontrast.inventory.enabled=false
(Note that Inventory encompasses several facets of application analysis including library detection and usage, HTTP call counting and database usage analysis. We recommend seeking the advice of Contrast Support before changing this setting).
Further analysis
If performance is still outside of the expected degradation after following the steps above, we can investigate further by recording a full profile of your application whilst running with Contrast by following these steps:
- How to collect Java Flight Recorder (JFR) data for troubleshooting application performance
- For IBM JREs - How to generate a YourKit session
The agent's logging level should be set to WARN
or ERROR
when collecting the profiling data.
Debug agent logs covering the performance issue may also be helpful - How to get logs from the Java agent . However, it is expected that debug logging will further impact application performance and as such may not always be feasible to collect. Providing the log file at even WARN
or ERROR
level may contain some useful information.
Please submit a ticket attaching the results of this profiling and any agent / application logs.
See also: