3 ms·
Additionally, they must not be empty to maximize throughput of consumers which benefit from batching. If there's only ever one item to grab, consumers cannot am
by colanderman 4y ago
Additionally, they must not be empty to maximize throughput of consumers which benefit from batching. If there's only ever one item to grab, consumers cannot amortize fetches across a batch, which impacts throughput, without any inherent benefit to latency.
(Imagine sending a TCP packet for every individual byte that was enqueued on a socket!)
Same applies if you have any sort of load shedding on the consumer side. If the queue is empty, it means you've shed load you didn't need to; when the next brief drop in load comes, you can't take advantage of it.
(Fun analogy: this is why Honda hybrids typically don't charge their battery all the way while driving, to allow the chance to do so for free while braking.)