-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Optimize Openstack Swift files download #18883
Conversation
I see that some tests failed but it doesn't seems that it was caused by patch, for e.g. that one |
How does this optimization work? ;) I don't have a setup with openstack for testing. Out of curiosity: What happens with the patch below?
|
Now it works pretty much the same as for S3. It setup authorization headers and then stream Swift file with fopen. I don't think that patch you quoted will cause any difference since it will still waits for download to complete before returning from readObject function |
What about upload as well? |
The old code should already do streaming downloads from how I understand the openstack sdk/guzzle |
I could experience that it did not. I had to wait for the file to be downloaded fully on the server to be served a download in my browser. |
I didn't touch that yet. But plan is to migrate my installation to Swift and upload also needs to handle large objects. However I already saw that at moment it don't, so I will probably take care of it too
That's correct, It streams already downloaded files, which results in excessive disk space and I/O consumption. On top of that, waiting for multi gigabyte file results in connection timeout which is devastating, because what users do next? Hit the refresh button, and keep in mind that earlier file is still being downloaded ;) |
@kesselb regarding your patch it does not change nature of the issue as file is downloaded few lines of code earlier.
here exacly to be precise - in download(). @icewind1991: unfortunetly the old code calls download() function from php-opencloud library. Just for conveniece I'm pasting it below. I believe that file is downloaded due to calling execute(). It blocks and saves entire file in temp dir.
|
OK ;) I think we should keep the |
Even after successful HEAD request from |
Ok, fair enough, I'm ok with this approach, thanks for the thorough explanation. you should be able to remove the call to Also a line or 2 documentation for |
server/lib/private/Files/ObjectStore/ObjectStoreStorage.php Lines 288 to 302 in 5bf3d1b
A |
For error handling you'll need to check the result from fopen and use $http_response_header to throw the relevant exceptions or return false. |
Since the https://gist.github.com/icewind1991/3f3088c17917c783ceb21d002e966727 |
Thanks @icewind1991 👍 I would also prefer to not add the |
Thank you for your input, pushed second version, I hope that meets your expectations.
Object store url is not the same as in
Since constructing |
Looks good otherwise thanks for the work 👍 |
] | ||
); | ||
|
||
} catch (BadResponseException $e) { | ||
if ($e->getResponse()->getStatusCode() === 404) { |
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.
Please check getResponse
for null.
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.
Thanks 👍 Great contribution 🎉
Ping! 🔔 |
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.
🐘
@adrb could you rebase this on latest master so the full CI can run one more time and then we get it in |
Improves efficiency when downloading files from Swift storage. Before, files were downloaded and then pushed back to user. That behaevior causes all kinds of performance problems. Now, files are streamed directly to user. Signed-off-by: Adrian Brzezinski <[email protected]>
Could you also review changes from #18955? It's complementary to this one |
Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22 |
Thanks @adrb 👍 |
fix #14116
It improves efficiency when downloading files from Swift storage.
Before, files were downloaded and then pushed back to user.
That behaevior causes all kinds of performance problems.
Now, files are streamed directly to user.