-
Notifications
You must be signed in to change notification settings - Fork 39
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
perf(rpc): io_uring integration & redesign #477
Open
InKryption
wants to merge
21
commits into
main
Choose a base branch
from
ink/rpc-server-optimize
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,808
−567
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
InKryption
force-pushed
the
ink/rpc-server-optimize
branch
6 times, most recently
from
January 14, 2025 20:36
4f8ccba
to
6b56293
Compare
InKryption
force-pushed
the
ink/rpc-server-optimize
branch
6 times, most recently
from
January 20, 2025 19:09
9f42c0c
to
22c4f6d
Compare
InKryption
changed the title
perf(rpc): io_uring WIP
perf(rpc): io_uring integration & redesign
Jan 20, 2025
InKryption
force-pushed
the
ink/rpc-server-optimize
branch
from
January 20, 2025 19:25
72c0b7f
to
945988d
Compare
InKryption
force-pushed
the
ink/rpc-server-optimize
branch
2 times, most recently
from
January 23, 2025 05:24
922a7bb
to
8fdab03
Compare
InKryption
force-pushed
the
ink/rpc-server-optimize
branch
7 times, most recently
from
January 24, 2025 21:37
6195797
to
ecfe590
Compare
* Handle potentially failing/cancelling of `accept_multishot` by re-queueing it, based on the `IORING_CQE_F_MORE` flag. * Revise/simplify the queueing logic for the `accept_multishot` SQE. * Resolve the EINTR TODO panics, returning a catch-all error value indicating it as a bad but non-critical error. * Update the `a: ?noreturn` `if (a) |*b|` TODO, adding that it's solved in 0.14; it should be resolved after we update to 0.14. * Unify EAGAIN panic message.
On MacOS, on basic WorkPool, this means we now need to manually set the accepted socket's flags to the right things, ie, blocking, as opposed to the server socket's nonblocking mode. Means we also have to handle EAGAIN a bit differently in the io_uring backend, but that's a fine tradeoff.
And re-organize some methods based on that change
Do not exit for *any* errors that are specific to the related connection, simply free them and continue to the next CQE. Specifically in the case of `error.SubmissionQueueFull`, instead of immediately failing, we instead first try to flush the submission queue and then try again to submit; if it fails a second time, that means despite flushing the submission queue, it somehow still failed, so we panic, since this indicates something is *very* wrong. This also eliminates the `pending_cqes_buf`, since there is actually no situation in which `consumeOurCqe` returns an error, and we resume work afterwards - either we process all the received CQEs, or we hard exit - this was already essentially the case before, now it's more obvious. For the main submit, we now wait for at least 1 connection, but we also add a timeout SQE to make it terminate if we don't receive a connection or completion of another task for 1 second; this alleviates the busy loop that was running before.
Also slightly refactor error sets. Now instead of checking to see if we need to set a flag to re-queue the multishot accept, we just pass in the server context on init and queue it, which now makes sense since the context and workpool are separate.
InKryption
force-pushed
the
ink/rpc-server-optimize
branch
from
February 4, 2025 17:45
1f6c7bc
to
2ee76dc
Compare
Also add fix for rebase
InKryption
force-pushed
the
ink/rpc-server-optimize
branch
from
February 4, 2025 17:57
2ee76dc
to
85136f9
Compare
0xNineteen
reviewed
Feb 4, 2025
0xNineteen
reviewed
Feb 4, 2025
0xNineteen
reviewed
Feb 4, 2025
0xNineteen
reviewed
Feb 4, 2025
InKryption
force-pushed
the
ink/rpc-server-optimize
branch
from
February 5, 2025 22:02
706f136
to
eb95eb0
Compare
InKryption
force-pushed
the
ink/rpc-server-optimize
branch
from
February 5, 2025 22:06
eb95eb0
to
1e042dd
Compare
0xNineteen
previously approved these changes
Feb 6, 2025
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.
nice
* Move more specific functions to the only files they're used. * Move the `serve*` functions outside of `Context`, making them free functions which just accept the context and work pool. * Remove `acceptAndServeConnection`; originally this was required to be able to nicely structure the unit test, and used to be more integrated, however it no longer makes sense as a concept. * Inline `handleRequest` into the basic backend. * Make the `acceptHandled` function, moved into the basic backend, guarantee the specified `sync` behavior, and inline `have_accept4`. * Appropriately re-export the relevant parts of the server API. * Added top level doc comments.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
first_error
error handling if practicalfollow up work (not part of this pr): #517