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

(very) slow writes compared to syscall writes #1261

Open
markpapadakis opened this issue Oct 9, 2024 · 2 comments
Open

(very) slow writes compared to syscall writes #1261

markpapadakis opened this issue Oct 9, 2024 · 2 comments

Comments

@markpapadakis
Copy link
Contributor

I've been trying to troubleshoot, or rather understand, an issue specific to disk I/O (writes), where
writes are just significantly slower when scheduled via IORING_OP_WRITEV SQE ops, compared to straight writev syscalls, roughly proportionally to the size(in bytes) of the data to write.

I tested this on 5.4, and on 6.8 and, if anything, it is slightly worse on 6.8.
I am testing this on an ext4 volume, on an SSD, but I doubt it would make a difference if I was testing this on XFS or on HDD.

The file is open()-ed with (O_RDWR | O_LARGEFILE | O_CREAT | O_NOATIME).

io_uring_prep_writev(sqe, fd, iov, std::size(iov), real_cur_filesize /* append */);
io_uring_submit_and_wait(&ring);

over

const auto res = writev((fd, iov, std::size(iov));

The more data that needs to be written, the slower io-uring gets over writev(). e.g for 2.6k or so, the difference is barely noticeable.
For 71k, its over x2 slower. For 140x it's almost x4 slower.

I may be missing something, but I don't know what that could be.

@markpapadakis
Copy link
Contributor Author

UPDATE:

Issue manifests on XFS as well, so it doesn't appear to be filesystem specific.

@isilence
Copy link
Collaborator

Can you get a perf profile? It should give a hint what's happening?

perf record -g --inherit -- ./your_app
perf report --children > profile.txt

Or attach by pid / tid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants