Skip to main content

Configure Tomcat

During installation, you set some values for the memory used by the embedded Tomcat server on which Contrast runs.

As you add more applications or find more vulnerabilities, you may notice a degradation in performance which can indicate you have reached the maximum amount of memory allowed for this server.

To increase memory settings:

  1. Stop the Contrast server by running the contrast-server stop command.

  2. When the server is stopped and Contrast/logs/contrast-stdout.log ends with [MysqldResource] shutdown complete, it is safe to change memory settings.

  3. In the Contrast bin directory, c:/Program Files/Contrast/bin or the default /opt/Contrast/bin, open a file named contrast-server.vmoptions. It should look something like this:

    -XX:+UseG1GC   
    -XX:+UseStringDeduplication   
    -XX:+PrintVMOptions   
    -XX:+PrintCommandLineFlags   
    -XX:+UseContainerSupport   
    -XX:InitialRAMPercentage=50.0   
    -XX:MaxRAMPercentage=50.0   
    -XX:MinRAMPercentage=50.0   
    -Dcontrast.data.dir=/opt/contrast-data
    -Dcontrast.home=/opt/contrast-data
    -XX:+HeapDumpOnOutOfMemoryError
    -Xloggc:/opt/contrast-data/gc.out
    -server
  4. You can update the values for:

    • Xms: the amount of memory allocated to the server on start

    • Xmx: the maximum amount of memory the server can use

    • MaxPermSize

    These values can change depending on the memory available on the machine hosting Contrast.

  5. Save the file and start Contrast back up using the contrast-server start command.

Tip

See JVM documentation for help with tuning.