You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2025/08/31 09:11:10 UTC
(cloudstack) branch pr/9260 created (now 654bc11aebc)
This is an automated email from the ASF dual-hosted git repository.
dahn pushed a change to branch pr/9260
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
at 654bc11aebc make server threads configurable with server.properties file
This branch includes the following new commits:
new 654bc11aebc make server threads configurable with server.properties file
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(cloudstack) 01/01: make server threads configurable with server.properties file
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dahn pushed a commit to branch pr/9260
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit 654bc11aebccf1297715a3a09c56e1eaeff61c8a
Author: Ahmed Awlaqi <ah...@sue.nl>
AuthorDate: Fri Jun 14 15:10:45 2024 +0200
make server threads configurable with server.properties file
---
client/conf/server.properties.in | 4 ++++
.../main/java/org/apache/cloudstack/ServerDaemon.java | 18 ++++++++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
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..48a54c2e06f 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 = 10;
+ private int maxThreads = 500;
//////////////////////////////////////////////////
/////////////// 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;
+ }
}