OC_FileChunking on external file systems
The current implementation of OC_FileChunking is storing the chunks in the servers file cache (hidden/private folder on the server).
After all chunks have been received the file is reassembled and moved to the final target location.
While this approach seems valid for local filesystems this can case issues with respect to external filesystems and big files, because the final move of assembled file will consume some time.
From the overall system behavior it might be interesting to move the chunks already to the external filesystem.
My suggestion would be to store the chunks already in the target file but name it differently, append the .part and even make it hidden if possible.
This approach would speedup the process on the local filesystem as there is no reassembly step which as of today adds additional execution time.
@karlitschek @bartv2 @icewind1991 @danimo @dragotin Please add your comments - THX
:+1: as mentioned in bug #2947 already which was killed by a close-bugs-no-matter-what wave unfortunately ;-)
This is a good idea, we only need to add an offset header to know where in the file to write the chunk. This way the order of chunks is not important
This is a good idea, we only need to add an offset header to know where in the file to write the chunk. This way the order of chunks is not important
we could use the http range header for this
@karlitschek oc7 I guess :wink:
Assembling the chunks on the external file system will be a problem though most backends don't support partial writes or appends, the only reliable way to append two uploaded chunks on an external file system would be to download both chunks and upload the result.
In such a scenario we need to stick with the approach we have today.
What about moving this to the storage api and let the storage implementation handle this?
Yes. ownCloud 7
Moving it to the storage API might help but I only know of one backend (ftp) that might be able to provide a better then default implementation. so I don't think it will help much in the end.
it will help with irods as well - not the most common storage but still ..... :wink:
Any more ideas on this ? After reading the thread that raises some relevant issues about the proposed approaches, I can't think of any other at the moment.
I heard that 1.6.0 has configurable chunk sizes. If we can increase the chunk size to reach the max upload size, it might help when uploading files to ext storage as a single chunk, at least for bigger files. This way the sysadmin, if they wish so, could manually increase the max upload size to bigger values to match the kind of file sizes expected in their environment.
@PVince81 remember that we also introduced the chunking to not get hit by the request timeout.
I heard that 1.6.0 has configurable chunk sizes.
We might want to update the protocol in this case - I can think scenarios where the chunk size can become an necessary information on the server. As of today the chunk size is not communicated.
@dragotin another topic for Wednesday?
Yes, but I do not really see a big benefit in changing/configuring the chunk size.
This is part of a larger conversation to be had around external storage. For example, if you upload a file once to the server in chunks and reassemble, and then put it to a backend server...you are uploading twice: once to the ownCloud server, once to the backend.
This is part of a larger oC 8 concept we need to look at that allows direct access where possible, streaming if the backend supports it, and then this as a last effort - as performance is slowest here.
This is not an Enhancement, but a bug, the mirall issue tracker is full of bug reports about timed out uploads of big files (Example https://github.com/owncloud/mirall/issues/2074). Please re-tag to bug.
Solution proposal is https://github.com/owncloud/core/issues/12097
@dragotin do you face these timeouts only on external storage or on local storage as well?
also on local storage. Its a matrix of computer speed and load and size of the file to process and timeout value, so it will always simply be possible to time out.
okay - we can for now at least get rid of the reassembly step ... I'll take care of that - NOW
@DeepDiver1975 if I understand well, will you store the part file directly on the external storage, and use fseek() to fill in the chunk gaps ?
Note that fseek() doesn't work on most external storages.
The other approach, simply putting the chunks onto the external storage server will be even slower because the workflow would be as follows:
- Upload chunk1 to SMB
- Upload chunk2 to SMB
- ...
- Upload chunk N to SMB
- Read chunk 1 ... N from SMB and at the same time write the part file to SMB
- Rename part file on SMB to the final file name.
Putting the chunks directly with this methods adds an additional overhead for each chunk, and also the additional overhead of having the re-download the chunks from SMB for assembly.