This seems more interesting as demonstration of the amortized performance increase you'd expect from using io_uring, or as a tutorial for using it. I don't understand why I'd switch from using something like eza. If I'm listing 10,000 files the difference is between 40ms and 20ms. I absolutely would not notice that for a single invocation of the command.
Well I have a directory with a couple million JSON files and ls/du take minutes. Most of the coreutils are not fast enough to actually utilize modern SSDs.
lsr: ls with io_uring
71–80 of 177 posts
Re: lsr: ls with io_uring
#72Earlier quoted context omitted.
%70 faster = you wait less 35x less system calls = others wait less for the kernel to handle their system calls
> 35x less system calls = others wait less for the kernel to handle their system calls That isn't how it works. There isn't a fixed syscall budget distributed among running programs. Internally, the kernel is taking many of the same locks and resources to satisfy io_uring requests as ordinary syscall requests.
Also, more fs-related system calls mean less available kernel threads to process these system calls. eg. XFS can paralellize mutations only up to its number of allocation groups (agcount)
Re: lsr: ls with io_uring
#73Earlier quoted context omitted.
> Why does this require inventing lsr as an alternative to ls instead of making ls use io_uring? Good luck getting that upstreamed and accepted. The more foundational the tools (and GNU coreutils definitely is foundational), the more difficult that process will be. Releasing a standalone utility makes iteration much faster, partially because one is not bound to the release cycles of distributions.
In the history of Unix its also a common way to propose tool replacements, for instance how `less` became `more` on most systems, or `vim` became the new `vi` which in its day became the new `ed`.
Plus, since I actually took stevie and screen and others from comp.sources.unix and worked on them, and wasn't able to even send my improvements to M. Salz or the original authors at all, from my country, I can attest that contributing improvements had hurdles just as large to overcome back then as there exist now. They're just different.
Re: lsr: ls with io_uring
#74The times seem sublinear, 10k files is less than 10x 1k files. I remember getting in to a situation during the ext2 and spinning rust days where production directories had 500k files. ls processes were slow enough to overload everything. ls -F saved me there. And filesystems got a lot better at lots of files. What filesystem was used here? It's interesting how well busybox fares, it's written for size not speed iirc?
Re: lsr: ls with io_uring
#75I wonder how it performs against an NFS server with lots of files, especially one over a kinda-crappy connection. Putting an unreliable network service behind blocking POSIX syscalls is one of the main reasons NFS is a terrible design choice (as can be seen by anyone who's tried to ctrl+c any app that's reading from a broken NFS folder), but I wonder if io_uring mitigates the bad parts somewhat.
I don't know how io_uring solves this - does it return an error if the underlying NFS call times out? How long do you wait for a response before giving up and returning an error?
Re: lsr: ls with io_uring
#76Why isn’t it possible — or is it — to make libc just use uring instead of syscall? Yes I know uring is an async interface, but it’s trivial to implement sync behavior on top of a single chain of async send-wait pairs, like doing a simple single threaded “conversational” implementation of a network protocol. It wouldn’t make a difference in most individual cases but overall I wonder how big a global speed boost you’d…
io_uring requires API changes because you don't call it like the old read(please_fill_this_buffer). You maintain a pool of buffer that belong to the ringbuffer, and reads take buffers from the pool. You consume the data from the buffer and return it to the pool.
With the older style, you're required to maintain O(pending_reads) buffers. With the io_uring style, you have a pool of O(num_reads_completing_at_once) (I assume with backpressure but haven't actually checked).
Re: lsr: ls with io_uring
#77Why isn’t it possible — or is it — to make libc just use uring instead of syscall? Yes I know uring is an async interface, but it’s trivial to implement sync behavior on top of a single chain of async send-wait pairs, like doing a simple single threaded “conversational” implementation of a network protocol. It wouldn’t make a difference in most individual cases but overall I wonder how big a global speed boost you’d…
In order to make this work, libc would have to: - Start some sort of async executor thread to service the io_uring requests/responses - Make it so every call to "normal" syscalls causes the calling thread to sleep until the result is available (that's 1 syscall) - When the executor thread gets a result, have it wake up the original thread (that's another syscall) So you're basically turning 1 syscall into 2 in order…
Re: lsr: ls with io_uring
#78Love it. I'm trying to understand why all command line tools don't use io_uring. As an example, all my nvme's on usb 3.2 gen 2 only reach 740MB/s peak. If I use tools with aio or io_uring I get 1005MB/s. I know I may not be copying many files simultaneously every time, but the queue length strategies and the fewer locks also help I guess.
Besides, io_uring is not yet stable and who knows may be in 10 years it will be replaced by yet another mechanism to take advantage of even newer hardware. So simply waiting for io_uring prove it is here to stay is very viable strategy. Besides in 10 years we may have tools/AI that will do the rewrite automatically...
Re: lsr: ls with io_uring
#79This was more interesting for the tangled.sh platform it's hosted on. Wasn't aware of that!
Re: lsr: ls with io_uring
#80Earlier quoted context omitted.
> the value of software appears when it's run, not when it's written Have you ever tried to contribute to open source projects? The question was why wouldn't someone writing software not take the route likely to end in rejection/failure. I don't know about you, but if I write software, I am not going to write it for a project whose managers will make it difficult for my PR to be accepted, and that 99% likely it never…
> Have you ever tried to contribute to open source projects? yes, and it was often painful enough to make me consider very well wether I want to bother contributing. I can only imagine how terrible the experience must be at a core utility such as ls. > The question was why wouldn't someone writing software not take the route likely to end in rejection/failure Obviously they wouldn't - in my comment I assumed that the…
Newer ones can be just as braindead, if they came out of some commercial entity. CLAs and such.