mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
make server threads configurable with server.properties file (#11540)
Co-authored-by: Ahmed Awlaqi <ahmed.awlaqi@sue.nl> Co-authored-by: Daan Hoogland <dahn@apache.org>
This commit is contained in:
parent
abe41add86
commit
76ef8d31f8
@ -58,3 +58,7 @@ access.log=/var/log/cloudstack/management/access.log
|
|||||||
|
|
||||||
# The deployment mode for the extensions
|
# The deployment mode for the extensions
|
||||||
extensions.deployment.mode=@EXTENSIONSDEPLOYMENTMODE@
|
extensions.deployment.mode=@EXTENSIONSDEPLOYMENTMODE@
|
||||||
|
|
||||||
|
# Thread pool configuration
|
||||||
|
#threads.min=10
|
||||||
|
#threads.max=500
|
||||||
|
|||||||
@ -86,6 +86,8 @@ public class ServerDaemon implements Daemon {
|
|||||||
private static final int DEFAULT_REQUEST_CONTENT_SIZE = 1048576;
|
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 String REQUEST_MAX_FORM_KEYS_KEY = "request.max.form.keys";
|
||||||
private static final int DEFAULT_REQUEST_MAX_FORM_KEYS = 5000;
|
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 ///////////////////
|
/////////////// Server Configuration ///////////////////
|
||||||
@ -106,6 +108,8 @@ public class ServerDaemon implements Daemon {
|
|||||||
private String keystoreFile;
|
private String keystoreFile;
|
||||||
private String keystorePassword;
|
private String keystorePassword;
|
||||||
private String webAppLocation;
|
private String webAppLocation;
|
||||||
|
private int minThreads;
|
||||||
|
private int maxThreads;
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
/////////////// Public methods ///////////////////
|
/////////////// Public methods ///////////////////
|
||||||
@ -147,6 +151,8 @@ public class ServerDaemon implements Daemon {
|
|||||||
setSessionTimeout(Integer.valueOf(properties.getProperty(SESSION_TIMEOUT, "30")));
|
setSessionTimeout(Integer.valueOf(properties.getProperty(SESSION_TIMEOUT, "30")));
|
||||||
setMaxFormContentSize(Integer.valueOf(properties.getProperty(REQUEST_CONTENT_SIZE_KEY, String.valueOf(DEFAULT_REQUEST_CONTENT_SIZE))));
|
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))));
|
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) {
|
} catch (final IOException e) {
|
||||||
logger.warn("Failed to read configuration from server.properties file", e);
|
logger.warn("Failed to read configuration from server.properties file", e);
|
||||||
} finally {
|
} finally {
|
||||||
@ -164,8 +170,8 @@ public class ServerDaemon implements Daemon {
|
|||||||
public void start() throws Exception {
|
public void start() throws Exception {
|
||||||
// Thread pool
|
// Thread pool
|
||||||
final QueuedThreadPool threadPool = new QueuedThreadPool();
|
final QueuedThreadPool threadPool = new QueuedThreadPool();
|
||||||
threadPool.setMinThreads(10);
|
threadPool.setMinThreads(minThreads);
|
||||||
threadPool.setMaxThreads(500);
|
threadPool.setMaxThreads(maxThreads);
|
||||||
|
|
||||||
// Jetty Server
|
// Jetty Server
|
||||||
server = new Server(threadPool);
|
server = new Server(threadPool);
|
||||||
@ -394,4 +400,12 @@ public class ServerDaemon implements Daemon {
|
|||||||
public void setMaxFormKeys(int maxFormKeys) {
|
public void setMaxFormKeys(int maxFormKeys) {
|
||||||
this.maxFormKeys = maxFormKeys;
|
this.maxFormKeys = maxFormKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMinThreads(int minThreads) {
|
||||||
|
this.minThreads = minThreads;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxThreads(int maxThreads) {
|
||||||
|
this.maxThreads = maxThreads;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user