]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-15244 Use G1GC for Elasticsearch
authorJacek <jacek.poreda@sonarsource.com>
Wed, 11 Aug 2021 07:57:45 +0000 (09:57 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 11 Aug 2021 20:08:08 +0000 (20:08 +0000)
server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java
server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java
server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java

index 9c96cc0e40726b16cfdd87a1d89d2bfa294152c7..975b5a7071e67583c104ad73d2634ee36615ca8a 100644 (file)
@@ -55,8 +55,7 @@ public class EsJvmOptions extends JvmOptions<EsJvmOptions> {
 
   private static void fromJvmDotOptionsFile(File tmpDir, Map<String, String> 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
index b3bf9a7c1ce5453b1542286d6331ae881d6af89a..637f472bcdb4c691750da6b4273f7ec41eb03086 100644 (file)
@@ -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
index f3d78b6adfe437fe4d7e8a449f7c0a0ab19ea6bd..12b202f261faace2970ddd214a71284662c14464 100644 (file)
@@ -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" +