neondatabase / neon

Neon: Serverless Postgres. We separated storage and compute to offer autoscaling, code-like database branching, and scale to zero.
https://neon.tech
Apache License 2.0
15.25k stars 445 forks source link

safekeeper: use tokio-epoll-uring for file IO #9741

Open erikgrinaker opened 1 week ago

erikgrinaker commented 1 week ago

Tokio file IO has significant overhead, since each syscall like write needs to spawn a task and perform a thread context switch. This was measured to about 8 µs on my MacBook, which quickly adds up with many small writes.

We should consider using tokio-epoll-uring for file IO instead, to avoid this cost.

This may be mitigated by improved batching instead (#9689), but there may be workloads for which it's still beneficial. It might also help with concurrent writes across timelines, since it would likely reduce pressure on the Tokio scheduler.

erikgrinaker commented 4 days ago

No going to pursue this right now. The compute does sufficient batching of WAL appends that the per-append thread spawning cost is negligible.