Sonarqube instances consuming too much RAM

We are experiencing an issue where our SonarQube Community Edition instances are consuming an unexpectedly high amount of RAM. This is impacting the performance of our systems and other applications hosted on the same servers. We would like assistance in identifying and resolving the root cause.

Details:

  • SonarQube Version: Community Edition 10.6
  • Operating System: 22.04.2 LTS
  • RAM Usage Observed: [“Instance using 56 of 63 GiB”]
  • Hardware Specs:
    • CPU: 6
    • RAM: 64
    • Disk: 200GB
  • Database in Use: [PostgreSQL 12]

Hey there.

SonarQube Server spins up 4 processes that are capped in how much memory they can use based on what is configured in your conf/sonar.properties file (the -Xmx value for sonar.web.javaOpts, sonar.search.javaOpts, and sonar.ce.javaOpts).

Unless you’ve set these very high, I would recommend you look at what is actually consuming memory on your server. Are they java processes?

There are many ways you can pull this data. Here’s one example command.

Hello @Colin,

I set those configs in my sonar.properties as follows:
sonar.web.javaOpts=-Xmx4096m -Xms128m -XX:+HeapDumpOnOutOfMemoryError

sonar.ce.javaOpts=-Xmx16g -Xms128m -XX:+HeapDumpOnOutOfMemoryError

sonar.search.javaOpts=-Xms512m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError

and after launching the command you provided:
4913.45 MB /opt/java/openjdk/bin/java

Please let me know if these configurations are recommended for my setup, especially considering I am running multiple SonarQube instances on the same node. This issue did not occur before upgrading to version 10.6.

Thanks.
Mohamad

If you’re running multiple SonarQube instances that can consume up 21 GB of memory each (the max values of -Xmx for each JVM process)… I’m not surprised you’re facing memory issues.

Typically these values only need to be adjusted from the defaults if you have a high-load SonarQube server, specifically running multiple CE workers – however, that’s a feature only available in Enterprise Edition and above.

Why did you adjust the memory values in the first place?

I do not recall to be honest why we have adjusted them. But as I understand from you we shouldn’t have changed them?

@Colin any updates?

Hey there.

Not particularly. You should either reduce the amount of memory allocated to each SonarQube server or stop running multiple SonarQube instances on the same host.