Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions client/conf/server.properties.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@ webapp.dir=/usr/share/cloudstack-management/webapp

# The path to access log file
access.log=/var/log/cloudstack/management/access.log

# Thread pool configuration
threads.min=10
threads.max=500
Comment on lines +56 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor - too many places we are setting the default value. This could have been a comment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Thread pool configuration
threads.min=10
threads.max=500
# Thread pool configuration
#threads.min=10
#threads.max=500

18 changes: 16 additions & 2 deletions client/src/main/java/org/apache/cloudstack/ServerDaemon.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public class ServerDaemon implements Daemon {
private static final String ACCESS_LOG = "access.log";
private static final String REQUEST_CONTENT_SIZE_KEY = "request.content.size";
private static final int DEFAULT_REQUEST_CONTENT_SIZE = 1048576;
private static final String THREADS_MIN = "threads.min";
private static final String THREADS_MAX = "threads.max";

////////////////////////////////////////////////////////
/////////////// Server Configuration ///////////////////
Expand All @@ -101,6 +103,8 @@ public class ServerDaemon implements Daemon {
private String keystoreFile;
private String keystorePassword;
private String webAppLocation;
private int minThreads = 10;
private int maxThreads = 500;
Comment on lines +106 to +107
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a small a nitpick, but you don't need to initialize these values, as in the properties.getProperty call you already inform these as default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will you change this @ahmedali6 ? No big deal if you don't, but if you do, you can also comment out the new properties for the same reason.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private int minThreads = 10;
private int maxThreads = 500;
private int minThreads; // = 10
private int maxThreads; // = 500


//////////////////////////////////////////////////
/////////////// Public methods ///////////////////
Expand Down Expand Up @@ -141,6 +145,8 @@ public void init(final DaemonContext context) {
setAccessLogFile(properties.getProperty(ACCESS_LOG, "access.log"));
setSessionTimeout(Integer.valueOf(properties.getProperty(SESSION_TIMEOUT, "30")));
setMaxFormContentSize(Integer.valueOf(properties.getProperty(REQUEST_CONTENT_SIZE_KEY, String.valueOf(DEFAULT_REQUEST_CONTENT_SIZE))));
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 {
Expand All @@ -158,8 +164,8 @@ public void init(final DaemonContext context) {
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);
Expand Down Expand Up @@ -366,4 +372,12 @@ public void setSessionTimeout(int sessionTimeout) {
public void setMaxFormContentSize(int maxFormContentSize) {
this.maxFormContentSize = maxFormContentSize;
}

public void setMinThreads(int minThreads) {
this.minThreads = minThreads;
}

public void setMaxThreads(int maxThreads) {
this.maxThreads = maxThreads;
}
}