Hi ,
we are installing our new sonarqube server on aws (version - 9.5.0.56709) 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** -Djava.net.preferIPv4Stack=true -jar /opt/sonarqube/lib/sonar-application-8.5.jar
StandardOutput=syslog
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
#sonar.search.javaOpts=-Xmx512m -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 -Djava.io.tmpdir=/apps/sq-shared/temp -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 -Djava.security.policy=/opt/sonarqube/elasticsearch/config/security.policy -Des.path.home=/apps/sonarqube-9.5.0.56709/elasticsearch -Des.path.conf=/apps/sq-shared/temp/conf/es -Des.distribution.flavor=default -Des.distribution.type=tar -Des.bundled_jdk=false -cp /apps/sonarqube-9.5.0.56709/elasticsearch/lib/* 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 -Djava.io.tmpdir=/apps/sq-shared/temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --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/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -Dcom.redhat.fips=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.proxyHost=outbound-proxy.services.aws.fico.com -Dhttp.proxyPort=3128 -Dhttp.nonProxyHosts=localhost|127.*|[::1] -Dhttps.proxyHost=outbound-proxy.services.aws.fico.com -Dhttps.proxyPort=3128 -cp ./lib/sonar-application-9.5.0.56709.jar:/apps/sonarqube-9.5.0.56709/lib/jdbc/postgresql/postgresql-42.3.3.jar org.sonar.server.app.WebServer /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 -Djava.io.tmpdir=/apps/sq-shared/temp -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/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -Dcom.redhat.fips=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.proxyHost=outbound-proxy.services.aws.fico.com -Dhttp.proxyPort=3128 -Dhttp.nonProxyHosts=localhost|127.*|[::1] -Dhttps.proxyHost=outbound-proxy.services.aws.fico.com -Dhttps.proxyPort=3128 -cp ./lib/sonar-application-9.5.0.56709.jar:/apps/sonarqube-9.5.0.56709/lib/jdbc/postgresql/postgresql-42.3.3.jar org.sonar.ce.app.CeServer /apps/sq-shared/temp/sq-process8895548503069915097properties
[root@ip-10-133-52-212 system]#