Package io.prestosql.execution.executor
Class MultilevelSplitQueue
- java.lang.Object
-
- io.prestosql.execution.executor.MultilevelSplitQueue
-
@ThreadSafe public class MultilevelSplitQueue extends Object
-
-
Constructor Summary
Constructors Constructor Description MultilevelSplitQueue(double levelTimeMultiplier)
MultilevelSplitQueue(TaskManagerConfig taskManagerConfig)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
computeLevel(long threadUsageNanos)
long
getLevel0Time()
long
getLevel1Time()
long
getLevel2Time()
long
getLevel3Time()
long
getLevel4Time()
long
getLevelMinPriority(int level, long taskThreadUsageNanos)
io.airlift.stats.CounterStat
getSelectedCountLevel0()
io.airlift.stats.CounterStat
getSelectedCountLevel1()
io.airlift.stats.CounterStat
getSelectedCountLevel2()
io.airlift.stats.CounterStat
getSelectedCountLevel3()
io.airlift.stats.CounterStat
getSelectedCountLevel4()
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.void
remove(PrioritizedSplitRunner split)
void
removeAll(Collection<PrioritizedSplitRunner> splits)
int
size()
PrioritizedSplitRunner
take()
Priority
updatePriority(Priority oldPriority, long quantaNanos, long scheduledNanos)
Presto '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.
-
-
-
Constructor Detail
-
MultilevelSplitQueue
@Inject public MultilevelSplitQueue(TaskManagerConfig taskManagerConfig)
-
MultilevelSplitQueue
public MultilevelSplitQueue(double levelTimeMultiplier)
-
-
Method Detail
-
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
public PrioritizedSplitRunner take() throws InterruptedException
- Throws:
InterruptedException
-
updatePriority
public Priority updatePriority(Priority oldPriority, long quantaNanos, long scheduledNanos)
Presto '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()
-
-