-
-
Notifications
You must be signed in to change notification settings - Fork 314
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
SQS: Add support for external back-pressure management #1251
Comments
loicrouchon
added a commit
to loicrouchon/spring-cloud-aws
that referenced
this issue
Dec 20, 2024
loicrouchon
added a commit
to loicrouchon/spring-cloud-aws
that referenced
this issue
Dec 20, 2024
9 tasks
loicrouchon
added a commit
to loicrouchon/spring-cloud-aws
that referenced
this issue
Jan 2, 2025
…BackPressureHandler (awspring#1251)
loicrouchon
added a commit
to loicrouchon/spring-cloud-aws
that referenced
this issue
Jan 7, 2025
…BackPressureHandlers (awspring#1251)
loicrouchon
added a commit
to loicrouchon/spring-cloud-aws
that referenced
this issue
Jan 7, 2025
…BackPressureHandlers (awspring#1251)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Type: Feature
Is your feature request related to a problem? Please describe.
The current SQS listener implementation has options to limit the concurrency within the application, however, it does not support an external data-source informing about downstream services back-pressure.
The use case I have in mind is to stop processing new messages from an upstream queue if a downstream queue reached a certain number of visible messages.
In our use case, several producers are publishing messages to a downstream queue. Some producers are less critical than others and should only publish in messages in the downstream queue at low peak times. For those producers we need to be informed of back-pressure of the downstream queue to decide if we should produce new messages (i.e. consume from the upstream queue).
Another use case would be the one described in #481
Describe the solution you'd like
The solution I'm thinking of would be to implement a hook for reporting downstream services back-pressure into some
BackPressureHandler
/BatchAwareBackPressureHandler
implementation.I would put out of scope the implementation of said hooks (downstream queue number of visible messages, rate limiter, ...) which would be (at least for now) to be implemented by applications.
I can propose to implement such feature, but before doing so, I'd like to discuss the direction.
So far I've seen there's only one implementation of the
BatchAwareBackPressureHandler
: theSemaphoreBackPressureHandler
.My idea is to build something around it (either a wrapper, a sub-class, or evolving the current implementation with more features, we'll see when going in the implementation phase).
The reason for keeping the initial
SemaphoreBackPressureHandler
is that it limits the concurrency within the application, while the downstream back-pressure concept is there to stop processing or reduce processing speed if downstream systems cannot follow.So this new implementation would be a kind of
SemaphoreBackPressureHandler
which would call aBackPressureMeter
inrequest(int)
andrequestBatch()
methods. Depending on the current downstream back-pressure and the configuredmaxBackPressure
it would accordingly increase (up tototalPermits
) or reduce (down to0
) the number of permits on the internal semaphore. It might also be needed to update thedrain(Duration)
method to take the reduced capacity into account.New methods would be required on the
ContainerOptions
interface:#downstreamBackPressureMeter(BackPressureMeter meter)
: specifies how to measure the back-pressure of downstream systems.#maxDownstreamBackPressure(int maxDownstreamBackPressure)
: specifies what is the max back-pressure that can be put on the downstream system.The
BackPressureMeter
interface could look like this.For applications with multiple replicas, the effects would be dependent on how the back-pressure is measured in the provided
BackPressureMeter
implementation. For example:maxDownstreamPressure
accordingly.maxDownstreamBackPressure
. This would result in an actual downstream back-pressure being slightly over the themaxDownstreamBackPressure
, but then theBackPressureMeter
would kick-in and the consumption would be stopped and resumed on the next polling where the downstream back-pressure went down. This would result under load in an oscillation of the actual downstream back-pressure around themaxDownstreamBackPressure
.@tomazfernandes and @maciejwalkowiak, tagging you for feedback as you both participated in #479
Regards,
The text was updated successfully, but these errors were encountered: