A bigger queue does not make the service faster
Backpressure, bounded work and Little's Law
Bounded queues must slow admission, not just collect waiting tasks. Little's Law relates average work, throughput and residence time.
A service receives 120 jobs a second and can finish 100. In a simplified constant-rate model, its backlog grows by 20 each second: 1,200 extra jobs after a minute.
A larger buffer buys time. It does not add processing capacity.
Make waiting reach the producer
Backpressure lets a slow consumer make the producer slow down or wait. An asyncio.Queue with a positive maxsize makes await put wait when full. That suspends the task rather than blocking the whole event loop.
But spawning a million tasks that each wait to enqueue still holds a million jobs outside the queue. Limit admission or task creation too.
In Node.js, Writable.write returning false means stop additional writes and wait for drain. It does not mean the chunk was rejected and must be resent. A stream pipeline only controls memory if its sources respect that signal.
A bounded queue in practice
Some puts wait roughly 0.25 seconds. maxsize counts queued items, not bytes or work already removed for processing.
Quantify work in flight with Little's Law
For a stable system, consistent boundaries and appropriate long-run averages:
L = λ × W
L is the mean number of jobs inside the chosen boundary, λ the mean admitted arrival rate, equal to departure rate in a balanced steady state, and W the mean time inside it.
If the boundary includes queueing and execution, both L and W include them. Do not combine a whole-request duration with a database-only population.
At 200 requests/second and 0.15 seconds mean residence time, the mean work in flight is 30. If a new stable regime retains that rate but averages 0.6 seconds, it holds 120.
These requests may be waiting on I/O. They are not necessarily executing on a CPU.
The law does not choose your pool size
If 200 database operations/second hold a connection for an average 0.02 seconds, the mean occupied connections are four. That is not a recommendation to configure a four-connection pool: bursts, variability and database limits still matter.
Likewise, substituting P99 for W does not produce P99 concurrency. The relationship uses averages. An indefinitely growing backlog is not the steady state assumed here. If admission rejects requests, external attempts and admitted arrivals are different populations.
Decide what the system accepts
Bound active work, waiting time and memory. Backpressure, controlled rejection and more processing capacity solve different parts of the problem. Unlimited waiting can move resource pressure into clients and open connections.
Check yourself
A queue holds at most 100 items. Each new request starts a task waiting to put. Is the total limited to 100? No: waiting tasks and active jobs also count.
Separately, 40 average jobs at 100 jobs/second imply 0.4 seconds mean residence time. They say nothing by themselves about P99.