-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Concurrent disk I/O #4362
Comments
Interesting ideas! This should be something that Rust excels at over C too, with more thread safety and convenience.There are two things I think we should keep in mind here.
|
@thecotne tried with findutils: uutils/findutils#142 |
@sylvestre I can acknowledge ROI will depend on the OS, the filesystem in use1, the underlying hardware, the implementation2, the operation(s) being performed, the configuration in use, whether the data is already in the page cache or not, and so on... but I have definitely seen it improve performance multiple times in the past. Case in point, I just ran this very synthetic benchmark on my laptop (a recent-ish macbook) and even my utterly unrefined bash "implementation" does improve throughput by 1.5x~2x:
I don't have access to it anymore, so I can't run experiments, but in the past being able to run large deletes concurrently on a gluster volume cut down wall time from many hours to few tens of minutes. Footnotes
|
Are there any notes from your past trials which include hardware specifications? I think making concurrent I/O will have different performance on different hardware products. Yes, concurrent processing will provide some performance improvements, but on some hardware it won't. It is better to think on processing side concurrency and hardware (controller, physical type) side concurrency together. |
The latest benchmark was run on the hardware described above, and can be trivially replicated on any hardware you happen to have available. Doing so should likely result in some speedup, but its magnitude may differ according to all factors listed in my previous message. The old one (deletion of many millions of files) was IIRC on a 15 nodes glusterfs cluster running on top of a large VMware farm (hundreds of servers) attached to a large SAN. The exact hardware details are lost to time (this was ~10 years ago) but, I would argue, are ultimately irrelevant. My point wasn't that in that specific case it was beneficial, but rather that I've seen it reduce wall-time in multiple scenarios, over multiple years, running from large networked file systems, to Linux servers, to modern laptops (as evidenced by the latest benchmark). I agree though there may be cases in which doing I/O concurrently will not provide much benefit. Crucially though, this is at least on my part just a hunch without evidence (contrary to the opposite case), while also being the bulk of the argument why this functionality ought to be at least opt-in or opt-out. Just FTR being a hunch without proof is not for lack of trying: I tried running that newest benchmark on a couple of laptops I have (in addition to the Mac above, a Dell 9360 with W11/WSL2) and a throwaway GCP VM with a persistent SSD volume: in all cases wall time improved. At this point I would be extremely curious about any concrete counterexample where wall time becomes worse (apart from that findutils experiment, that looks at least to my eye somewhat flawed as outlined in my previous message) to drive the conversation forward. |
I started collecting/summarizing the available experimental evidence, either in favor or against this proposal, in the first post of this issue. If additional evidence comes up please ping me and I'll add it as well. |
Yeah, I would be happy to use more parallelism in this project :) |
Commands that perform a lot of disk I/O (
cp
,mv
,rm
, etc.) are likely to complete much faster, especially when operating on SSDs1 but potentially also on slower disks2, if they issue concurrent I/O requests (ideally asynchronously and in bulk3, but synchronously via a thread pool could also work).Examples of cases where this could be very beneficial include:
cp -r <source> <dest>
where<source>
contains large number of files/subdirectoriescp <sources> <dest>
where<sources>
is a large number of filesrm -r <source>
where<source>
contains large number of files/subdirectoriesrm <sources>
where<sources>
is a large number of filesmv <sources> <dest>
where<sources>
is a large number of filesln <sources> <dest>
where<sources>
is a large number of filesls <path>
andls -r <path>
where<path>
contains large number of files/subdirectoriesdu <path>
where<path>
contains large number of files/subdirectories(and so on, the list above is not exhaustive: examples include
stat
,readlink
,touch
,chown
,chgrp
,chmod
, etc.)Whether this behavior should be opt-out/default-off or opt-in/default-on, I lean towards opt-out but I must admit I am not sure. With ever-increasing core counts and ever-higher capacity disks, I would argue there is a pretty strong case for the behavior to be opt-out rather than opt-in. At the same time, there may be concerns about these tools suddenly generating large I/O spikes, in which case it should be opt-in. In all cases, the proposed behavior should never affect the correctness of the command, or its semantics (e.g. ordering of results, behavior on error, etc.).
Currently, the closest that can be achieved with standard tools is running processes in parallel by using something like
xargs -P<n>
, but this is somewhat easy to get wrong (e.g. forgetting to use-0
, dynamically choosing between-I{}
and normal mode based on how many files we need to operate on and how long their names are, etc) and it does not, in general, maintain the standard semantics of the tools (e.g. ordering needs to be done separately, handling errors is left to the user, etc.)Update: in this section I will collect any available evidence, concerning performance, for or against this proposal:
For
find | xargs -P
showing 50-100% improvements in wall timefind
Against
Footnotes
as they tend to deliver higher throughput when operating with high queue depths ↩
as the OS can potentially coalesce a greater number of logical writes into a smaller number of disk write operations ↩
especially if via io_uring or similar mechanisms that can guarantee that in practice file operations never block, and that support batch submission ↩
The text was updated successfully, but these errors were encountered: