diff --git a/client/conf/server.properties.in b/client/conf/server.properties.in index fd75c9d3ea0..5958486b4df 100644 --- a/client/conf/server.properties.in +++ b/client/conf/server.properties.in @@ -58,3 +58,7 @@ access.log=/var/log/cloudstack/management/access.log # The deployment mode for the extensions extensions.deployment.mode=@EXTENSIONSDEPLOYMENTMODE@ + +# Thread pool configuration +#threads.min=10 +#threads.max=500 diff --git a/client/src/main/java/org/apache/cloudstack/ServerDaemon.java b/client/src/main/java/org/apache/cloudstack/ServerDaemon.java index e5ad3d43b2f..196695e1fc6 100644 --- a/client/src/main/java/org/apache/cloudstack/ServerDaemon.java +++ b/client/src/main/java/org/apache/cloudstack/ServerDaemon.java @@ -86,6 +86,8 @@ public class ServerDaemon implements Daemon { private static final int DEFAULT_REQUEST_CONTENT_SIZE = 1048576; private static final String REQUEST_MAX_FORM_KEYS_KEY = "request.max.form.keys"; private static final int DEFAULT_REQUEST_MAX_FORM_KEYS = 5000; + private static final String THREADS_MIN = "threads.min"; + private static final String THREADS_MAX = "threads.max"; //////////////////////////////////////////////////////// /////////////// Server Configuration /////////////////// @@ -106,6 +108,8 @@ public class ServerDaemon implements Daemon { private String keystoreFile; private String keystorePassword; private String webAppLocation; + private int minThreads; + private int maxThreads; ////////////////////////////////////////////////// /////////////// Public methods /////////////////// @@ -147,6 +151,8 @@ public class ServerDaemon implements Daemon { setSessionTimeout(Integer.valueOf(properties.getProperty(SESSION_TIMEOUT, "30"))); setMaxFormContentSize(Integer.valueOf(properties.getProperty(REQUEST_CONTENT_SIZE_KEY, String.valueOf(DEFAULT_REQUEST_CONTENT_SIZE)))); setMaxFormKeys(Integer.valueOf(properties.getProperty(REQUEST_MAX_FORM_KEYS_KEY, String.valueOf(DEFAULT_REQUEST_MAX_FORM_KEYS)))); + setMinThreads(Integer.valueOf(properties.getProperty(THREADS_MIN, "10"))); + setMaxThreads(Integer.valueOf(properties.getProperty(THREADS_MAX, "500"))); } catch (final IOException e) { logger.warn("Failed to read configuration from server.properties file", e); } finally { @@ -164,8 +170,8 @@ public class ServerDaemon implements Daemon { public void start() throws Exception { // Thread pool final QueuedThreadPool threadPool = new QueuedThreadPool(); - threadPool.setMinThreads(10); - threadPool.setMaxThreads(500); + threadPool.setMinThreads(minThreads); + threadPool.setMaxThreads(maxThreads); // Jetty Server server = new Server(threadPool); @@ -394,4 +400,12 @@ public class ServerDaemon implements Daemon { public void setMaxFormKeys(int maxFormKeys) { this.maxFormKeys = maxFormKeys; } + + public void setMinThreads(int minThreads) { + this.minThreads = minThreads; + } + + public void setMaxThreads(int maxThreads) { + this.maxThreads = maxThreads; + } }