

Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- The access pattern - byte ranges of columns - suits io_uring well. All the problems are because of poor engineering.by luoxiaojian
- It would have been more precise to say O_DIRECT instead of io_uring. The point of io_uring is to avoid syscall overhead. What they were after was actually managing a page cache on their own, and it turned out to be more complicated than they thought.by samus
- > The internet is full of posts declaring io_uring wins over mmap.
Internet is also full of idiots not having done their homework.
Blindly throwing io_uring for mmap and hoping for better perfomance in a highly concurrent environment is a recipe for thread contention and latency spike.
Add to that the kernel lock contention on mmap. Later kernels have tried to increasingly mitigate this. But significant latency on kernel lock contention still exists.
Try mmap + numa like pinning (from software atleast via hashing the work id) and always have the same mmap be used from the same node. This usually yields better latency compared to throwing wonder weapons.
Our database Dip uses mmap burst for opening massive amounts of mmaped kv engine files along with numa pinning of the same mmap kv engine file to the same core so as to reduce cross cache contamination and page cache relocation.
io_uring (available only in more modern kernels) has so far only increased Dip's latency. Hence we have no reason yet for using it. It is a net negative for our usecase.
Use io_uring where appropriate and don't expect every mmap replaced by io_uring to do wonders.
by elendilm - Rant - CPUs have a cache hierarchy for a reason. We can use smart caches and speculative execution to fetch only the pieces of memory that actually are necessary for computation.
Large parts of the computing infra support this - like RAM, where batching requests is not really helpful, as you can hit full speed with 64 byte accesses.
This means that the tradeoff between bandwidth and latency falls somewhere in the middle, and its worth being smart about it.
MMAP and virtual memory is supposed to be the last level of this, managed by software. But it was designed in the time of spinning disks, where it took 100s of ms to serve a page fault, so parking a faulting process wasn't critical as it was almost certain you couldnt serve a request before the timeslice was up.
RAM was comparatively huge to cache, so it made sense to bring in large chunks at once - in fact this was so true, that if your app started paging, essentially it became unusable.
SSDs changed this math - you can almost certainly serve a request in tens of microseconds even with going through PCIe - hooking up flash directly to the memory hierarchy might make this even cheaper.
So the reason why io_uring exists is because the syscall overhead is now comparable. But this involves a new API and devs having to manage this manually.
I think this is wrong. I'm not sure if this is fixable with the current batch of CPUs, or needs HW support, but imo there needs to be some sort of page fault handling that's much more granular than an entire page (lets say 1-2KB, on the order of SSD page sizes)
by torginus - Yay, first article (for me!) that i actually click on because the title is interesting, and then it puts me off because it's LLM generated.
By the way, what does Rust have to do with their problem? Is Rust simply bad at io_uring? :)
by nottorp - There is a pattern in software engineering of:
* Project exists
* New employees come up with idea for efficiency improvement
* Months spent implementing. Old codepath becomes legacy.
* New thing now has extra features bolted on during build.
* Efficiency of new thing turns out worse than original, but now the new features and 'less technical debt' are the drivers.
* New thing launches, old thing deprecated, but there is little real benefit to all those months of work.
- The real issue here is there's a part 2 (linked at the end of the article) where they get the io_uring implementation to be twice as fast as mmap. So it's a clickbait title for a part 1, which gets resolved in part 2.
So they crunched out 2 articles, one of which is just ragebait. And they both seem LLM written. Maybe they have some cool advice, maybe not... but it's not a format I enjoy reading.
by laserbeam - An issue here is that mmap and io_uring require fundamentally different software architectures in a performance context. You shouldn’t swap them out.
APIs like io_uring, combined with O_DIRECT, allow you to design your own workload-specific userspace scheduler from first principles. If you are delegating scheduling to a runtime then you’ve forfeited most of the performance advantages those APIs were designed to provide. In many cases, the performance will be worse. By contrast, mmap implicitly delegates all scheduling decisions and it has some advantages if delegation is your strategy compared to a runtime.
The benefits of io_uring are limited without a commitment to designing your own schedulers. On the upside, skilled scheduler designers can increase performance by substantial integer factors using these APIs versus mmap. Designing application-specific schedulers is not easy, it is a high-skill endeavor. But the reward is real.
Using io_uring well requires going all-in on the software architecture it requires to show what it can do.