From: Jacek Date: Wed, 11 Aug 2021 07:57:45 +0000 (+0200) Subject: SONAR-15244 Use G1GC for Elasticsearch X-Git-Tag: 9.1.0.47736~157 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=25a855f89d998a717339376628201d4aac1b14a5;p=sonarqube.git SONAR-15244 Use G1GC for Elasticsearch --- diff --git a/server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java b/server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java index 9c96cc0e407..975b5a7071e 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java +++ b/server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java @@ -55,8 +55,7 @@ public class EsJvmOptions extends JvmOptions { private static void fromJvmDotOptionsFile(File tmpDir, Map res) { // GC configuration - res.put("-XX:CMSInitiatingOccupancyFraction=", "75"); - res.put("-XX:+UseCMSInitiatingOccupancyOnly", ""); + res.put("-XX:+UseG1GC", ""); // (by default ES 6.6.1 uses variable ${ES_TMPDIR} which is replaced by start scripts. Since we start JAR file // directly on windows, we specify absolute file as URL (to support space in path) instead diff --git a/server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java b/server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java index b3bf9a7c1ce..637f472bcdb 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java @@ -134,6 +134,7 @@ public class CommandFactoryImplTest { assertThat(esConfig.getHttpPort()).isEqualTo(9001); assertThat(esConfig.getEsJvmOptions().getAll()) // enforced values + .contains("-XX:+UseG1GC") .contains("-Dfile.encoding=UTF-8") // default settings .contains("-Xms512m", "-Xmx512m", "-XX:+HeapDumpOnOutOfMemoryError"); @@ -169,6 +170,7 @@ public class CommandFactoryImplTest { assertThat(esConfig.getHttpPort()).isEqualTo(9001); assertThat(esConfig.getEsJvmOptions().getAll()) // enforced values + .contains("-XX:+UseG1GC") .contains("-Dfile.encoding=UTF-8") // default settings .contains("-Xms512m", "-Xmx512m", "-XX:+HeapDumpOnOutOfMemoryError"); @@ -209,6 +211,7 @@ public class CommandFactoryImplTest { assertThat(esConfig.getHttpPort()).isEqualTo(1234); assertThat(esConfig.getEsJvmOptions().getAll()) // enforced values + .contains("-XX:+UseG1GC") .contains("-Dfile.encoding=UTF-8") .contains("-Djava.io.tmpdir=" + tempDir.getAbsolutePath()) // user settings diff --git a/server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java b/server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java index f3d78b6adfe..12b202f261f 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java @@ -50,8 +50,7 @@ public class EsJvmOptionsTest { assertThat(underTest.getAll()) .containsExactly( - "-XX:CMSInitiatingOccupancyFraction=75", - "-XX:+UseCMSInitiatingOccupancyOnly", + "-XX:+UseG1GC", "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath(), "-XX:ErrorFile=../logs/es_hs_err_pid%p.log", "-Des.networkaddress.cache.ttl=60", @@ -132,8 +131,7 @@ public class EsJvmOptionsTest { "\n" + "# DO NOT EDIT THIS FILE\n" + "\n" + - "-XX:CMSInitiatingOccupancyFraction=75\n" + - "-XX:+UseCMSInitiatingOccupancyOnly\n" + + "-XX:+UseG1GC\n" + "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath() + "\n" + "-XX:ErrorFile=../logs/es_hs_err_pid%p.log\n" + "-Des.networkaddress.cache.ttl=60\n" +