2 ms·
Ring buffers and clever batching abstractions can help get you much closer to ideal. > When consumers are waiting on an advancing cursor sequence in the ring b
by bob1029 3y ago
Ring buffers and clever batching abstractions can help get you much closer to ideal.
> When consumers are waiting on an advancing cursor sequence in the ring buffer an interesting opportunity arises that is not possible with queues. If the consumer finds the ring buffer cursor has advanced a number of steps since it last checked it can process up to that sequence without getting involved in the concurrency mechanisms. This results in the lagging consumer quickly regaining pace with the producers when the producers burst ahead thus balancing the system. This type of batching increases throughput while reducing and smoothing latency at the same time. Based on our observations, this effect results in a close to constant time for latency regardless of load, up until the memory sub-system is saturated, and then the profile is linear following Little’s Law [6]. This is very different to the “J” curve effect on latency we have observed with queues as load increases.
https://lmax-exchange.github.io/disruptor/disruptor.html#_batching_effect https://lmax-exchange.github.io/disruptor/disruptor.html#_ba...