Skip to content
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

Merged
merged 3 commits into from
Sep 12, 2022

Conversation

butonic
Copy link
Member

@butonic butonic commented Aug 23, 2022

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

@update-docs
Copy link

update-docs bot commented Aug 23, 2022

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.

@butonic butonic self-assigned this Aug 23, 2022
@ownclouders
Copy link
Contributor

ownclouders commented Aug 23, 2022

💥 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]>
@butonic butonic force-pushed the ocs-resource-cache-config branch from 82b161a to 29d58b3 Compare September 8, 2022 18:57
@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 8, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@butonic butonic requested review from micbar and aduffeck September 8, 2022 19:35
@dragotin
Copy link
Contributor

dragotin commented Sep 9, 2022

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?

@butonic butonic merged commit b0fa917 into master Sep 12, 2022
@delete-merged-branch delete-merged-branch bot deleted the ocs-resource-cache-config branch September 12, 2022 14:05
ownclouders pushed a commit that referenced this pull request Sep 12, 2022
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]>
ownclouders pushed a commit that referenced this pull request Sep 13, 2022
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants