1996fanrui commented on code in PR #782:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/782#discussion_r1500641728


##########
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/tuning/MemoryTuning.java:
##########
@@ -277,6 +286,32 @@ private static MemorySize adjustNetworkMemory(
         return new MemorySize(memBudget.budget(maxNetworkMemory));
     }
 
+    /**
+     * Calculate how many network segment current vertex needs.
+     *
+     * @param currentVertexParallelism The parallelism of current vertex.
+     * @param otherVertexParallelism The parallelism of other vertex.
+     */
+    @VisibleForTesting
+    static int calculateNetworkSegmentNumber(
+            int currentVertexParallelism,
+            int otherVertexParallelism,
+            String shipStrategy,
+            int buffersPerChannel,
+            int floatingBuffers) {
+        // TODO When the parallelism is changed via the rescale api, the 
FORWARD may be changed to
+        // RESCALE. This logic may needs to be updated after FLINK-33123.
+        if (currentVertexParallelism == otherVertexParallelism && 
"FORWARD".equals(shipStrategy)) {
+            return buffersPerChannel + floatingBuffers;
+        } else if ("FORWARD".equals(shipStrategy) || 
"RESCALE".equals(shipStrategy)) {

Review Comment:
   
   <img width="673" alt="image" 
src="https://github.com/apache/flink-kubernetes-operator/assets/38427477/7752b9d2-b6db-4a24-b831-e517c14029a8";>
   
   
   <img width="856" alt="image" 
src="https://github.com/apache/flink-kubernetes-operator/assets/38427477/2483d3b9-9279-4be9-896a-f879d91117ff";>
   



-- 
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: [email protected]

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

Reply via email to