Class MultilevelSplitQueue

java.lang.Object
io.trino.execution.executor.timesharing.MultilevelSplitQueue

@ThreadSafe public class MultilevelSplitQueue extends Object
  • Constructor Details

    • MultilevelSplitQueue

      @Inject public MultilevelSplitQueue(TaskManagerConfig taskManagerConfig)
    • MultilevelSplitQueue

      public MultilevelSplitQueue(double levelTimeMultiplier)
  • Method Details

    • offer

      public void offer(PrioritizedSplitRunner split)
      During periods of time when a level has no waiting splits, it will not accumulate scheduled time and will fall behind relative to other levels.

      This can cause temporary starvation for other levels when splits do reach the previously-empty level.

      To prevent this we set the scheduled time for levels which were empty to the expected scheduled time.

    • take

      Throws:
      InterruptedException
    • updatePriority

      public Priority updatePriority(Priority oldPriority, long quantaNanos, long scheduledNanos)
      Trino 'charges' the quanta run time to the task and the level it belongs to in an effort to maintain the target thread utilization ratios between levels and to maintain fairness within a level.

      Consider an example split where a read hung for several minutes. This is either a bug or a failing dependency. In either case we do not want to charge the task too much, and we especially do not want to charge the level too much - i.e. cause other queries in this level to starve.

      Returns:
      the new priority for the task
    • remove

      public void remove(PrioritizedSplitRunner split)
    • removeAll

      public void removeAll(Collection<PrioritizedSplitRunner> splits)
    • getLevelMinPriority

      public long getLevelMinPriority(int level, long taskThreadUsageNanos)
    • size

      public int size()
    • computeLevel

      public static int computeLevel(long threadUsageNanos)
    • getLevel0Time

      public long getLevel0Time()
    • getLevel1Time

      public long getLevel1Time()
    • getLevel2Time

      public long getLevel2Time()
    • getLevel3Time

      public long getLevel3Time()
    • getLevel4Time

      public long getLevel4Time()
    • getSelectedCountLevel0

      public io.airlift.stats.CounterStat getSelectedCountLevel0()
    • getSelectedCountLevel1

      public io.airlift.stats.CounterStat getSelectedCountLevel1()
    • getSelectedCountLevel2

      public io.airlift.stats.CounterStat getSelectedCountLevel2()
    • getSelectedCountLevel3

      public io.airlift.stats.CounterStat getSelectedCountLevel3()
    • getSelectedCountLevel4

      public io.airlift.stats.CounterStat getSelectedCountLevel4()