SonarQube Compute Engine Java memory via environment variable

I’m using SonarQube docker image sonarqube:7.9.4-community and I wish to speed up the analysis which is currently painfully slow, most probably due to the fact the compute engine is getting 512MB only:


2021.02.18 09:00:10 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='ce', ipcIndex=3, logFilenamePrefix=ce]] from [/opt/sonarqube]: /usr/local/openjdk-11/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp --add-opens=java.base/java.util=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.proxyHost=10.235.34.235 -Dhttp.proxyPort=3129 -Dhttp.nonProxyHosts=localhost|127.*|[::1] -Dhttps.proxyHost=10.235.34.235 -Dhttps.proxyPort=3129 -cp ./lib/common/*:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.5.jar org.sonar.ce.app.CeServer /opt/sonarqube/temp/sq-process9242086418303905412properties

I’m currently providing an environment variable, but it seems being ignored:

    environment:
      - SONARQUBE_JDBC_URL=jdbc:postgresql://sonar-db:5432/sonar
      - SONAR_CE_JAVAOPTS="-Xmx8G -Xms1G"

What am I doing wrong?

Hi @rlogiacco ,

the current LTS has only limited env config support. your best bet would be to pass the desired config as a parameter docker run .... sonarqube:7.9.4-community -Dsonar.ce.javaOpts=-Xmx8G -Xms1G or mount your properties file in the container docker run -v sonar.properties:/opt/sonarqube/conf/sonar.properties:ro ...

hope that helps

I tried to provide an additional env variabl --env -Dsonar.ce.javaOpts=-Xmx8G with no joy, so I resorted to manually modify the sonar.properties file inside the conf volume and that worked.

I believe I’ll soon switch to the latest, hoping to get increased performance: the memory bump (from 512MB to 2GB) didn’t help at all.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.