-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Skip unnecessary cache updates #18753
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
Skip unnecessary cache updates #18753
Conversation
this way unnecessary updates can be skipped
the folder size will not change when changing the file mtime
|
I would prefer to have a seperate update method for only changing mtimes instead of adding a parameter |
|
then we should have: so you could call one or the other or both. Need to make sure if called both that |
lib/private/connector/sabre/file.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when doing a chunked upload $this->path and $targetPath are not the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry that change had to go into put() and not into createFileChunked()
should be fixed now
|
cc @PVince81 |
|
A new inspection was created. |
|
I have done some more serious tests. Running 4 user sessions, every uploading 10 folders with 10 small files (4byte) in it. After the upload the test runs PROFIND and downloads all the files again. I have compared:
And that is what I got after running the test 3 times and calculating the means: |
|
👍 |
|
@karlitschek can we put this to 8.2 milestone? |
|
@DeepDiver1975 @PVince81 @schiesbn opinions? |
|
Need to take some time to test whether syncing still works, and also with SMB which doesn't support touch. |
|
By the way, @individual-it there are actually two code paths for file uploads. Not sure if that part needs to be adjusted too ? |
|
In the case of a chunked file the OC\Files\Cache\Updater::update() is called by store(): https://github.com/owncloud/core/blob/master/lib/private/connector/sabre/file.php#L350 stack: I guess it make sense to update the parent folder size after every chunk got uploaded. We could theoretically skip the last update when HTTP_X_OC_MTIME is set and a "touch" has to be run. But on big files the performance improvement will not be huge. It really matters only on a big number of small files where you can save some DB requests for every upload. btw. your pyoclient is a great tool to debug. |
I don't think it is supposed to do that. The chunks are uploaded into the "cache" folder, not the final folder, so there is nothing to update there. I guess it just does nothing then. |
|
There must be another later call to update() from within file_assemble |
|
last call I can see in the debugger is by rename() |
Doesn't this mean that we now iterate twice over the file tree if we need to update mtime and size while before it was done in one run? Doesn't sound like a good idea just to improve the touch, in most cases we will probably have to update both. Or do I miss something? |
|
that's why there is the $skipPropagatingChanges switch. |
|
superseded by #19494 |

OC\Files\Cache\Updater::updatedoes a couple of updates. Not all are needed in every case the method is called.In this example if
touch()only is changing the mtime we should skip the update of the folder size as that would not change.In a short test this fix saves around 7-8% time when uploading small files. #7072