Class JobVertexScaler<KEY,​Context extends JobAutoScalerContext<KEY>>


  • public class JobVertexScaler<KEY,​Context extends JobAutoScalerContext<KEY>>
    extends java.lang.Object
    Component responsible for computing vertex parallelism based on the scaling metrics.
    • Field Detail

      • INEFFECTIVE_SCALING

        @VisibleForTesting
        protected static final java.lang.String INEFFECTIVE_SCALING
        See Also:
        Constant Field Values
      • INEFFECTIVE_MESSAGE_FORMAT

        @VisibleForTesting
        protected static final java.lang.String INEFFECTIVE_MESSAGE_FORMAT
        See Also:
        Constant Field Values
    • Method Detail

      • computeScaleTargetParallelism

        public int computeScaleTargetParallelism​(Context context,
                                                 org.apache.flink.runtime.jobgraph.JobVertexID vertex,
                                                 java.util.Collection<ShipStrategy> inputShipStrategies,
                                                 java.util.Map<ScalingMetric,​EvaluatedScalingMetric> evaluatedMetrics,
                                                 java.util.SortedMap<java.time.Instant,​ScalingSummary> history,
                                                 java.time.Duration restartTime)
      • scale

        @VisibleForTesting
        protected static int scale​(int currentParallelism,
                                   java.util.Collection<ShipStrategy> inputShipStrategies,
                                   int maxParallelism,
                                   double scaleFactor,
                                   int parallelismLowerLimit,
                                   int parallelismUpperLimit)
        Computing the newParallelism. In general, newParallelism = currentParallelism * scaleFactor. But we limit newParallelism between parallelismLowerLimit and min(parallelismUpperLimit, maxParallelism).

        Also, in order to ensure the data is evenly spread across subtasks, we try to adjust the parallelism for source and keyed vertex such that it divides the maxParallelism without a remainder.

      • setClock

        @VisibleForTesting
        protected void setClock​(java.time.Clock clock)