You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ref(server): Introduce a queue to the concurrency limiter (#562)
The concurrency limiter can now absorb brief capacity bursts by queuing
requests instead of rejecting them immediately. This is implemented
through semaphores: an outer semaphore (capacity `max + queue`) gates
total participants, and an inner semaphore (capacity `max`) gates
execution. Requests that pass the outer gate wait up to a configurable
timeout for an execution permit; requests that exceed both limits are
rejected with `AtCapacity` as before.
With the default `concurrency_queue = 0`, both semaphores have the same
capacity and behavior is identical to the current immediate-reject
model. In this case, there is no queuing and no added latency.
Two new config fields control the queue. Sizing guidance: set the queue
depth to roughly `permit_release_rate × acceptable_added_latency`, and
keep the timeout comfortably below client request timeouts.
```yaml
service:
max_concurrency: 500
concurrency_queue: 100
concurrency_queue_timeout: 1s
```
Batch `stream()` reservations continue to use non-blocking
`try_acquire_many` and do not enter the queue.
Ref FS-447
0 commit comments