Class DistributedQueryQueue
java.lang.Object
org.apache.drill.exec.work.foreman.rm.DistributedQueryQueue
- All Implemented Interfaces:
QueryQueue
Distributed query queue which uses a Zookeeper distributed semaphore to
control queuing across the cluster. The distributed queue is actually two
queues: one for "small" queries, another for "large" queries. Query size is
determined by the Planner's estimate of query cost.
This queue is configured using system options:
- exec.queue.enable
- Set to true to enable the distributed queue.
- exec.queue.large
- The maximum number of large queries to admit. Additional queries wait in the queue.
- exec.queue.small
- The maximum number of small queries to admit. Additional queries wait in the queue.
- exec.queue.threshold
- The cost threshold. Queries below this size are small, at or above this size are large..
- exec.queue.timeout_millis
- The maximum time (in milliseconds) a query will wait in the queue before failing.
The above values are refreshed every five seconds. This aids performance a bit in systems with very high query arrival rates.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic classExposes a snapshot of internal state information for use in status reporting, such as in the UI.Nested classes/interfaces inherited from interface org.apache.drill.exec.work.foreman.rm.QueryQueue
QueryQueue.QueryQueueException, QueryQueue.QueueLease, QueryQueue.QueueTimeoutException -
Constructor Summary
ConstructorsConstructorDescriptionDistributedQueryQueue(DrillbitContext context, DistributedQueryQueue.StatusAdapter adapter) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()longdefaultQueryMemoryPerNode(double cost) Return the amount of memory per node when creating a EXPLAIN query plan.booleanenabled()Determine if the queue is enabled.enqueue(UserBitShared.QueryId queryId, double cost) This limits the number of "small" and "large" queries that a Drill cluster will run simultaneously, if queuing is enabled.getInfo()longOptional floor on the amount of memory assigned per operator.voidsetMemoryPerNode(long memoryPerNode)
-
Constructor Details
-
DistributedQueryQueue
-
-
Method Details
-
setMemoryPerNode
public void setMemoryPerNode(long memoryPerNode) - Specified by:
setMemoryPerNodein interfaceQueryQueue
-
defaultQueryMemoryPerNode
public long defaultQueryMemoryPerNode(double cost) Description copied from interface:QueryQueueReturn the amount of memory per node when creating a EXPLAIN query plan. Plans to be executed should get the query memory from the lease, as the lease may adjust the default amount on a per-query basis. This means that the memory used to execute the query may differ from the amount shown in an EXPLAIN plan.- Specified by:
defaultQueryMemoryPerNodein interfaceQueryQueue- Returns:
- assumed memory per node, in bytes, to use when creating an EXPLAIN plan
-
minimumOperatorMemory
public long minimumOperatorMemory()Description copied from interface:QueryQueueOptional floor on the amount of memory assigned per operator. This ensures that operators receive a certain amount, separate from any memory slicing. This can oversubscribe node memory if used incorrectly.- Specified by:
minimumOperatorMemoryin interfaceQueryQueue- Returns:
- minimum per-operator memory, in bytes
-
enabled
public boolean enabled()Description copied from interface:QueryQueueDetermine if the queue is enabled.- Specified by:
enabledin interfaceQueryQueue- Returns:
- true if the query is enabled, false otherwise.
-
getInfo
-
close
public void close()- Specified by:
closein interfaceQueryQueue
-