aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-main
diff options
context:
space:
mode:
authorJacek <jacek.poreda@sonarsource.com>2021-08-11 09:57:45 +0200
committersonartech <sonartech@sonarsource.com>2021-08-11 20:08:08 +0000
commit25a855f89d998a717339376628201d4aac1b14a5 (patch)
tree656894ab25dabf41633c2fcb04e577c59c2c3ac3 /server/sonar-main
parentd21c92c4643a7ded02d18edd4d41f9ce2f6af4a3 (diff)
downloadsonarqube-25a855f89d998a717339376628201d4aac1b14a5.tar.gz
sonarqube-25a855f89d998a717339376628201d4aac1b14a5.zip
SONAR-15244 Use G1GC for Elasticsearch
Diffstat (limited to 'server/sonar-main')
-rw-r--r--server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java3
-rw-r--r--server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java3
-rw-r--r--server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java6
3 files changed, 6 insertions, 6 deletions
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<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
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" +