Skip to content

Asynchronous PUT #12097

Closed
Closed

Description

@ogoffart

This is a feature required to have reliable upload of big files. Sometimes, the server might take a while to assemble chunks or to put them in their final destination, and the client times out which causes the file to be downloaded again.
( owncloud/client#2074 )

The solution to this problem is Asynchronous PUT via a poll URL.
This is already implemented on the client and will be part of the 1.8 release.
It is working successfully in a proprietary deployment (with a custom app on the server).

The client send with the PUT a "OC-Async:1" header, indicating it supports that feature.
The idea is that, for the last chunk, if the server has reason to believe that assembling the chunk may take more than a few seconds, it may return "202 Try LAter" instead of the usual "201 Created". Also in the response there is a header "OC-Finish-Poll" with a path to the poll url.
Example: OC-Finish-Poll: /remote.php/poll?pollId=123456

The client will then query this URL, which can write some spaces on the wire to avoid timeout, and when it is finaly finished, it can leave the JSON with "etag", and "fileid" property incase of success, or an "error" property in case of failure.

{ "etag": "123456789" , "fileid": "987654321" } 

Activity

  1. DeepDiver1975 commented on Nov 11, 2014

    @DeepDiver1975
    Contributor

    why would polling make anything easier/more performant?

    The server side change is not trivial and introduces another piece of no-standard webdav api - just like my idea in #12001 - I really question if we should not skip webdav then and rely on our own protocol?

  2. PVince81 commented on Nov 11, 2014

    @PVince81
    Contributor

    I believe this might not be possible with PHP, as PHP doesn't support multi-threads (except using hacks like spawning processes with popen())

    One idea would be to make the PHP code return an XML response with maybe a transaction id or something, but then continue processing. This means the network connection will still remain open and the client must manually close the connection after receiving the response.
    The PHP process might continue running in the background after the network connection is closed, but I'm not 100% sure of that. Some PHP handlers might decide to kill the connection.

    Another issue: the PHP process itself might time out if assembling chunks thakes more than an hour for any reason.

    It's all quite hacky. And as @DeepDiver1975 said it's no standard WebDAV.

  3. ogoffart commented on Nov 11, 2014

    @ogoffart
    Author

    I forgot to mention that the json can also contains { "unfinished": 1 } and the client will retry the same poll URL.

    This is not about performence, it is about reliability.
    note that the PUT request with 202 Try later might also contains the json reply. So you can leave the script running after sending the headers. You can also finish the processing in the poll url request.

  4. PVince81 commented on Nov 11, 2014

    @PVince81
    Contributor

    Is reliability something that could otherwise be achieved with checksums ? ducks

  5. DeepDiver1975 commented on Nov 11, 2014

    @DeepDiver1975
    Contributor

    From a server side implementation point of view something like this requires an architectural change where we have true server side processing within a daemon/worker.

    In order to build a reliable and scaleable infrastructure job queueing systems come to my mind.

    e.g. something like

  6. DeepDiver1975 commented on Nov 11, 2014

    @DeepDiver1975
    Contributor
  7. DeepDiver1975 commented on Nov 11, 2014

    @DeepDiver1975
    Contributor

    if we really want to walk this path - this is a new api - no webdav mangling please

  8. karlitschek commented on Nov 11, 2014

    @karlitschek
    Contributor

    Something to be discussed very carefully because this has a lot of implications.
    We also have to investigate if this can´t be fixed on the server side only without changing the protocol by doing some of the more expensive operations asynchronously on the server only.

    Frank

  9. guruz commented on Nov 18, 2014

    @guruz
    Contributor

    Linking some other issues which might be fixed by implementing this task or a similar solution with the same goal:
    owncloud/client#2260
    owncloud/client#1425
    owncloud/client#2284

  10. cdamken commented on Nov 24, 2014

    @cdamken
    Contributor

    Could be checksum another option to avoid upload or download the exiting files?

  11. guruz commented on Nov 24, 2014

    @guruz
    Contributor
  12. karlitschek commented on Nov 26, 2014

    @karlitschek
    Contributor

    @butonic Hmmm. Range Headers are not part of the official http spec for PUT and POST and we also were not aware of that fact that others are bending the standard like that at the time we implemented our big file chunking.

  13. butonic commented on Nov 26, 2014

    @butonic
    Contributor

    @karlitschek which is why sabredav uses PATCH for that.

  14. 30 remaining items

  15. PVince81 commented on May 9, 2016

    @PVince81
    Contributor

    @butonic

    Revealing a file in the filelist

    need to take care of the case where files get overwritten, might still need part files... The advantage of part files is that it reduces the time window of locking, else the file might be locked during an hour long upload.

  16. PVince81 commented on May 9, 2016

    @PVince81
    Contributor

    Raised #24509 for more generic async file operations (also DELETE, etc).

  17. modified the milestone: backlog on Oct 14, 2016
  18. kubco2 commented on Aug 13, 2019

    @kubco2

    What about this please?

  19. micbar commented on Sep 16, 2021

    @micbar
    Contributor

    This topic will be adressed in ownCloud infinite scale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions