diff options
3 files changed, 22 insertions, 0 deletions
diff --git a/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java b/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java index d2312154872..0f1efd0ce6f 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java +++ b/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java @@ -60,6 +60,9 @@ public class ProcessProperties { public static final String WEB_JAVA_OPTS = "sonar.web.javaOpts"; public static final String WEB_JAVA_ADDITIONAL_OPTS = "sonar.web.javaAdditionalOpts"; + public static final String CE_JAVA_OPTS = "sonar.ce.javaOpts"; + public static final String CE_JAVA_ADDITIONAL_OPTS = "sonar.ce.javaAdditionalOpts"; + /** * Used by Orchestrator to ask for shutdown of monitor process */ @@ -74,6 +77,8 @@ public class ProcessProperties { // jruby is slow with java 8: https://jira.sonarsource.com/browse/SONAR-6115 "-Djruby.compile.invokedynamic=false"; + public static final String CE_ENFORCED_JVM_ARGS = "-Djava.awt.headless=true -Dfile.encoding=UTF-8"; + private ProcessProperties() { // only static stuff } @@ -111,6 +116,8 @@ public class ProcessProperties { defaults.put(ProcessProperties.WEB_JAVA_OPTS, "-Xmx768m -Xms256m -XX:MaxPermSize=160m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true"); defaults.put(ProcessProperties.WEB_JAVA_ADDITIONAL_OPTS, ""); + defaults.put(ProcessProperties.CE_JAVA_OPTS, "-Xmx768m -Xms256m -XX:MaxPermSize=160m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true"); + defaults.put(ProcessProperties.CE_JAVA_ADDITIONAL_OPTS, ""); defaults.put(ProcessProperties.JDBC_URL, "jdbc:h2:tcp://localhost:9092/sonar"); defaults.put(ProcessProperties.JDBC_MAX_ACTIVE, "60"); defaults.put(ProcessProperties.JDBC_MAX_IDLE, "5"); diff --git a/sonar-application/src/main/assembly/conf/sonar.properties b/sonar-application/src/main/assembly/conf/sonar.properties index 905c626599a..ae765e33d98 100644 --- a/sonar-application/src/main/assembly/conf/sonar.properties +++ b/sonar-application/src/main/assembly/conf/sonar.properties @@ -198,6 +198,18 @@ # COMPUTE ENGINE # The Compute Engine is responsible for processing background tasks. +# Compute Engine is executed in a dedicated Java process. By default heap size is 768Mb. +# Use the following property to customize JVM options. +# Recommendations: +# +# The HotSpot Server VM is recommended. The property -server should be added if server mode +# is not enabled by default on your environment: http://docs.oracle.com/javase/7/docs/technotes/guides/vm/server-class.html +# +#sonar.ce.javaOpts=-Xmx768m -Xms256m -XX:MaxPermSize=160m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true + +# Same as previous property, but allows to not repeat all other settings like -Xmx +#sonar.ce.javaAdditionalOpts= + # The number of workers in the Compute Engine. # Use the following property to configure 1 or more workers. Value must be >= 1. Default value is 1. # By default the Compute Engine uses a single worker and therefor processes tasks one at a time. diff --git a/sonar-application/src/main/java/org/sonar/application/App.java b/sonar-application/src/main/java/org/sonar/application/App.java index c66b5fade38..7067d122d11 100644 --- a/sonar-application/src/main/java/org/sonar/application/App.java +++ b/sonar-application/src/main/java/org/sonar/application/App.java @@ -107,6 +107,9 @@ public class App implements Stoppable { private static JavaCommand createCeServerCommand(Props props, File homeDir) { JavaCommand webServer = new JavaCommand("ce", CESERVER_PROCESS_INDEX) .setWorkDir(homeDir) + .addJavaOptions(ProcessProperties.CE_ENFORCED_JVM_ARGS) + .addJavaOptions(props.nonNullValue(ProcessProperties.CE_JAVA_OPTS)) + .addJavaOptions(props.nonNullValue(ProcessProperties.CE_JAVA_ADDITIONAL_OPTS)) .setClassName("org.sonar.ce.app.CeServer") .setArguments(props.rawProperties()) .addClasspath("./lib/common/*") |