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

Using the KEDA scaler with Redis Streams: Ideal Usage Question #2044

Closed
nakumgaurav opened this issue Aug 20, 2021 Discussed in #2043 · 1 comment
Closed

Using the KEDA scaler with Redis Streams: Ideal Usage Question #2044

nakumgaurav opened this issue Aug 20, 2021 Discussed in #2043 · 1 comment

Comments

@nakumgaurav
Copy link

nakumgaurav commented Aug 20, 2021

Discussed in #2043

Originally posted by nakumgaurav August 19, 2021
[Continuing the discussion from #746 ]


Problem:
If I have an application adding messages to a stream, they are not delivered to any consumer group until an XREADGROUP is issued over that consumer group. This means that if the Job that KEDA is trying to scale consumes messages, it has to wait for someone to consume messages (!!!) using XREADGROUP so that the messages are moved to the Pending Entries List (PEL) of that group. This leaves Redis Streams pretty much useless with KEDA because if some other application has already fetched the messages, how would I retrieve them in my KEDA application that I am trying to scale?

I guess this is more related to how Redis consumer groups work but if there is a KEDA way of doing things, would love to hear that.

Potential Workaround:
What I ended up doing was:

  1. In the producer application, get a list of all the consumer groups over a given stream using XINFO GROUPS
  2. Use XREADGROUP to deliver messages to all the groups
  3. In the consumer application (the job that KEDA is scaling), obtained the range of ids in the PEL of the desired group - the group over which the KEDA trigger is defined - using XPENDING and read the messages in this range using XRANGE
  4. After processing the messages in the consumer app, acknowledge them using XACK so that they are removed from the PEL of the group and more messages could be received.

I realize this may not be the ideal way to solve the problem, so open to suggestions. Thank you!

@tomkerkhove
Copy link
Member

Let's close in favor of #2043

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

No branches or pull requests

2 participants