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

Why's the io_uring code so slow?! 🙂 #95

Closed
3 of 4 tasks
JackKelly opened this issue Mar 8, 2024 · 5 comments
Closed
3 of 4 tasks

Why's the io_uring code so slow?! 🙂 #95

JackKelly opened this issue Mar 8, 2024 · 5 comments
Assignees
Labels
performance Improvements to runtime performance

Comments

@JackKelly
Copy link
Owner

JackKelly commented Mar 8, 2024

@JackKelly JackKelly added the performance Improvements to runtime performance label Mar 8, 2024
@JackKelly JackKelly self-assigned this Mar 8, 2024
@JackKelly JackKelly moved this to Todo in light-speed-io Mar 8, 2024
@JackKelly
Copy link
Owner Author

I think the root cause is that the SQ only ever has one entry in it at a time. I've tried a few "quick fixes" but none seem to help!

@JackKelly
Copy link
Owner Author

JackKelly commented Mar 8, 2024

Printing a few quick hacky metrics suggests that the loops in move_entries_from_internal_queue_to_uring_sq and move_entries_from_injectors_queue_to_uring_sq behave as expected: they do often inject multiple entries onto the SQ.

Which makes me think that maybe each iteration of our main worker loop "just" take too long, so io_uring empties the SQ long before we have a chance to fill it back up again?

@JackKelly
Copy link
Owner Author

JackKelly commented Mar 8, 2024

I've just done some more experiments with fio. It turns out that fio gets similar performance (~1.8 GiB/s) to LSIO when fio uses direct=0, and a single thread. And the flamegraph for LSIO shows that messing around with the page cache is taking a lot of time.

fio shows that using direct=1 and using multiple worker threads is sufficient to saturate the SSD.

So I should use O_DIRECT #51

@JackKelly JackKelly moved this from Todo to In Progress in light-speed-io Mar 8, 2024
@JackKelly
Copy link
Owner Author

#51 has considerably sped up io_uring! We're now getting more like 5.1 GiB/s on get_1000_whole_files/uring_get

@JackKelly
Copy link
Owner Author

After implementing O_DIRECT, uring is now competitive with object_store (phew!)

I think the next "big things" to improve performance will be:

@github-project-automation github-project-automation bot moved this from In Progress to Done in light-speed-io Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Improvements to runtime performance
Projects
Status: Done
Development

No branches or pull requests

1 participant