Interface QueueBackpressure


public interface QueueBackpressure
Native Queue Backpressure mechanism. If the queue fills up above DatabaseDescriptor.getNativeTransportQueueMaxItemAgeThreshold(). In other words, request has been sitting more than a % of DatabaseDescriptor.getNativeTransportQueueMaxItemAgeThreshold() in the queue, we start an incident.

Incident starts by marking the incident time and raising severity level to 1. Each time we observe an old item in the head of the queue, we first bump then number of times we have applied the backpressure. After bumping it 10 times, we increase severity level by 1.

Backpressure delay applied to the client socket is computed by multiplying the severity level by the minimum delay.

If we have not seen old requests in the head of the queue for 1 second, we close the incident.

If the queue remains saturated for a prolonged period (meaning Dispatcher.hasQueueCapacity() returns false), the amount of delay will increase in proportion to the request rate as appliedTimes & severityLevel are incremented. If no new requests are considered overloaded in this way for a second, the incident will be reset and so the delay will drop back down to QueueBackpressure.Incident.minDelayNanos().