TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Monoio – A thread-per-core Rust async runtime with io_uring

158 pointsby losfairover 3 years ago

10 comments

ezekiel68over 3 years ago
I truly appreciate that this team uses nightly rust and only runs only Linux currently (due to relying on io_uring). Truly in the spirit of systems programming - focusing on a single, tight, efficient implementation first and leaving other considerations such as cross-platform compatibility for later. Lets those of us who love to live on the bleeding edge have our nice things too! :)
评论 #29494781 未加载
评论 #29494484 未加载
jorangreefover 3 years ago
With context switches becoming more and more expensive relative to faster and faster I&#x2F;O devices, almost the same order of magnitude, I believe that thread-per-core is where things are heading, because the alternative of not doing thread-per-core might literally be halving your throughput.<p>That&#x27;s also the most exciting thing about io_uring for me: how it enables a simple, single-threaded and yet highly performant thread-per-core control plane, outsourcing to the kernel thread pool for the async I&#x2F;O data plane, instead of outsourcing to a user space thread pool as in the past. It&#x27;s much more efficient and at the same time, much easier to reason about. There&#x27;s no longer the need for multithreading to leak into the control plane.<p>My experience with io_uring has been mostly working on TigerBeetleDB [1], a new distributed database that can process a million financial transactions a second, and I find it&#x27;s a whole new way of thinking... that you can now just submit I&#x2F;O directly from the control plane without blocking and without the cost of a context switch. It really changes the kinds of designs you can achieve, especially in the storage space (e.g. things like LSM-tree compactions can become much more parallel and incremental, while also becoming much simpler, i.e. no longer any need to think of memory barriers). Fantastic also to now have a unified API for networking&#x2F;storage.<p>So much good stuff in io_uring. Exciting times.<p>[1] <a href="https:&#x2F;&#x2F;www.tigerbeetle.com" rel="nofollow">https:&#x2F;&#x2F;www.tigerbeetle.com</a>
评论 #29500632 未加载
Zababaover 3 years ago
There are four articles in Chinese about the design and implementation on one of the author&#x27;s blog. Here&#x27;s a link to the first one: <a href="https:&#x2F;&#x2F;www.ihcblog.com&#x2F;rust-runtime-design-1&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.ihcblog.com&#x2F;rust-runtime-design-1&#x2F;</a>. I don&#x27;t know the subject and Chinese enough to know how much is lost by automatic translation (Google in my case), but it looks relatively good.<p>As an aside, Google translation integrated in Chrome breaks the formatting of the code blocks, which is surprising since they&#x27;re in a &lt;pre&gt; block.
moggersover 3 years ago
I&#x27;ve found in my own use of rust I want async&#x2F;nonblocking for two things.<p>1. Be able to timeout a read of a socket<p>2. Be able to select over multiple sockets, and read whichever is ready first<p>Usually a combination of both.<p>epoll&#x2F;io_uring(I guess? I only ever did research on epoll) seem like the solution being handed to me on a silver platter, however my understanding is if you want to use either of those you&#x27;re meant to use async in rust, and that while there are some libraries which provide interfaces for this kind of behavior outside of async, they&#x27;re usually very ad-hoc and that the community is just very laser focused on async as a language construct. What I don&#x27;t understand is why does Rust consider it necessary to introduce async, futures, runtimes, an executor, async versions of TcpListeners, Files, etc for this?<p>Why can&#x27;t I just have a function in the standard library that takes a slice of std::net::TcpListeners, a timeout, blocks, and then gives me whichever is ready to read, when its ready to read, or nothing if the timeout is reached? Its not like I was going to do anything else on that thread while I wait for a packet to be received, it can happily be parked.<p>Instead I have to select a runtime, and libraries compatible with the runtime, replace all the TcpListeners from the standard library I&#x27;m using with tokio TcpListeners or whatever, deal with API change, and now I have to deal with the &quot;turtles all the way down&quot; problem of async as well.<p>That&#x27;s not even to get into the whole nightmare that a lot of really sick libraries which I want to use in a blocking nature, are now only providing async APIs, which means its &quot;async or the highway&quot;. I am very much not happy about this situation and I don&#x27;t know what I can do about it. It seems the only response I ever get is &quot;just use it, its easy&quot; but that is not at all convincing me. I don&#x27;t want to use it!
评论 #29496996 未加载
评论 #29496609 未加载
jgiliasover 3 years ago
I wonder how much and for what Rust is being used at Bytedance, given that this seems to be under their GitHub org. It&#x27;s pretty interesting that they are apparently using it.<p>Edit: For those wondering who Bytedance are, I can save you a Google search. These are the people making TikTok.
评论 #29496181 未加载
评论 #29496435 未加载
jkelleyrtpover 3 years ago
It&#x27;s exciting to see another thread-per-core async runtime for Rust. It&#x27;s truly understated how difficult the Send + Sync requirements in Tokio are for writing regular code. It&#x27;s typically rare for async tasks in Tokio to be used across two threads simultaneously, but now <i>all</i> of your data must be Send+Sync.<p>Plus, Tokio is unique in that it&#x27;s one of the very few runtimes in existence that&#x27;s work-stealing (meaning the task can move off its original thread). Most other runtimes in other languages do not have that requirement, meaning you can use traditional Cell&#x2F;RefCell&#x2F;Rc instead of their slower, atomic variants.<p>Right now, the best you can do is write a thread pool that spawns a Tokio LocalSet to run !Send futures. In fact, this is what Actin-web does to achieve its crazy performance. Web requests finish so quickly you rarely need work-stealing to achieve good performance, and often the cost of atomics&#x2F;stealing is greater than the performance gain.
评论 #29501058 未加载
评论 #29500511 未加载
评论 #29500527 未加载
zinclozengeover 3 years ago
There&#x27;s a ton of bleeding edge and novel work being done by Chinese companies and communities due to their insane scale requirements. I&#x27;ve been trying to learn the language to gain more insight and stay current with what they&#x27;re doing.
rektideover 3 years ago
Have any other Rust async runtimes use io_uring&#x2F;gotten at all good yet?<p>Best of the best modern systems programmers gotta get good sometime. Not sure if it&#x27;s happening yet. Ok here&#x27;s one point of call: <a href="https:&#x2F;&#x2F;github.com&#x2F;tokio-rs&#x2F;tokio-uring" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tokio-rs&#x2F;tokio-uring</a>
评论 #29494681 未加载
评论 #29500191 未加载
评论 #29494210 未加载
renoxover 3 years ago
Does someone knows the pro&#x2F;cons of io_uring vs DPDK in these these one thread per core setup?
billconanover 3 years ago
I have a stupid question, why isn&#x27;t an async runtime a language feature of rust? we don&#x27;t seem to see so many async runtimes in other languages? They seem to have a default way to run async tasks?
评论 #29500873 未加载
评论 #29501265 未加载
评论 #29500838 未加载