Sunny Bains @TiDB (@sunbains) on X
x.com·13h·
Discuss: X
🔄Cache Coherence
Preview
Report Post

It’s coroutines, with thread pools. Thread pool is a fairly straight forward work stealing queue. The coroutines reduce busy wait (polling). SPSC loc free power of 2 bounded queue for mailbox communication. There is a single consumer thread and a single IO thread. A buffer pool of free, full (ready to write) buffers and an active buffer.

For previous versions I was using a MPMC lock free power of two bounded queue. The busy wait, and cache ping pong due to the atomics in the queue implementation was challenging to control.

With coroutines and TP the producers are mapped to fewer threads on the TP and yield instead of polling and exponential back off etc. the CPU utilization is now for real work.

The throughput should be limited by IO, earlier it was limited at the CPU level.

Next, I …

Similar Posts

Loading similar posts...