Skip to content

Put nodes from Directory->getChildren in the ObjectTree cache#21401

Merged
DeepDiver1975 merged 1 commit into
masterfrom
dav-cache-getchildren
Jan 25, 2016
Merged

Put nodes from Directory->getChildren in the ObjectTree cache#21401
DeepDiver1975 merged 1 commit into
masterfrom
dav-cache-getchildren

Conversation

@icewind1991

Copy link
Copy Markdown
Contributor

Saves us from having to generate the node again later in getNodeForPath for a significant performance improvement when working with large folders

Also note that creating the node in getChildren is cheaper than in getNodeForPath since in the former we already have the fileinfo

comparison

cc @DeepDiver1975 @rullzer

@icewind1991 icewind1991 added this to the 9.0-current milestone Dec 30, 2015
@mention-bot

Copy link
Copy Markdown

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

@DeepDiver1975

Copy link
Copy Markdown
Member

Afaik. Nodes are already cached within the sabre code ... Will have a closer look.

@PVince81

PVince81 commented Jan 7, 2016

Copy link
Copy Markdown
Contributor

Yes, Sabre already cached objects when calling getNodeForPath: https://github.com/owncloud/3rdparty/blob/master/sabre/dav/lib/DAV/Tree.php#L80

@icewind1991 did you identify code paths where it's not the case ?
Also note that Sabre 3.1 has a fix where caching wasn't always done properly: https://github.com/fruux/sabre-dav/pull/729 which @rullzer fixed

@rullzer

rullzer commented Jan 7, 2016

Copy link
Copy Markdown
Contributor

@PVince81 I think that patch is also in the 3.0 branch. So we should see effect already.

@icewind1991 can you desribe the scenario where you don't hit the cache... seems better to fix upstream.

@icewind1991

Copy link
Copy Markdown
Contributor Author

While handling a depth=1 propfind we end up doing a getChildren on the folder node to load all the fileinfo, later sabredav iterates trough the children using the ObjectTree.

The ObjectTree does proper caching but the result from Node->getChildren is not put into the cache.

@rullzer

rullzer commented Jan 7, 2016

Copy link
Copy Markdown
Contributor

Ah! now I get it. It is because we get the nodes ourself instead of letting sabre handle it all...

@rullzer

rullzer commented Jan 7, 2016

Copy link
Copy Markdown
Contributor

It feels like we duplicate a bit to much of the code from sabre in general in the object tree..
But this indeed makes the caching work.

👍

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.

@evert would it maybe make sense to get this upstream into sabre? Might also be usefull for other projects that extend the Tree

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Might also be usefull for other projects that extend the Tree

in an ideal world we should not extend the tree ....

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don't think this is possible in sabre/dav, because the standard node does not know it's own path. Furthermore, Nodes are not aware of the Tree. I would not want this circular dependency.

If you call Tree::getChildren() the result does get cached though.

@DeepDiver1975

Copy link
Copy Markdown
Member

The ObjectTree does proper caching but the result from Node->getChildren is not put into the cache.

so we better iterate using the object tree instead of calling node->getchildren ?

@rullzer

rullzer commented Jan 17, 2016

Copy link
Copy Markdown
Contributor

so we better iterate using the object tree instead of calling node->getchildren ?

Yes, that would make things cleaner I think.
But I think getting this is for now is a good performance improvement before we start refactoring all of our webdav stuff ;)

@LukasReschke

Copy link
Copy Markdown
Contributor

👍

DeepDiver1975 added a commit that referenced this pull request Jan 25, 2016
Put nodes from Directory->getChildren in the ObjectTree cache
@DeepDiver1975 DeepDiver1975 merged commit 9d36972 into master Jan 25, 2016
@DeepDiver1975 DeepDiver1975 deleted the dav-cache-getchildren branch January 25, 2016 09:02
@PVince81 PVince81 mentioned this pull request Sep 1, 2017
9 tasks
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 8, 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.

7 participants