-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
diskus slower than du #38
Comments
Interesting, thank you for reporting this. First off, please always use the But even with that out of the way, What kind of disk is your folder on? Or is it mounted via network/etc.? It could be related to the optimal number of threads. Could you please run this parametrized benchmark? hyperfine -w5 -P threads 1 16 "diskus -j {threads}" --export-markdown /tmp/results.md and post the content of By the way: if you want to see both tools report the exact same size, use |
The following results are run on a different computer % /usr/bin/du -sh
4.3G .
% diskus
4.52 GB (4,518,088,704 bytes)
I got a kind of similar result: % hyperfine --warmup 5 'diskus' 'du -sh'
Benchmark #1: diskus
Time (mean ± σ): 102.5 ms ± 27.5 ms [User: 1.899 s, System: 0.551 s]
Range (min … max): 57.2 ms … 156.5 ms 21 runs
Benchmark #2: du -sh
Time (mean ± σ): 33.0 ms ± 2.9 ms [User: 12.1 ms, System: 20.9 ms]
Range (min … max): 25.3 ms … 36.9 ms 97 runs
Summary
'du -sh' ran
3.11 ± 0.88 times faster than 'diskus'
Yes, I did
Honestly, I don't know either. It is a shared server. I could provide more info % df /home
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/lvm-home 2.7T 430G 2.2T 17% /home
% lsblk
NAME MOUNTPOINT LABEL SIZE UUID
sda 2.7T
├─sda1 1M
├─sda2 /boot 488M d3ad2fe7-0903-4329-a944-bd694a619fea
└─sda3 2.7T 5SIphy-NV0U-3NIU-VG4i-dVPD-AzaF-q61CjS
├─lvm-swap [SWAP] 1.9G b9df322f-b43c-4bd1-b214-d70f52abbd66
├─lvm-root / 19.5G 7a8bb72e-96e8-4280-945e-25d9a0931443
└─lvm-home /home 2.7T 314bd59b-e6e9-4ad5-a2db-ab581190c891
Yes, here is the result:
|
Wait, so diskus is much faster with a correctly set number of threads? Do you happen to have a massive number of CPU cores? What does
say? |
|
Oh 😄 That seems to be the cause of this. By default, We should probably cap it at some value (32?). If you have the time, it would be great if you could run the full benchmark up to 96 threads and post the JSON results here:
I would assume that the time slowly increases to 100 ms when the number of threads gets higher. (a cold cache benchmark for comparison would also be great, but I don't want to bother you). |
Sorry, I couldn't make it because it is a shared server. I don't have sudo privilege.
Here is the result: https://gist.github.com/lzutao/7b86122495608f9096ac692553e2a038 |
This looks to me like the cores stalling, because they cant get memory access. Is this OS restricted ?? |
That might be one reason. But I would rather guess that we are simply limited by the sequential nature of the disk (and cache) itself. There is a certain benefit in bombarding the IO scheduler with lots of requests (that is why we use multiple threads in the first place), but at some point the synchronization/context-switching overhead is probably just too high. There is no really solid basis for the
|
There is sysinfo with disktype. To my knowledge there exists no simple CPU-model to estimate context-switches and synchronization(on cache invalidations) etc, which is a shame, but expected regarding Spectre and similar. If you know otherwise, please tell me.
Thanks. |
|
Maybe I were doing it wrong.
The computed directory is my clippy build.
Meta
cargo update
The text was updated successfully, but these errors were encountered: