Skip to content

Commit d5cb403

Browse files
sachindoddaguninvazquez
authored andcommitted
Make AgentConnectTaskPool core and max pool sizes configurable via global config (#839)
Replaces hardcoded values of 100/500 in initConnectExecutor() with ConfigKeys agent.connect.executor.core.pool.size (default 100) and agent.connect.executor.max.pool.size (default 500).
1 parent 4262c02 commit d5cb403

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
248248
"Percentage (as a value between 0 and 1) of direct.agent.pool.size to be used as upper thread cap for a single direct agent to process requests", false);
249249
protected final ConfigKey<Boolean> CheckTxnBeforeSending = new ConfigKey<>("Developer", Boolean.class, "check.txn.before.sending.agent.commands", "false",
250250
"This parameter allows developers to enable a check to see if a transaction wraps commands that are sent to the resource. This is not to be enabled on production systems.", true);
251+
protected final ConfigKey<Integer> AgentConnectExecutorCorePoolSize = new ConfigKey<>("Advanced", Integer.class, "agent.connect.executor.core.pool.size", "100",
252+
"Core pool size for the thread pool that handles agent connect tasks.", false);
253+
protected final ConfigKey<Integer> AgentConnectExecutorMaxPoolSize = new ConfigKey<>("Advanced", Integer.class, "agent.connect.executor.max.pool.size", "500",
254+
"Maximum pool size for the thread pool that handles agent connect tasks.", false);
251255

252256
public static final List<Host.Type> HOST_DOWN_ALERT_UNSUPPORTED_HOST_TYPES = Arrays.asList(
253257
Host.Type.SecondaryStorage,
@@ -423,7 +427,7 @@ public void onManagementServerCancelMaintenance() {
423427
}
424428

425429
private void initConnectExecutor() {
426-
_connectExecutor = new ThreadPoolExecutor(100, 500, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new NamedThreadFactory("AgentConnectTaskPool"));
430+
_connectExecutor = new ThreadPoolExecutor(AgentConnectExecutorCorePoolSize.value(), AgentConnectExecutorMaxPoolSize.value(), 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new NamedThreadFactory("AgentConnectTaskPool"));
427431
// allow core threads to time out even when there are no items in the queue
428432
_connectExecutor.allowCoreThreadTimeOut(true);
429433
}
@@ -2136,7 +2140,7 @@ public ConfigKey<?>[] getConfigKeys() {
21362140
return new ConfigKey<?>[] { CheckTxnBeforeSending, Workers, Port, Wait, AlertWait, DirectAgentLoadSize,
21372141
DirectAgentPoolSize, DirectAgentThreadCap, EnableKVMAutoEnableDisable, ReadyCommandWait,
21382142
GranularWaitTimeForCommands, RemoteAgentSslHandshakeTimeout, RemoteAgentMaxConcurrentNewConnections,
2139-
RemoteAgentNewConnectionsMonitorInterval, KVMHostDiscoverySshPort };
2143+
RemoteAgentNewConnectionsMonitorInterval, KVMHostDiscoverySshPort, AgentConnectExecutorCorePoolSize, AgentConnectExecutorMaxPoolSize };
21402144
}
21412145

21422146
protected class SetHostParamsListener implements Listener {

0 commit comments

Comments
 (0)