This is an archived version of the documentation for SonarQube-7.3.
See the Latest Documentation for current functionality.

Java Process Memory

The SonarQube application server consists of three main Java processes:

  • Web (including embedded web server)

  • ElasticSearch

  • Compute Engine

Each of these Java processes has its own memory settings that can be configured in the sonar.properties file. The default memory settings that ship with SonarQube are fine for most instances. If you are supporting a large SonarQube instance (more than 100 users or more than 5,000,000 lines of code) or an instance that is part of your Continuous Integration pipeline, you should monitor the memory and CPU usage of all three key Java processes on your instance, along with overall disk space. Monitoring will allow you to see if any of the processes is running short of resources and take action ahead of resource shortages. There are a large number of monitoring tools available, both open source and commercial, to help you with this task. SonarSource does not recommend or endorse any particular tool.

Memory settings

You may need to increase your memory settings if you see the following symptoms:

  • Your monitoring tools show one or more of the SonarQube processes is reaching its memory limit

  • Any of the SonarQube processes crashes and/or generates an out-of-memory error in the sonar.log file

  • A SonarQube background task fails with an out-of-memory error in the background task log

  • The size of the Issues index of your ElasticSearch instance (visible in the System Info) is greater than or equal to the memory allocated to the ElasticSearch Java process

You can increase the maximum memory allocated to the appropriate process by increasing the -Xmx memory setting for the corresponding Java process in your sonar.properties file:

  • For Web: sonar.web.javaOpts

  • For ElasticSearch: sonar.search.javaOpts

  • For Compute Engine: sonar.ce.javaOpts

The -Xmx parameter accepts numbers in both megabytes (e.g. -Xmx2048m) and gigabytes (e.g. -Xmx2G)

For detailed information on JMX Beans exposed by SonarQube and more ElasticSearch monitoring options, please visit our Monitoring Details page.