You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geaflow.apache.org by "kitalkuyo-gita (via GitHub)" <gi...@apache.org> on 2025/09/03 03:38:47 UTC

[PR] refactor : pipeline async strategy [geaflow]

kitalkuyo-gita opened a new pull request, #608:
URL: https://github.com/apache/geaflow/pull/608

   ### What changes were proposed in this pull request?
   <!--Please describe the major changes for this PR-->
   
   ### How was this PR tested?
   - [ ] Tests have Added for the changes
   - [ ] Production environment verified
   


-- 
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: issues-unsubscribe@geaflow.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@geaflow.apache.org
For additional commands, e-mail: issues-help@geaflow.apache.org


Re: [PR] refactor : pipeline async strategy [geaflow]

Posted by "kitalkuyo-gita (via GitHub)" <gi...@apache.org>.
kitalkuyo-gita commented on code in PR #608:
URL: https://github.com/apache/geaflow/pull/608#discussion_r2338291733


##########
geaflow/geaflow-core/geaflow-engine/geaflow-cluster/src/main/java/org/apache/geaflow/cluster/client/strategy/ResourceBasedAsyncStrategy.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geaflow.cluster.client.strategy;
+
+import org.apache.geaflow.common.config.Configuration;
+import org.apache.geaflow.common.config.keys.ExecutionConfigKeys;
+import org.apache.geaflow.common.config.keys.FrameworkConfigKeys;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Resource-based async mode strategy that considers driver and container resources.
+ * This strategy automatically enables async mode when there are multiple drivers
+ * or many containers to optimize resource utilization.
+ */
+public class ResourceBasedAsyncStrategy implements AsyncModeStrategy {
+    
+    private static final Logger LOGGER = LoggerFactory.getLogger(ResourceBasedAsyncStrategy.class);
+    private static final int DEFAULT_ASYNC_THRESHOLD_DRIVERS = 2;
+    private static final int DEFAULT_ASYNC_THRESHOLD_CONTAINERS = 4;
+    
+    @Override
+    public boolean shouldUseAsyncMode(Configuration config) {
+        int driverNum = config.getInteger(ExecutionConfigKeys.DRIVER_NUM);
+        int containerNum = config.getInteger(ExecutionConfigKeys.CONTAINER_NUM);
+        
+        // Get configurable thresholds, fall back to defaults if not specified
+        int driverThreshold = config.getInteger(
+            FrameworkConfigKeys.ASYNC_RESOURCE_DRIVER_THRESHOLD, DEFAULT_ASYNC_THRESHOLD_DRIVERS);
+        int containerThreshold = config.getInteger(
+            FrameworkConfigKeys.ASYNC_RESOURCE_CONTAINER_THRESHOLD, DEFAULT_ASYNC_THRESHOLD_CONTAINERS);
+        
+        // Use async mode if we have multiple drivers or many containers
+        boolean shouldUseAsync = driverNum >= driverThreshold || containerNum >= containerThreshold;

Review Comment:
   Hi.[cbqiao](https://github.com/cbqiao). I'm glad you reviewed my code. The variable FrameworkConfigKeys#ASYNC_MODE_STRATEGY provides three modes, among which config_based is the original mode. In addition, the other two modes are provided. They are developed because of the characteristics of asynchronous mode. The original intention of the design of asynchronous mode is to make more full use of cluster resources. When the number of drivers is large or the number of containers reaches a certain scale, the concurrency and complexity of the system will increase. At this time, the synchronous mode often becomes a bottleneck, resulting in insufficient utilization of resources. The asynchronous mode can better decouple the dependencies between various computing units and improve overall throughput and resource utilization. In actual production environments, the number of drivers and containers are important indicators for measuring the scale of jobs. As long as either party reaches the 
 asynchronous threshold, it means that the job already has a high concurrency, and the use of asynchronous mode can significantly improve operating efficiency. If only the number of drivers is used as a trigger condition, many large-scale container scenarios will be ignored, resulting in performance waste. So I think it is necessary



-- 
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: issues-unsubscribe@geaflow.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@geaflow.apache.org
For additional commands, e-mail: issues-help@geaflow.apache.org


Re: [PR] refactor : pipeline async strategy [geaflow]

Posted by "cbqiao (via GitHub)" <gi...@apache.org>.
cbqiao commented on code in PR #608:
URL: https://github.com/apache/geaflow/pull/608#discussion_r2336028984


##########
geaflow/geaflow-core/geaflow-engine/geaflow-cluster/src/main/java/org/apache/geaflow/cluster/client/strategy/ResourceBasedAsyncStrategy.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geaflow.cluster.client.strategy;
+
+import org.apache.geaflow.common.config.Configuration;
+import org.apache.geaflow.common.config.keys.ExecutionConfigKeys;
+import org.apache.geaflow.common.config.keys.FrameworkConfigKeys;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Resource-based async mode strategy that considers driver and container resources.
+ * This strategy automatically enables async mode when there are multiple drivers
+ * or many containers to optimize resource utilization.
+ */
+public class ResourceBasedAsyncStrategy implements AsyncModeStrategy {
+    
+    private static final Logger LOGGER = LoggerFactory.getLogger(ResourceBasedAsyncStrategy.class);
+    private static final int DEFAULT_ASYNC_THRESHOLD_DRIVERS = 2;
+    private static final int DEFAULT_ASYNC_THRESHOLD_CONTAINERS = 4;
+    
+    @Override
+    public boolean shouldUseAsyncMode(Configuration config) {
+        int driverNum = config.getInteger(ExecutionConfigKeys.DRIVER_NUM);
+        int containerNum = config.getInteger(ExecutionConfigKeys.CONTAINER_NUM);
+        
+        // Get configurable thresholds, fall back to defaults if not specified
+        int driverThreshold = config.getInteger(
+            FrameworkConfigKeys.ASYNC_RESOURCE_DRIVER_THRESHOLD, DEFAULT_ASYNC_THRESHOLD_DRIVERS);
+        int containerThreshold = config.getInteger(
+            FrameworkConfigKeys.ASYNC_RESOURCE_CONTAINER_THRESHOLD, DEFAULT_ASYNC_THRESHOLD_CONTAINERS);
+        
+        // Use async mode if we have multiple drivers or many containers
+        boolean shouldUseAsync = driverNum >= driverThreshold || containerNum >= containerThreshold;

Review Comment:
   Why is asynchronous mode enabled when there are multiple drivers or containers, especially when the number of containers exceeds the threshold? It seems that the original logic does not use this condition to trigger async mode.



-- 
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: issues-unsubscribe@geaflow.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@geaflow.apache.org
For additional commands, e-mail: issues-help@geaflow.apache.org


Re: [PR] refactor : pipeline async strategy [geaflow]

Posted by "cbqiao (via GitHub)" <gi...@apache.org>.
cbqiao commented on code in PR #608:
URL: https://github.com/apache/geaflow/pull/608#discussion_r2338721650


##########
geaflow/geaflow-core/geaflow-engine/geaflow-cluster/src/main/java/org/apache/geaflow/cluster/client/strategy/ResourceBasedAsyncStrategy.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geaflow.cluster.client.strategy;
+
+import org.apache.geaflow.common.config.Configuration;
+import org.apache.geaflow.common.config.keys.ExecutionConfigKeys;
+import org.apache.geaflow.common.config.keys.FrameworkConfigKeys;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Resource-based async mode strategy that considers driver and container resources.
+ * This strategy automatically enables async mode when there are multiple drivers
+ * or many containers to optimize resource utilization.
+ */
+public class ResourceBasedAsyncStrategy implements AsyncModeStrategy {
+    
+    private static final Logger LOGGER = LoggerFactory.getLogger(ResourceBasedAsyncStrategy.class);
+    private static final int DEFAULT_ASYNC_THRESHOLD_DRIVERS = 2;
+    private static final int DEFAULT_ASYNC_THRESHOLD_CONTAINERS = 4;
+    
+    @Override
+    public boolean shouldUseAsyncMode(Configuration config) {
+        int driverNum = config.getInteger(ExecutionConfigKeys.DRIVER_NUM);
+        int containerNum = config.getInteger(ExecutionConfigKeys.CONTAINER_NUM);
+        
+        // Get configurable thresholds, fall back to defaults if not specified
+        int driverThreshold = config.getInteger(
+            FrameworkConfigKeys.ASYNC_RESOURCE_DRIVER_THRESHOLD, DEFAULT_ASYNC_THRESHOLD_DRIVERS);
+        int containerThreshold = config.getInteger(
+            FrameworkConfigKeys.ASYNC_RESOURCE_CONTAINER_THRESHOLD, DEFAULT_ASYNC_THRESHOLD_CONTAINERS);
+        
+        // Use async mode if we have multiple drivers or many containers
+        boolean shouldUseAsync = driverNum >= driverThreshold || containerNum >= containerThreshold;

Review Comment:
   @Loognqiang Async mode is commonly used in multi-driver scenarios. Please help check if the change makes sense.



-- 
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: issues-unsubscribe@geaflow.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@geaflow.apache.org
For additional commands, e-mail: issues-help@geaflow.apache.org