Sonarqube java xmx arguments

Hi ,

we are installing our new sonarqube server on aws (version - and as per below installation guide Operating the Server | SonarQube Docs , we added the systemd xms and xmx args as same mentioned in the docs .

ExecStart=/bin/nohup /opt/java/bin/java **-Xms32m -Xmx32m** -jar /opt/sonarqube/lib/sonar-application-8.5.jar

but we dont want to use this hardcoded value and want to add this in properties file,

And in properties file also ,we could see there are options for webserver,compute engine and elastic search java paramters which are commented though .

#sonar.web.javaOpts=-Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError
#sonar.ce.javaOpts=-Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Xms512m -XX:MaxDirectMemorySize=256m -XX:+HeapDumpOnOutOfMemoryError

thought above lines are commented out in sonar properties file ,we could see the process is still running with some xms and xmx values as shown below , i want to understand how can we handle these java args without hardcoding in systemd file as mentioned in sonarqube documentation

sonarqu+ 21366 21345  1 12:03 ?        00:00:30 /usr/lib/jvm/java-17-amazon-corretto.x86_64/bin/java -XX:+UseG1GC -XX:ErrorFile=../logs/es_hs_err_pid%p.log -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djna.tmpdir=/apps/sq-shared/temp -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dio.netty.allocator.numDirectArenas=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j2.formatMsgNoLookups=true -Djava.locale.providers=COMPAT -Dcom.redhat.fips=false -Des.enforce.bootstrap.checks=true -Xmx512m Xms512m -XX:MaxDirectMemorySize=256m -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/apps/sonarqube- -Des.path.conf=/apps/sq-shared/temp/conf/es -Des.distribution.flavor=default -Des.distribution.type=tar -Des.bundled_jdk=false -cp /apps/sonarqube-* org.elasticsearch.bootstrap.Elasticsearch
sonarqu+ 22702 21345  1 12:03 ?        00:00:36 /usr/lib/jvm/java-17-amazon-corretto.x86_64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/ --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/ -Dcom.redhat.fips=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.proxyPort=3128 -Dhttp.nonProxyHosts=localhost|127.*|[::1] -Dhttps.proxyPort=3128 -cp ./lib/sonar-application- /apps/sq-shared/temp/sq-process10740007161579562454properties
sonarqu+ 23431 21345  0 12:03 ?        00:00:18 /usr/lib/jvm/java-17-amazon-corretto.x86_64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/ -Dcom.redhat.fips=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.proxyPort=3128 -Dhttp.nonProxyHosts=localhost|127.*|[::1] -Dhttps.proxyPort=3128 -cp ./lib/sonar-application- /apps/sq-shared/temp/sq-process8895548503069915097properties
[root@ip-10-133-52-212 system]# 

Hey there.

This is just enough memory to launch the “real” processes that use more memory. I’ve never seen a situation where they need adjusted, and I would really suggest using what’s int he docs.

The defaults are the three “real” processes (web, compute engine, and search) are what is commented out in the properties file – if you want to change them, you would uncomment the values and adjust them. They’re just example values when commented out (and, conveniently enough, the default values!)

Thanks Colin ,

Also, i have other doubts about installing plugins on sonarqube community version which we hosted on AWS .

Docs ref : Install a Plugin | SonarQube Docs
plugin which we want to install : SonarQube SAML Single Sign On (SSO) - Introduction

As mentioned in sonarqube document , we need to install the plugin in sonarqube installation/home folder → “$SONARQUBE_HOME/extensions/plugins”. we have the sonarqube home folder “SQ_Home” mounted as a local volume. I

if plugins are installed which go under SQ_HOME/extensions/plugin then how can we handle scenarios when AWS ELB failed health check triggers launches new SQ instance after terminating the existing sonarqube instance which would make us to lose all the plugins data since it mounted as a local volume.

please give some suggestions on handling plugins for this usecase

You would need some kind of persistent volume that would be mounted when a new SonarQube instance is launched.

For any further questions that differ from your original question, I invite you to raise a new thread.