-
Notifications
You must be signed in to change notification settings - Fork 2.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
Cache: support redis cache backend #4888
Conversation
dace033
to
64fedeb
Compare
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.
I haven't checked the code yet but have you seen the implementation on Cortex side https://github.com/cortexproject/cortex/blob/34bb142b129bd781539001fb1629cf2f3ed54b82/pkg/chunk/cache/redis_cache.go? Maybe there is an opportunity to share some code here?
Thank you your review, I see the redis code in cortex not have a expire ttl in store function,it use a fixed ttl. so it can not reuse for our interface https://github.com/thanos-io/thanos/blob/main/pkg/cache/cache.go#L16. the redis support code is not very complex,i think write it again is seems not matter. (: |
0887806
to
c6dccaa
Compare
I found the redis client invoke mget has too many keys. let me implement split it to batch. |
1eddee6
to
801384f
Compare
🚀 Ready to review. I am also deploymented it to production to continuing verify. it works well than memcached in my scene(no i/o timeout, no mem leak). |
Signed-off-by: Jimmie Han <hanjinming@outlook.com>
make linter happy Signed-off-by: Jimmie Han <hanjinming@outlook.com>
Signed-off-by: Jimmie Han <hanjinming@outlook.com>
Signed-off-by: Jimmie Han <hanjinming@outlook.com>
Signed-off-by: Jimmie Han <hanjinming@outlook.com>
Signed-off-by: Jimmie Han <hanjinming@outlook.com>
0a590f7
to
f0a9278
Compare
Signed-off-by: Jimmie Han <hanjinming@outlook.com>
f0a9278
to
3b8f154
Compare
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.
Great job! Just comment to fix, but not a blocker, we can fix later. LGTM! 💪🏽
Retried e2e test, let's see if that's a flakiness. |
Thank you🚀, I will fix it later. |
} | ||
duration := promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{ | ||
Name: "thanos_redis_operation_duration_seconds", | ||
Help: "Duration of operations against memcached.", |
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.
Typo: should be Duration of operations against 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.
let me fix it.
* Cache: support redis cache backend Signed-off-by: Jimmie Han <hanjinming@outlook.com> * Cache: add get gate make linter happy Signed-off-by: Jimmie Han <hanjinming@outlook.com> * add concurrent config control Signed-off-by: Jimmie Han <hanjinming@outlook.com> * add redis cache doc Signed-off-by: Jimmie Han <hanjinming@outlook.com> * use doWithBatch to optmize concurrent batch code. Signed-off-by: Jimmie Han <hanjinming@outlook.com> * support db select Signed-off-by: Jimmie Han <hanjinming@outlook.com> * fix query-frontend cache config Signed-off-by: Jimmie Han <hanjinming@outlook.com>
* Cache: support redis cache backend Signed-off-by: Jimmie Han <hanjinming@outlook.com> * Cache: add get gate make linter happy Signed-off-by: Jimmie Han <hanjinming@outlook.com> * add concurrent config control Signed-off-by: Jimmie Han <hanjinming@outlook.com> * add redis cache doc Signed-off-by: Jimmie Han <hanjinming@outlook.com> * use doWithBatch to optmize concurrent batch code. Signed-off-by: Jimmie Han <hanjinming@outlook.com> * support db select Signed-off-by: Jimmie Han <hanjinming@outlook.com> * fix query-frontend cache config Signed-off-by: Jimmie Han <hanjinming@outlook.com> Signed-off-by: wenmaoba <wenmaoba@tencent.com>
Love to see this, do you have a performance comparison with / without this to see if its better ? @hanjm specially the comparison you did vs "memcached in my scene(no i/o timeout, no mem leak)." , would be great if you have some numbers :) |
Hello, |
Hi, I am attempt to add redis cache support, like cortex does.
First. i will make it a draft PR.
Signed-off-by: Jimmie Han hanjinming@outlook.com
Changes
Verification