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
14.84k stars 433 forks source link

tokio-epoll-uring: use thread_local crate for better per-system metrics aggregation #9480

Closed yliang412 closed 8 hours ago

yliang412 commented 3 days ago

When we want to gather per-system metrics for tokio-epoll-uring, a good design would be let each system tracks it's own metrics separately, and only go through each thread local system to aggregate the result when we wish to collect the metrics.

Compared to the implementation in https://github.com/neondatabase/tokio-epoll-uring/pull/56, this removes the need for locking.

Since the Rust standard library does not provide a good functionality for iterating through thread local variables, the implementation would need to refactor the tokio-epoll-uring thread local system to use https://docs.rs/thread_local/latest/thread_local/ and use the its iterator to collect thread local metrics.

yliang412 commented 8 hours ago

Decided this as not acceptable. See https://github.com/neondatabase/neon/pull/9482#alternative-design-considered