tokio-rs / io-uring

The `io_uring` library for Rust
Apache License 2.0
1.19k stars 131 forks source link

Add safer abstractions for buffer rings #256

Closed SUPERCILEX closed 4 months ago

SUPERCILEX commented 9 months ago

See https://github.com/tokio-rs/tokio-uring/issues/112#issuecomment-1903356303

I'm leaving this in the draft state until I've fully built out my server and fuzzed it while using this API to battle test it.

SUPERCILEX commented 6 months ago

Ok, I've been running this for a while and I'm pretty confident it works at this point. I also expanded the API to support back pressure by carrying the buffer token through several io_uring steps before releasing it back to the kernel (that way if a client spams requests, it'll run out of buffers and need to wait until the server is ready to accept more).

I'm not really happy with the API, but I do think it gets the job done. Thoughts on it? I can add docs if we're going forward with it.

Also in case anyone's interested, here's how I'm using this: https://github.com/SUPERCILEX/clipboard-history/blob/418b2612f8e62693e42057029df78f6fbf49de3e/server/src/reactor.rs#L248

SUPERCILEX commented 4 months ago

Closing as I'm probably the only one using this. The canonical implementation now lives in https://github.com/SUPERCILEX/clipboard-history/blob/9662f08b43502feafceec0c694237498bc7ea127/server/src/io_uring.rs#L167