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

Consider implementing publish flow control #27

Open
hannahrogers-google opened this issue May 6, 2020 · 3 comments
Open

Consider implementing publish flow control #27

hannahrogers-google opened this issue May 6, 2020 · 3 comments
Labels
api: pubsublite Issues related to the googleapis/java-pubsublite API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@hannahrogers-google
Copy link
Contributor

When a streaming connection to the pub/sub lite service is started, an InitialRequest is sent to establish the stream. Typically, we wait until an initial response is received before the stream enters the "running" state.

However, if the InitialRequest fails due to a retryable error, the connection is retried and the stream enters the "running" state before an initial response has been received.

@dpcollins-google
Copy link
Collaborator

This is WAI from my perspective. The stall before the InitialResponse could be removed entirely for parity if you'd like, but because the client library automatically manages retries of retryable errors in the ready state without user intervention, there's nothing inherently wrong with being in the ready state and having received retryable errors.

Has this caused confusing behavior in any way? This can be changed, but I don't necessarily see the motivation or the end state that would be better.

@dpcollins-google
Copy link
Collaborator

After offline discussion:

The underlying issue is that the stream will retry forever, buffering a potentially unbounded backlog of user messages that are being retried while the backend serves UNAVAILABLE continuously. Unlike Pub/Sub, a subset of publishes cannot be failed without losing ordering, so the alternative would be to fail the client if that backlog gets too high.

In the short term, this will be 'resolved' by making it the user's responsibility. The user can easily track the number of outstanding publishes using the returned futures, and can take action if that number grows too large.

If there is an expressed desire for a publish flow control mechanism, we can investigate implementing that in the client in the future, but this mechanism would have to fail the client once it was reached to maintain order.

@dpcollins-google dpcollins-google changed the title StreamingConnections start running on InitialRequest failure Client publishes outstanding are unbounded when the stream retries UNAVAILABLE or other retryable errors. May 7, 2020
@dpcollins-google dpcollins-google added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label May 11, 2020
@meredithslota meredithslota added the api: pubsublite Issues related to the googleapis/java-pubsublite API. label Jun 15, 2020
@dpcollins-google dpcollins-google changed the title Client publishes outstanding are unbounded when the stream retries UNAVAILABLE or other retryable errors. Consider implementing publish flow control Jul 29, 2021
@dpcollins-google dpcollins-google added the priority: p3 Desirable enhancement or fix. May not be included in next release. label Jul 29, 2021
@hannahrogers-google hannahrogers-google removed their assignment Aug 13, 2021
@johnboy14
Copy link

johnboy14 commented Oct 26, 2022

Is it no possible to block the user or atleast allow the user to configure blocking like they do with the pubsub flow control mechanisms today? I'm having an issue where a high rate of messages just fills up the ArrayDeque and the app throws an OOM. I can count outstanding futures but I'd prefer the api to tell me to slow down or force me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsublite Issues related to the googleapis/java-pubsublite API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

4 participants