# io\_uring in a key-value store

Published 2026-01-12 · Topics: Performance, Data structures

Batching system calls without making tail latency worse.

A key-value store spends much of its time waiting for the network and the disk. io_uring lets it describe that waiting in batches instead of one system call at a time.

## Two rings

The application writes requests into a submission ring and reads results from a completion ring, both shared with the kernel. A single system call can submit many requests at once, and completions can be collected without one.

## Batching without waiting

Batching saves system calls only if the batch fills up, and waiting for it to fill adds latency to the requests already in it. The loop that works submits whatever is ready each time it runs out of other work:

1. Process every completion that has arrived.
2. Queue the reads and writes those completions made possible.
3. Submit the queue, however long it is, and go back to step 1.

## One ring per core

Sharing a ring between threads needs a lock on the hot path. A ring per core, with each connection owned by one core, keeps the path free of locks and the data in that core's cache.

[All articles](https://danielealbano.me/blog)

## Building something with RAG, search or AI? Write to me.

[Open the contact form](https://danielealbano.me/contact)

---

Every page of this site is available in Markdown: request its URL with the header `Accept: text/markdown`.
