cpu_slot_preemption
Defines how workload scheduling for CPU resources (MASTER THREAD and WORKER THREAD) is done.- If
true(default), accounting is done based on actual CPU time consumed. A fair number of CPU time would be allocated to competing workloads. Slots are allocated for a limited amount of time and re-requested after expiry. Slot requesting may block thread execution in case of CPU resource overload, i.e., preemption may happen. This ensures CPU-time fairness. - If
false, accounting is based on the number of CPU slots allocated. A fair number of CPU slots would be allocated to competing workloads. A slot is allocated when a thread starts, held continuously, and released when the thread ends execution. The number of threads allocated for query execution may only increase from 1 tomax_threadsand never decrease. This is more favorable to long-running queries and may lead to CPU starvation of short queries.
cpu_slot_preemption_timeout_ms
It defines how many milliseconds could a worker thread wait during preemption, i.e. while waiting for another CPU slot to be granted. After this timeout, if thread was unable to acquire a new CPU slot it will exit and the query is scaled down to a lower number of concurrently executing threads dynamically. Note that master thread never downscaled, but could be preempted indefinitely. Makes sense only whencpu_slot_preemption is enabled and CPU resource is defined for WORKER THREAD.
Example
cpu_slot_quantum_ns
It defines how many CPU nanoseconds a thread is allowed to consume after acquired a CPU slot and before it should request another CPU slot. Makes sense only ifcpu_slot_preemption is enabled and CPU resource is defined for MASTER THREAD or WORKER THREAD.
Example