chengshiwen commented on a change in pull request #5113:
URL: 
https://github.com/apache/incubator-dolphinscheduler/pull/5113#discussion_r598405008



##########
File path: 
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/CommonHostManager.java
##########
@@ -45,53 +51,96 @@
     protected ZookeeperRegistryCenter registryCenter;
 
     /**
-     * zookeeperNodeManager
+     * zookeeper node manager
      */
     @Autowired
     protected ZookeeperNodeManager zookeeperNodeManager;
 
+    /**
+     * zk master client
+     */
+    @Autowired
+    protected ZKMasterClient zkMasterClient;
+
+    /**
+     * worker group mapper
+     */
+    @Autowired
+    protected WorkerGroupMapper workerGroupMapper;
+
     /**
      * select host
      * @param context context
      * @return host
      */
     @Override
     public Host select(ExecutionContext context) {
-        Host host = new Host();
-        Collection<String> nodes = null;
+        List<HostWorker> candidates = null;
         String workerGroup = context.getWorkerGroup();
-        // executor type
         ExecutorType executorType = context.getExecutorType();
         switch (executorType) {
             case WORKER:
-                nodes = zookeeperNodeManager.getWorkerGroupNodes(workerGroup);
+                candidates = getHostWorkersFromDatabase(workerGroup);

Review comment:
       By the way, if the database query causes stress, it seems that reading 
the data of several zk nodes maybe cause more stresses every time.
   
   
![image](https://user-images.githubusercontent.com/4902714/111936922-a5556f80-8b01-11eb-8e04-2d0a3b3973d2.png)
   




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to