bevyengine / bevyengine/bevy

OS-Native Async IO Support

Open
#20,482 0 comments 1 reaction 0 assignees View on GitHub
A-Assets A-Networking A-Tasks C-Feature C-Performance O-Linux O-MacOS O-Windows
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?
Right now, our local file reads are done with [`async-fs`](https://crates.io/crates/async-fs), backed by the [`blocking`](https://crates.io/crates/blocking) crate, to run a dynamic thread pool for running blocking IO operations

This thread pool does its job, but may result in higher counts of context switches with the threads periodically returning control to the OS with each syscall.

## What solution would you like?
Incorporate the use of OS-level async IO systems (i.e. io_uring on Linux, IORing on Windows) to lower our reliance on this blocking thread pool ,and stick as close as we can to a single thread per core for the engine as a whole.

This is already generally well supported within the Rust ecosystem for network IO via epoll, kqueue, and IOCP, but it does not support file IO, and it's been shown that io_uring and IORing are overall more CPU-time efficient than these options.

## What alternative(s) have you considered?
Sticking to what we have right now. It works just fine.

## Additional context
io_uring may not be compatible with async Rust as it is right now: https://tonbo.io/blog/async-rust-is-not-safe-with-io-uring. More ecosystem-wide support might be required.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.