]> 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>
Thu, 16 Dec 2021 20:03:10 +0000 (20:03 +0000)
(cherry picked from commit 7b8885e93c0e9c48d0d4c4b0e4651d9afc3e916b)

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 0063e9c32e605a6d9b95d6f6675252513e69f81f..6f3f6b4432bd83be845b0979f0a176e7f2dba83d 100644 (file)
@@ -55,9 +55,7 @@ public class EsJvmOptions extends JvmOptions<EsJvmOptions> {
 
   private static void fromJvmDotOptionsFile(File tmpDir, Map<String, String> res) {
     // GC configuration
-    res.put("-XX:+UseConcMarkSweepGC", "");
-    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 e8318bc1b5f8a5869cfe2fedd4440626375be810..7fe5d39a40d67d0e84caacb164ef33f929f5291f 100644 (file)
@@ -135,7 +135,8 @@ public class CommandFactoryImplTest {
     assertThat(esConfig.getHttpPort()).isEqualTo(9001);
     assertThat(esConfig.getEsJvmOptions().getAll())
       // enforced values
-      .contains("-XX:+UseConcMarkSweepGC", "-Dfile.encoding=UTF-8")
+      .contains("-XX:+UseG1GC")
+      .contains("-Dfile.encoding=UTF-8")
       // default settings
       .contains("-Xms512m", "-Xmx512m", "-XX:+HeapDumpOnOutOfMemoryError");
     assertThat(esConfig.getEsYmlSettings()).isNotNull();
@@ -170,7 +171,8 @@ public class CommandFactoryImplTest {
     assertThat(esConfig.getHttpPort()).isEqualTo(9001);
     assertThat(esConfig.getEsJvmOptions().getAll())
       // enforced values
-      .contains("-XX:+UseConcMarkSweepGC", "-Dfile.encoding=UTF-8")
+      .contains("-XX:+UseG1GC")
+      .contains("-Dfile.encoding=UTF-8")
       // default settings
       .contains("-Xms512m", "-Xmx512m", "-XX:+HeapDumpOnOutOfMemoryError");
     assertThat(esConfig.getEsYmlSettings()).isNotNull();
@@ -210,7 +212,8 @@ public class CommandFactoryImplTest {
     assertThat(esConfig.getHttpPort()).isEqualTo(1234);
     assertThat(esConfig.getEsJvmOptions().getAll())
       // enforced values
-      .contains("-XX:+UseConcMarkSweepGC", "-Dfile.encoding=UTF-8")
+      .contains("-XX:+UseG1GC")
+      .contains("-Dfile.encoding=UTF-8")
       .contains("-Djava.io.tmpdir=" + tempDir.getAbsolutePath())
       // user settings
       .contains("-Xms10G", "-Xmx10G")
index 693d173213d401f767b542b6985127b02922e6b7..47d900b82777e942370f64a82578292074bec356 100644 (file)
@@ -49,10 +49,8 @@ public class EsJvmOptionsTest {
     EsJvmOptions underTest = new EsJvmOptions(new Props(properties), tmpDir);
 
     assertThat(underTest.getAll())
-      .containsExactlyInAnyOrder(
-        "-XX:+UseConcMarkSweepGC",
-        "-XX:CMSInitiatingOccupancyFraction=75",
-        "-XX:+UseCMSInitiatingOccupancyOnly",
+      .containsExactly(
+        "-XX:+UseG1GC",
         "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath(),
         "-XX:ErrorFile=../logs/es_hs_err_pid%p.log",
         "-Des.networkaddress.cache.ttl=60",
@@ -134,9 +132,7 @@ public class EsJvmOptionsTest {
         "\n" +
         "# DO NOT EDIT THIS FILE\n" +
         "\n" +
-        "-XX:+UseConcMarkSweepGC\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" +