-
Notifications
You must be signed in to change notification settings - Fork 184
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
improve redis cache #5137
Comments
In general, listing should be avoided in any type of cache. If we still have to implement listing in redis, |
Not sure if it helps in this case but it is possible to manually build a index using redis sets. (SADD/SINTER) https://redis.io/commands/sadd/ |
I'd rather not using SINTER.
|
Added the section "Cache backend availability" |
I created an upstream PR to allow using List with prefix and suffix so we can implement cache invalidation a little more efficiently: micro/plugins#97 |
@butonic do you have an overview about missing improvements of the redis cache? Can we close this issue? |
Not sure if this is related but if the system is already a bit busy and I upload images through the webUI I often get 500 errors when it tries to generate the previews.
log
|
Closing because this ticket does not reflect the current state. All / most issues should be resolved. |
Cache backend availability
current state
If the cache backend is not available (eg. Redis down / away /...), oCIS will respond with HTTP status 500 to a lot of requests (generally requests that want to query / write to the cache).
-> cache backend unavailable = dead oCIS
proposed state
This cache is kind of optional, because we could still answer requests if the cache backend is not responsive. Downside is that requests would take longer and there is a risk of producing high load (that the system can't bear). But the cache would no longer need to promise a 99,9999..% availability.
-> cache backend unavailable = slow oCIS
List operation
we should only list from a database (https://github.com/cs3org/reva/blob/11cc78add8ba06a70c0515aa762f07d1ebd65ab7/pkg/storage/cache/cache.go#L197-L200, https://github.com/go-micro/plugins/blob/c91295de81c390c8152776186c4f6747da9f2bbc/v4/store/redis/redis.go#L123-L126) because
KEYS *
is too expensiveThe list operation also needs to remove the database prefix it adds during Write https://github.com/go-micro/plugins/blob/c91295de81c390c8152776186c4f6747da9f2bbc/v4/store/redis/redis.go#L111, making the workaround cs3org/reva#3338 uneeded.
Misc
From my POV it would be nice to separate the table name from the key name by eg using
:
. This would lead to some more readable redis keys likemytable:some-item1
REVA
using
KEYS *
(see above) orKEYS table*
triggered by https://github.com/cs3org/reva/blob/edge/pkg/storage/cache/stat.go#L53 is too expensive in Redis.We should transfer the string.Contains logic https://github.com/cs3org/reva/blob/11cc78add8ba06a70c0515aa762f07d1ebd65ab7/pkg/storage/cache/stat.go#L59-L72 into intelligent redis
KEYS
queries. Redis supports patterns https://redis.io/commands/keys/Originally posted by @wkloucek in #4794 (comment)
The text was updated successfully, but these errors were encountered: