-
Notifications
You must be signed in to change notification settings - Fork 196
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
enable a 300sec in memory cache for resource infos when listing shares on the ocs API #4438
Conversation
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
💥 Acceptance test Core-API-Tests-ocis-storage-6 failed. Further test are cancelled... |
…s on the ocs API Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
82b161a
to
29d58b3
Compare
Kudos, SonarCloud Quality Gate passed!
|
Thanks, sounds cool! I would love if your nice explanation in this PR could go to any dev doc to be preserved for the future - it is worth ;-) Any idea where to put it? |
Author: Jörn Friedrich Dreyer <[email protected]> Date: Mon Sep 12 14:05:24 2022 +0000 enable a 300sec in memory cache for resource infos when listing shares on the ocs API (#4438) * enable a 300sec in memory cache for resource infos when listing shares on the ocs API Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * lint Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * disable ocs cache by default Signed-off-by: Jörn Friedrich Dreyer <[email protected]> Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Author: Jörn Friedrich Dreyer <[email protected]> Date: Mon Sep 12 14:05:24 2022 +0000 enable a 300sec in memory cache for resource infos when listing shares on the ocs API (#4438) * enable a 300sec in memory cache for resource infos when listing shares on the ocs API Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * lint Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * disable ocs cache by default Signed-off-by: Jörn Friedrich Dreyer <[email protected]> Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Listing the received shares for a user that has 150 incoming shares currently takes 6-10sec. (that is with the gateway cache enabled by locally reverting cs3org/reva#3167)
While the internal listing of shares is in the 140ms ballpark with cs3org/reva#3148 the ocs api also returns file and path information, requiring a stat and a getpath for every share, adding up to hundreds of internal stat requests.
reva can cache the stat requests with an in memory cache or in redis, dropping the response time for the same user from 8sec to 700ms on my machine. The difference between 140ms and 700ms is spent on GetPath calls that we could get rid of completely by requesting the path in the stat request in the fieldmask. something for another PR.
This PR sets the timeout to 300sec / 5min. I don't know if that is a good initial duration. cbox even has a cache warmup that prefetches the list of shared resources, stats them and caches them for the TTL ... which only really makes sense when the TTL is quite large ... anyway, lets start with this.
I absolutely assume the tests will cry over this ... It did, so I disabled the cache by setting TTL to 0 ... The cache can be enabled by setting
FRONTEND_OCS_RESOURCE_INFO_CACHE_TTL=60
or more ... but this breaks our tests. In any case as is the PR at least allows enabling and configuring the cache.Related: cs3org/reva#2976