-
Notifications
You must be signed in to change notification settings - Fork 2.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
[Ext storage] Now using SFTP stream wrapper from phpseclib #5954
Conversation
I've tried before and after this fix: I've looked at the phpseclib code and it seems to be due to the fact that it's possible to tell it to only read the first X bytes of a file. Uploading seemed to be better though. It took 2min34 to upload a 58min file, but the double time to download. CC @bantu |
I'm going to debug a bit. It seems there another place in the OC code that will download to a temp file first... |
For some reason, getLocalFile() is called here in lib/private/files.php:135
Even though the $filename is on the mount point, resolve still gives the local storage and trigger the getLocalFile() call. This seems to be a hidden bug. Maybe the mountpoints aren't inited ? CC @icewind1991 I'll comment this out for my tests. |
Hurray! After commenting out the buggy block the file starts downloading directly, streaming from SFTP -> OC -> browser directly. Only a bit more than 2 min ! |
@schiesbn encryption seems to work. The SFTP stream implements fseek(). Nice! |
Uploading 58 MB file after this fix: 2min 34 |
Wow. Awesome! You rock! But let's kill the mimetype scanning anyways. :-) |
Test passed. |
I've submit this PR #5961 to fix the "addSendfileheader()" condition issue I mentionned in #5954 (comment) |
This PR is still valid as it will improve upload/download performance. |
Test passed. |
@PVince81 FYI: The phpseclib update only should give you a bit of a speed improvement already. |
@bantu good to know. I'm still wondering why copying a 58 MB file to localhost through SFTP takes 2min30 but when I do it with the scp command it takes less than a second. Anyway, the new phpseclib and its stream are already a great improvement. I just wanted to do a bit more testing before I remove the WIP tag. |
@PVince81 Feel free to send me your test script and I'll try to find out why it is so slow. |
It's a bit late for that one and I don't want to risk causing regressions. |
- Upgraded phpseclib to master version (post 0.3.5) - Now using fopen() on sftp URL for both read and write - Fixes #4063
Test passed. |
Rebased. Will test encryption next. |
Works well with encryption, the file is streamed through the encryption code. Please review @bantu @icewind1991 @karlitschek @DeepDiver1975 @schiesbn Note: this seems like a big change but actually simply imports the new phpseclib version that supports streaming and switches This removes the need for temp files for upload/download which significantly accelerates the transfer. |
can't test at the moment but looks good. 👍 |
Test passed. |
tested 👍 |
[Ext storage] Now using SFTP stream wrapper from phpseclib
Please make sure to test with a directory full of pics that are at least 2 MB big.
Preview generation should be faster than before.