-
Notifications
You must be signed in to change notification settings - Fork 445
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
safekeeper: refactor WalAcceptor
to be event-driven
#9462
Conversation
We should run some benchmarks to ensure this doesn't cause a performance regression. I don't expect it will. I'll see if we have any suitable benchmarks already, otherwise I'll add some as part of #9339. |
5300 tests run: 5078 passed, 0 failed, 222 skipped (full report)Flaky tests (5)Postgres 17
Postgres 16
Code coverage* (full report)
* collected from Rust tests only The comment gets automatically updated with the latest test results
e228d08 at 2024-10-28T17:28:16.769Z :recycle: |
Edit: known flake, see https://neondb.slack.com/archives/C059ZC138NR/p1729524890795969. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likely there perf difference won't be noticeable, but it would be curious to check, so there is no good infra to do that quickly.
TFTR! I'm adding some benchmark infra for #9339 anyway. I'll throw together a simple WAL ingest benchmark and try it out on this PR. |
Looks like this comes with a pretty hefty performance penalty. I'll have a look at why. Will submit a PR for the benchmarks in a bit.
|
Ok, so it appears that Submitted tokio-rs/tokio#6940 for this (edit: dupe of tokio-rs/tokio#6866). I'll add a workaround shortly. |
Added a workaround, performance is now basically equivalent.
|
Problem
The
WalAcceptor
main loop currently uses two nested loops to consume inbound messages. This makes it hard to slot in periodic events like metrics collection (e.g. #9328). It also duplicates the event processing code, and assumes all messages in steady state are AppendRequests (other messages types may be dropped if following an AppendRequest).Extracted from #9450.
Summary of changes
Refactor the
WalAcceptor
loop to be event driven.Checklist before requesting a review
Checklist before merging