-
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
Support to Redis event source? #240
Comments
Great question. I think the trick with Redis for me has always been what "metric" we can pull from redis to know if there is work to be done, and how much work is done. What I've read in the past from Redis docs is that if you don't have an active client listening for events, an event is sent but lost. Since KEDA uses a polling interval to check for messages, I suspect it means that unless the event happened to be sent while KEDA was checking, KEDA would have no idea about the work to be done and couldn't publish accurate metrics. I'm not sure on this though. I'd love to see a Redis scaler but we'd need a way to know:
|
In my use case, I would like to be monitoring the size of a queue (internally implemented as a list in Redis), so I guess the simplest implementation would creating a custom metrics (most likely using custom metrics ) that returns the length of the specified key or a range of keys. |
Yeah that one would work I think. Do you remove the item from the list after processing? So that the length of the list could always == the amount of unprocessed work? |
@cristianoveiga would using LLEN for a list for our Redis scaler do the trick? |
Correct @jeffhollan @yaron2 ! The length of the list (s) would give me metric of how much work I have pending. Please note that Redis has other data types/structures, but this could be a good start. |
Good :) |
Yes scoping to that is very do-able. Not sure if you want to take a pass at it. I flagged it as help wanted and will update the wiki, but assuming you just did pretty much exactly what the rabbitMq and azure queue scalers are doing, but instead of lenght of queue it's length of list you'd have what you wanted |
awesome, thanks! I'm trying to understand the whole custom metrics workflow. If I manage to get it sorted, I would be glad to help send a PR. I will keep you posted. |
@jeffhollan I'm happy to help with this one |
@jeffhollan @yaron2 I've created a pull request for this. Could you verify? |
@jeffhollan @yaron2 @cristianoveiga this has now been merged into master. Can this issue be closed? |
Awesome work @patnaikshekhar! Thanks a ton for the contribution 🎉. @asavaritayal can you help just to track work to make sure
Once that's in I think it's officially now a supported KEDA trigger. |
This is great! Thanks @patnaikshekhar ! I will take some time this week to try it out. |
btw, make sure to use |
Anything left open for this one? It's merged and documented to scale on Redis Lists AFAIK |
Anything left open for this one? It's merged and documented to scale on Redis Lists AFAIK |
Hi @tomkerkhove @patnaikshekhar , I was trying to get this working on my cluster, but I am getting an error:
Any ideas about what can be causing this issue? Thanks, Cristiano |
Tried to run the redis autoscaler against a Redis cloud service in IBM cloud with TLS but looks like TLS not supported in the current Redis autoscaler, can try to submit a PR for it.. any idea if someone working on it already? |
That is correct, we don't support this AFAIK. We are more than happy to accept PRs and I'm not aware of anybody working on it. Thanks! |
I am wondering if adding TLSConfig to ClusterOptions/redis.Options might do it. I am thinking something like this as the simplest solution:
Reference: |
@inuyasha82 is working on adding TLS... |
@fktkrt i'm trying to do exactly that! :) stay tuned... |
Hi guys, i submitted PR #540 it is in wip state btw, because there is an odd behaviour, apparently when it connects to an SSL queue, it can read the listlength, and create the pod if is scaled down to 0, but for some reason is not scaling to more than one pod even if i add 100 items to the list, so maybe i need to add changes somewhere else, or maybe is just a problem of my local env, but i will appreciate anyone that can help! :) |
This sounds like kedacore/keda-docs#64 If I remember it correctly, but adding @jeffhollan, it might be because you are using Minikube - Is that possible? |
@tomkerkhove i don't know, the thing is that using the changes in PR #540 when using a normal redis queue looks it is scaling correctly to more than 1. When i connect to the tls queue, it scale up, but to no more than one pod. So the normal queue is deployed in the Minikube environment using helm. |
Question is, where is KEDA running? On Minikube? |
yes on MIinkube. |
Then it works as intended, mini kube has a limitation which causes it not to scale beyond 1 |
@tomkerkhove today i tried the implementation in a kubernetes cluster, that is not minukube and i'm seeing the same behaviour. I took couple of screenshots of the logging (for the non redis-one ignore the pods error, but you can see that the deployments was correctly scaling up (it arrived to 6 even if not evident from the screenshot). Using Redis non ssl: As you can see from the delpoyments/pods sections (the 2 on the right) when using tls it doesn't scale up to more than 1, while on the other hand using the normal queue it is working. BTw i'm printing the list length every time the function getRedisListLength is called, and it is always returning an accurate number (check the bottom left section) in both cases. So i can't figure out what is the problem, since apparently getRedisListLength is returning the correct number every single time. Maybe do i need to update somewhere else? Someone has an idea of what could be the reason? |
@inuyasha82 whats the output of the hpa? |
So this is the output when i use a redis with TLS: Instead if i'm connecting to a non tls queue i can see some values: When using the TLS queue apparently is not getting any metrics information, so tried to describe the hpa this is the output: It looks like that it can't extract any metric from the hpa on the TLS queue. There is one difference between the twho redis server, usually the non tls one is deployed in the same kubernetes cluster, while the TLS redis queue i'm using is a service deployed on the cloud (so not in the same cluster), could that be the reason why it doesn't scale up? |
@inuyasha82 you have set your minpod to 1. Perhaps that's the reason why you have 1 pod running. Although from your previous log, i can see the return value of Would you be able to print some logs in the Maybe it is failing and end up in this block of code in
Im just guessing. 😁 |
@balchua i'll give it a try, btw consider that the setup used for both tls and non tls is identical, the only difference is the host and password (And the new parameter i added to enableTLS) |
Are you using metrics-server?
|
Started to look at this with @inuyasha82 - realised missed to deploy the locally built Hence should update the documentation in the README with something like this:
Will send a pull request for that. Retesting to see if this fixes the problem. |
Thanks for sending the PR! |
So @tomkerkhove @fktkrt @balchua so tested again using the keda-metrics-adatper from the custom build, and now it is correctly scaling up and down. So the problem was that it was using the keda-metrics-adapter from master and my keda operator from the custom tag. So as @marchmallow suggested could be a good idea to add this in the README. So i think that the PR #540 can be reviewed now. |
I presume we can close this one once the docs are there for new TLS changes? |
I think this can be closed indeed. @inuyasha82 also submitted a PR to add an option for choosing which redis DB to use. It seems pretty feature complete now. Looking forward to get keda into our production environment. |
Hi,
I noticed that Redis is currently not supported and also is not present on the planned scalers.
Have you considered some sort of integration?
The text was updated successfully, but these errors were encountered: