-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Adding Lag-dependent implementation of Redis streams scaler #4592
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikelam-us can you please address these comments I've left on your PR?
tests/scalers/redis/redis_sentinel_streams_lag/redis_sentinel_streams_lag_test.go
Outdated
Show resolved
Hide resolved
.../redis/redis_sentinel_streams_pending_entries/redis_sentinel_streams_pending_entries_test.go
Outdated
Show resolved
Hide resolved
...rs/redis/redis_cluster_streams_pending_entries/redis_cluster_streams_pending_entries_test.go
Outdated
Show resolved
Hide resolved
tests/scalers/redis/redis_sentinel_streams_lag/redis_sentinel_streams_lag_test.go
Outdated
Show resolved
Hide resolved
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
…renamed test files Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
/run-e2e redis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. I left one comment inline
BTW, the standalone e2e test case is still pending 🙏
tests/scalers/redis/redis_cluster_streams_lag/redis_cluster_streams_lag_test.go
Outdated
Show resolved
Hide resolved
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Hello all! I've addressed all the previous comments, so it would be great if you all could take another look just to make sure I'm not missing anything! Thanks in advance! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests/scalers/redis/redis_cluster_streams_lag/redis_cluster_streams_lag_test.go
Outdated
Show resolved
Hide resolved
tests/scalers/redis/redis_sentinel_streams_lag/redis_sentinel_streams_lag_test.go
Outdated
Show resolved
Hide resolved
/e2e-test redis |
Signed-off-by: mikelam-us <[email protected]>
Signed-off-by: mikelam-us <[email protected]>
Jorge, thank you so much for your comments on the e2e tests. While we were working on implementing these tests, we caught some interesting behavior with Redis. The initial consumer Deployment isn’t able to register its consumerGroup because by the time it is ready or otherwise, the producer Job hasn’t created the stream as it is not deployed by then. Now, since there is no lagCount, the consumer Deployment is scaled down to 0. We need the XLEN for the stream in order for our system to start (scale-up from zero) the consumer Deployments. We are dependent on the XLEN for start-up. |
Signed-off-by: Jorge Turrado Ferrero <[email protected]>
/run-e2e redis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, only 1 small change in the key name and that's all here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks a lot for the feature ❤️
/run-e2e redis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
thanks for the contribution!
…#4592) Signed-off-by: mikelam-us <[email protected]> Signed-off-by: mikelam-us <[email protected]> Signed-off-by: Jorge Turrado Ferrero <[email protected]> Co-authored-by: mikelam-us <[email protected]> Co-authored-by: Jorge Turrado Ferrero <[email protected]>
Provide a description of what has been changed
Checklist
This is a PR for a Redis scaler implementation based optionally on the lag count of a given consumer group. Previously, the scaler operated based either on the number of pending entries (as returned by XPENDING) or the stream length (as returned by XLEN), neither of which accurately reflect how the job should actually be scaled. The lag-based implementation should remedy this since consumer group lag much more accurately reflects how the job should be scaled. The implementation is backwards compatible with all other parts of keda, though it should be noted that Redis 7.0.0+ is required as XINFO lag, the Redis command on which this implementation depends, is absent in earlier versions.
All lag-specific unit tests have been added to redis_scaler_test.go. End-to-end tests are in redis_sentinel_streams_lag_test.go and redis_cluster_streams_lag_test.go.
Related issues: #4277, #3127