Skip to content

Conversation

camshaft
Copy link
Contributor

@camshaft camshaft commented Apr 15, 2025

Description of changes:

This change optimizes the stream RPC implementation where the client only "actively" polls the response to decide when to return. This is based on the assumption that if the server is able to send the entire response then it received the request, even if the local request state hasn't completely finished for whatever reason.

Testing:

The existing RPC tests show that this maintains all of the expected behavior.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@camshaft camshaft marked this pull request as ready for review April 15, 2025 18:33
Copy link
Collaborator

@Mark-Simulacrum Mark-Simulacrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know what causes the spurious(?) wakes?

// Poll the `writer` as long as it hasn't completed or the `reader` is still being polled
if !writer_finished {
writer_finished = writer.as_mut().poll(cx)?.is_ready();
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we worried about not clearing a socket readiness state that causes e.g. level-triggered notifications to keep firing? I think that's not an issue with mio on Linux, but not sure if we'd run into trouble on (say) Windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I follow the question. If the reader finishes before the writer does, then it'll trigger the reader's drop implementation, which should notify the background task that the application has detached and it will drive it to completion.

Co-authored-by: Mark Rousskov <thismark@amazon.com>
@camshaft camshaft merged commit ae715eb into main Apr 15, 2025
126 checks passed
@camshaft camshaft deleted the camshaft/dc-rpc-opt branch April 15, 2025 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants