Optimizing Java application performance for the Java virtualization agent

The performance of a Java application can be affected adversely when the Java virtualization agent is loaded into the application. For example, memory usage may increase or there might be pauses during application startup. To prevent these problems from occurring, modify performance parameters supported by the Java virtualization agent.

About this task

Procedure

  1. If you observe "out of memory" errors, increase the size of the permanent generation space by modifying the size of the -XX:MaxPermSize JVM parameter of the Java application.
  2. If you do not require the Java application to pause during start to collect recording and intercept rules from HCL Quality Server, edit the invocation command line to include the greenhat.javaagent.waitForRules property as follows:
    "%JAVA_HOME\bin\java" "-javaagent:%JAVA_AGENT%" -Dgreenhat.javaagent.waitForRules=-1 or X (milliseconds) -jar Java application name.jar

    Setting the Dgreenhat.javaagent.waitForRules property to -1 prevents the Java virtualization agent from waiting for recording or routing rules from HCL Quality Server. Alternatively, setting the Dgreenhat.javaagent.waitForRules property to X milliseconds causes the Java virtualization agent to wait X milliseconds when starting for recording or routing rules from HCL Quality Server.

    For example, to make the Java virtualization agent to wait 10 seconds when starting for recording or routing rules from HCL Quality Server, edit the invocation command line as follows:

    "%JAVA_HOME\bin\java" "-javaagent:%JAVA_AGENT%" -Dgreenhat.javaagent.waitForRules=10000 -jar Java application name.jar
  3. To make the Java application to wait for a specific number of seconds for HCL OneTest API to determine how to process an intercepted message, edit the invocation command line to include the greenhat.javaagent.dispatchTimeout property as follows:
    "%JAVA_HOME\bin\java" "-javaagent:%JAVA_AGENT%" -Dgreenhat.javaagent.dispatchTimeout=X (milliseconds) -jar Java application name.jar

    For example, if you want the Java application to wait 60 seconds for HCL OneTest API to determine how to process an intercepted message, edit the invocation command line as follows:

    "%JAVA_HOME\bin\java" "-javaagent:%JAVA_AGENT%" -Dgreenhat.javaagent.dispatchTimeout=60000 -jar Java application name.jar