shwstppr commented on code in PR #9840:
URL: https://github.com/apache/cloudstack/pull/9840#discussion_r1828872384


##########
agent/src/main/java/com/cloud/agent/Agent.java:
##########
@@ -1136,22 +1175,16 @@ public void doTask(final Task task) throws 
TaskExecutionException {
                     } else {
                         //put the requests from mgt server into another thread 
pool, as the request may take a longer time to finish. Don't block the NIO main 
thread pool
                         //processRequest(request, task.getLink());
-                        _executor.submit(new AgentRequestHandler(getType(), 
getLink(), request));
+                        requestHandler.submit(new 
AgentRequestHandler(getType(), getLink(), request));
                     }
                 } catch (final ClassNotFoundException e) {
                     logger.error("Unable to find this request ");
                 } catch (final Exception e) {
                     logger.error("Error parsing task", e);
                 }
             } else if (task.getType() == Task.Type.DISCONNECT) {
-                try {

Review Comment:
   Removed this because reconnect method has been refactored to allow waiting 
for backoff.seconds (default = 5 sec) before connecting to the next host



##########
engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java:
##########
@@ -223,17 +231,20 @@ public boolean configure(final String name, final 
Map<String, Object> params) th
 
         registerForHostEvents(new SetHostParamsListener(), true, true, false);
 
-        _executor = new ThreadPoolExecutor(threads, threads, 60l, 
TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new 
NamedThreadFactory("AgentTaskPool"));
+        final int agentTaskThreads = DirectAgentLoadSize.value();
+        _executor = new ThreadPoolExecutor(agentTaskThreads, agentTaskThreads, 
60L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new 
NamedThreadFactory("AgentTaskPool"));
 
         _connectExecutor = new ThreadPoolExecutor(100, 500, 60l, 
TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new 
NamedThreadFactory("AgentConnectTaskPool"));
         // allow core threads to time out even when there are no items in the 
queue
         _connectExecutor.allowCoreThreadTimeOut(true);
 
-        _connection = new NioServer("AgentManager", Port.value(), 
Workers.value() + 10, this, caService);
+        _connection = new NioServer("AgentManager", Port.value(), 
Workers.value() + 10,
+                RemoteAgentSslHandshakeMinWorkers.value(), 
RemoteAgentSslHandshakeMaxWorkers.value(), this,
+                caService, RemoteAgentSslHandshakeTimeout.value());
         logger.info("Listening on {} with {} workers.", Port.value(), 
Workers.value());
 
         // executes all agent commands other than cron and ping
-        _directAgentExecutor = new 
ScheduledThreadPoolExecutor(DirectAgentPoolSize.value(), new 
NamedThreadFactory("DirectAgent"));
+        _directAgentExecutor = new 
ThreadPoolExecutor(Math.max(agentTaskThreads/10, 1), 
DirectAgentPoolSize.value(), 120L, TimeUnit.SECONDS, new 
LinkedBlockingQueue<>(), new NamedThreadFactory("DirectAgent"));

Review Comment:
   Used 1/10th because default value of config - DirectAgentPoolSize is 500 and 
it was creating that many core threads from 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to