Skip to content
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

binder: Invoke onTransportReady() in a round-robin fashion. #8835

Merged
merged 1 commit into from Jan 14, 2022
Merged

binder: Invoke onTransportReady() in a round-robin fashion. #8835

merged 1 commit into from Jan 14, 2022

Conversation

jdcormie
Copy link
Member

Also call onTransportReady() only if isReady() still holds by the time
we get to a given Inbound. This dramatically reduces timeouts and
improves throughput when flow control has kicked in.

This approach is still not completely fair since each ongoing call might
consume a different amount of window on its turn, but because of the way
Outbound#writeMessageData() and BlockPool already work, everyone gets to
send at least 16kb.

Fixes #8834

Also call onTransportReady() only if isReady() still holds by the time
we get to a given Inbound. This dramatically reduces timeouts and
improves throughput when flow control has kicked in.

This approach is still not completely fair since each ongoing call might
consume a different amount of window on its turn, but because of the way
Outbound#writeMessageData() and BlockPool already work, everyone gets to
send at least 16kb.
Copy link
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

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

This may not be the best solution, but it is easy and reliable and better than what we have.

@ejona86
Copy link
Member

ejona86 commented Jan 14, 2022

nit: for changes like this it is helpful if the commit message would have a binder: prefix so the context is obvious.

@jdcormie jdcormie changed the title Invoke onTransportReady() in a round-robin fashion. binder: Invoke onTransportReady() in a round-robin fashion. Jan 14, 2022
@jdcormie
Copy link
Member Author

nit: for changes like this it is helpful if the commit message would have a binder: prefix so the context is obvious.

good point done.

@jdcormie
Copy link
Member Author

This may not be the best solution, but it is easy and reliable and better than what we have.

Yep thanks. The fact that ongoingCalls isn't navigable and can change between ACKs (and even while handleAcknowledgedBytes is running!) makes it tricky to do this using less memory per BinderTransport.

With respect to fairness, in a future PR we could consider sending one 16kb Binder transaction per Outbound in round robin order to achieve completely fair (unweighted) queuing. It's just a more invasive change. Also isn't clear to me where the call to io.grpc.internal.StreamListener#onReady() would fit into this.

@jdcormie jdcormie merged commit 25531d6 into grpc:master Jan 14, 2022
@markb74
Copy link
Contributor

markb74 commented Jan 14, 2022

Nice non-disruptive improvement!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BinderTransport flow control starves unlucky streams
3 participants