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.

Libuv – Linux: io_uring support

289 pointsby truth_seekeralmost 2 years ago

17 comments

fanf2almost 2 years ago
My employer, ISC, sponsored this work because we use libuv in BIND9 and we would like everyone to benefit more from the new io_uring hotness.
评论 #36114384 未加载
评论 #36122996 未加载
评论 #36107972 未加载
dan-robertsonalmost 2 years ago
The 8x speedup seems to come from a microbenchmark that requires no real async work from the kernel (so I think is mostly going to be stressing out context switches and the threadpool data structures in the non-uring case) but I’m still excited about the improvements to async io from io_uring.<p>Question I’ve not figured out yet: how can one trace io_uring operations? The api seems kinda incompatible with ptrace (which is what strace uses) but maybe there is an appropriate place to attach an ebpf? Or maybe users of io_uring will have to add their own tracing?
评论 #36108120 未加载
评论 #36108375 未加载
评论 #36108278 未加载
rektidealmost 2 years ago
And this is after node.js v20 already had some very impressive more compute-centric wins! <a href="https:&#x2F;&#x2F;blog.rafaelgss.dev&#x2F;state-of-nodejs-performance-2023" rel="nofollow">https:&#x2F;&#x2F;blog.rafaelgss.dev&#x2F;state-of-nodejs-performance-2023</a>
评论 #36107245 未加载
xiphias2almost 2 years ago
Maybe this is an arrogant question, but why adding asyncio to these libraries in general in all OSs is slow?<p>I would think that writing the kernel part would be the hardest, but it&#x27;s usually the event loop implementations that don&#x27;t use what the Windows&#x2F;MacOS&#x2F;Linux kenels offer.
评论 #36107109 未加载
评论 #36108344 未加载
评论 #36111538 未加载
truth_seekeralmost 2 years ago
Libraries, VMs, Runtimes backed by libuv :<p><a href="https:&#x2F;&#x2F;github.com&#x2F;libuv&#x2F;libuv&#x2F;blob&#x2F;v1.x&#x2F;LINKS.md">https:&#x2F;&#x2F;github.com&#x2F;libuv&#x2F;libuv&#x2F;blob&#x2F;v1.x&#x2F;LINKS.md</a>
评论 #36110755 未加载
alberthalmost 2 years ago
Does this mean that NodeJS apps will gain 8x throughout?
评论 #36107150 未加载
评论 #36107654 未加载
评论 #36107147 未加载
评论 #36112189 未加载
评论 #36111399 未加载
ithinksoalmost 2 years ago
It&#x27;s the same &#x27;for&#x27; in the title that I don&#x27;t understand in the &#x27;Windows subsystem for Linux&#x27;. English is not my native language but it is only recently that I started to notice this usage of for. Has it always been used like this?<p>Github post does it normally: &#x27;Add io_uring support for several asynchronous file operations:&#x27;
评论 #36108067 未加载
评论 #36111625 未加载
评论 #36107977 未加载
评论 #36108055 未加载
评论 #36107970 未加载
评论 #36107959 未加载
评论 #36107503 未加载
评论 #36119476 未加载
moralestapiaalmost 2 years ago
libuv is such an underrated piece of technology!<p>If you haven&#x27;t yet, please go check it out, write a program with it and be amazed.<p>So glad to be a contributor.
评论 #36111012 未加载
评论 #36110738 未加载
loegalmost 2 years ago
8x throughput in what benchmark?
评论 #36107094 未加载
quietbritishjimalmost 2 years ago
&gt; Add io_uring support for several asynchronous file operations: read, write; fsync, fdatasync; stat, fstat, lstat<p>Does this mean libuv already supported io_uring for non-file operations? Or it still doesn&#x27;t?<p>Async file operations are useful in some applications, but not the main things people normally think of when they hear async IO.
MichaelMoser123almost 2 years ago
very impressive!<p>Just one questions: what about older versions of linux that don&#x27;t have io_uring, does it fall back gracefully to older system calls or are these older versions of linux no longer supported?
评论 #36111937 未加载
heyonialmost 2 years ago
Does this potentially mean you could write a sql driver using libuv in python and benefit from async calls performance without the main python scripts using any async libraries or conventions?
评论 #36107518 未加载
destructionatoralmost 2 years ago
libuv&#x27;s implementation of &quot;async&quot; disk i&#x2F;o brings massive overhead (somewhat necessarily on linux, totally unnecessarily on other systems), so just about anything (including just switching to straight blocking read&#x2F;write&#x2F;seek&#x2F;etc syscalls) would result in a significant speed increase.<p>This isn&#x27;t to say that io_uring is bad, just don&#x27;t draw too much a conclusion from any benchmark of their old impl beyond the context of their old impl specifically.
gigatexalalmost 2 years ago
really cool to read that thread and see neovim devs looking at it as well. we need a sort of open source hall of fame and axboe should be there for sure
samsquirealmost 2 years ago
This is really good. Thank you!<p>I&#x27;ve been studying how to create an asynchronous runtime that works across threads. My goal: neither CPU and IO bound work slow down event loops.<p>How do you write code that elegantly defines a state machine across threads&#x2F;parallelism&#x2F;async IO? How do you efficiently define choreographies between microservices, threads, servers and flows?<p>I&#x27;ve only written two Rust programs but in Rust you presumably you can use Rayon (CPU scheduling) and Tokio (IO scheduling)<p>I wrote about using the LMAX Disruptor ringbuffer pattern between threads.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;samsquire&#x2F;ideas4#51-rewrite-synchronous-code-into-lmax-disruptor-thread-pools---event-loops-that-dont-block-on-cpu-usage">https:&#x2F;&#x2F;github.com&#x2F;samsquire&#x2F;ideas4#51-rewrite-synchronous-c...</a><p>I am designing a state machine formulation syntax that is thread safe and parallelises effectively. It looks like EBNF syntax or a bash pipeline. Parallel steps go in curly brackets. There is an implied interthread ringbuffer between pipes. It is inspired by prolog, whereby there can be multiple conditions or &quot;facts&quot; before a stateline &quot;fires&quot; and transitions. Transitions always go from left to right but within a stateline (what is between a pipe symbol) can fire in any order. A bit like a countdown latch.<p><pre><code> states = state1 | {state1a state1b state1c} {state2a state2b state2c} | state3 </code></pre> You can can think of each fact as an &quot;await&quot; but all at the same time.<p><pre><code> initial_state.await = { state1a.await state1b.await state1c.await }.await { state2a.await state2b.await state2c.await } | state3.await </code></pre> In io_uring and LMAX Disruptor, you split all IO into two halves: submit and handle. Here is a liburing state machine that can send and receive in parallel.<p><pre><code> accept | { submit_recv! | recv | submit_send } { submit_send! | send | submit_recv } </code></pre> I want there to be ring buffers between groups of states. So we have full duplex sending and receiving.<p>Here is a state machine for async&#x2F;await between threads:<p><pre><code> next_free_thread = 2 task(A) thread(1) assignment(A, 1) = running_on(A, 1) | paused(A, 1) running_on(A, 1) thread(1) assignment(A, 1) thread_free(next_free_thread) = fork(A, B) | send_task_to_thread(B, next_free_thread) | running_on(B, 2) paused(B, 1) running_on(A, 1) | { yield(B, returnvalue) | paused(B, 2) } { await(A, B, returnvalue) | paused(A, 1) } | send_returnvalue(B, A, returnvalue)</code></pre>
Ahmad498almost 2 years ago
This is ready for review now. Linux v5.13 is the minimum required, otherwise libuv falls back to the thread pool.
29athrowawayalmost 2 years ago
Add &quot;On Linux&quot; to the title.
评论 #36109021 未加载