Skip to content

Capped cache for cache info in UserMountCache - #25056

Merged
PVince81 merged 1 commit into
masterfrom
fs-usermountcache-capped
Jun 15, 2016
Merged

Capped cache for cache info in UserMountCache#25056
PVince81 merged 1 commit into
masterfrom
fs-usermountcache-capped

Conversation

@PVince81

Copy link
Copy Markdown
Contributor

@owncloud/filesystem

I don't think we can use the capped cache for $mountsForUsers because the logic doesn't allow so. If we did, it would limit the number of users to 512... possibly 512 received shares or so, which isn't good as it could cause unpredictable effects when exceeding that value.
Or the logic needs to be rewritten to be able to re-resolve the "cache miss" values.

@icewind1991 what do you think ?

CC @butonic

@mention-bot

Copy link
Copy Markdown

By analyzing the blame information on this pull request, we identified @icewind1991, @nickvergessen and @LukasReschke to be potential reviewers

@icewind1991

Copy link
Copy Markdown
Contributor

I think using it for mountforUsers should be fine, since it will just re-fetch it from the db

@PVince81

Copy link
Copy Markdown
Contributor Author

@PVince81

Copy link
Copy Markdown
Contributor Author

I mean this one: https://github.com/owncloud/core/blob/master/lib/private/Files/Config/UserMountCache.php#L165 (linking to an invisible row didn't work)

@icewind1991

Copy link
Copy Markdown
Contributor

I don't see how that doesn't work with that

@butonic

butonic commented Jun 10, 2016

Copy link
Copy Markdown
Contributor

@PVince81 well ... the code you linked to in line 165 does what @icewind1991 says. It fetches the mounts from the db if they are not in the user cache. The CappedMemoryCache implements \ArrayAccess so treating it like an array works as expected. Time for the weekend?

@butonic

butonic commented Jun 10, 2016

Copy link
Copy Markdown
Contributor

oh ... thats a 👍 by me

@PVince81

Copy link
Copy Markdown
Contributor Author

Hmmm right... seems I didn't parse the ! 🙈

I'll adjust to PR to also cap the other one.

@PVince81
PVince81 force-pushed the fs-usermountcache-capped branch from b50be5e to 58a05da Compare June 10, 2016 13:28
@guruz

guruz commented Jun 10, 2016

Copy link
Copy Markdown
Contributor

I guess it's 👍
Not sure if cacheInfoCache should be lazy-constructed or not.

@PVince81

Copy link
Copy Markdown
Contributor Author

Okay, both are capped now.

Let's do a bit of regression testing...

@PVince81

Copy link
Copy Markdown
Contributor Author

Did some quick tests with received shares and they still worked fine.

@butonic

butonic commented Jun 10, 2016

Copy link
Copy Markdown
Contributor

👍 for cacheInfoCache as well

Since the default number of entries in the cappedmemorycache is 512 and it will just remove the first key (FIFO) a performance comparison for 1000 or 10000 would be interesting. Then again, only if there are cod paths that would cause iterating over all of the mounts or files (currently I am only aware of files:scan commands but who knows).

$this->userManager = $userManager;
$this->logger = $logger;
$this->cacheInfoCache = new CappedMemoryCache();
$this->mountsForUsers = new CappedMemoryCache();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you adjust the doc blocks and remove the default values of the members?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@PVince81
PVince81 force-pushed the fs-usermountcache-capped branch from 58a05da to 46cc720 Compare June 13, 2016 10:18

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot use OCP\ICache as ICache because the name is already in use in /var/lib/jenkins/jenkins-slave/workspace/core-ci-linux-php5.4/database/sqlite/label/SLAVE/lib/private/Files/Config/UserMountCache.php

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@PVince81
PVince81 force-pushed the fs-usermountcache-capped branch from 46cc720 to 86d7241 Compare June 13, 2016 13:09
@PVince81
PVince81 merged commit 5de6432 into master Jun 15, 2016
@PVince81
PVince81 deleted the fs-usermountcache-capped branch June 15, 2016 11:01
@PVince81

Copy link
Copy Markdown
Contributor Author

stable9: #25118

@lock

lock Bot commented Aug 5, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants