Skip to content
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

slow disk read speed even though a first read pass was 20x faster #796

Open
thestick613 opened this issue May 25, 2024 · 2 comments
Open
Labels
question Not a bug, clarifications, undocumented behaviour

Comments

@thestick613
Copy link

Hello,
I have a btrfs fs over a md raid1 over 2 nvme drives. It uses these parameters compress=zstd:1,nobarrier,commit=150,noatime.
I copiest 20 LARGE files to this filesystem. They are text data, easily compressible, they take up 10% of their original disk size.
I then concatenated all 20 files into one. The disk usage didn't change too much. I then ran a multithreaded C program which read 256MB block chunks from this file, and i got 200-300MB read speeds according to logs. The large file is 8 TB, and each small file is 400GB.

After this initial run, i re-run the program and now i'm barely getting 20-30MB read speeds. What's happening here?
I plan on removing the 20 files, defragmenting the huge file and then rebooting, to see which one impacts the read speed.
My kernel is 6.1.0-21-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.90-1 (2024-05-03) x86_64 GNU/Linux and the version i'm running is btrfs version btrfs-progs v6.2.

@Forza-tng
Copy link
Contributor

Perhaps btrfs is doing something while you run your tests. commit=150 means larger amount of work each commit. Another issue could be that files were cached during initial reads.

nobarrier is a dangerous mount option as it can lead data loss on power loss or crashes.

Why don't you use btrfs raid1 instead of md? Btrfs balances reads based on pid (not sure on thread id) on the different devices.

@Snoop05
Copy link

Snoop05 commented May 27, 2024

Re: balancing reads based on TID, i seems it does, for example:
smbd with aio_pthread does balance reads even for single client/file transfer, since it spawns multiple threads to do so,
In contrast the io_uring backend would only read from one mirror, even for concurrent transfers

@kdave kdave added the question Not a bug, clarifications, undocumented behaviour label May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Not a bug, clarifications, undocumented behaviour
Projects
None yet
Development

No branches or pull requests

4 participants