I'm trying to built a server script using bash scripting and cURL for upload/download/archive operations through the HTTP API.
However, after(!) every append (v2) there is a varying delay between 2-5 seconds until cURL can exit (therefore receive feedback from POST). The bigger the chunk the longer it takes cURL/POST to successfully exit. I've tried sizes varying 1-150MiB but the delay is always there, increasing with filesize. This also happens when uploading single files (< 150MB).
This is unacceptable for productive use, since these delays between append uploads can add up to minutes/hours depending on the file size. Multi threading is obviously not possible since consecutive append-POST operations rely on the previous one to finish, so everything needs to be done in a sequential order programmatically speaking.
What I've tried until now:
- different versions of libcurl
- different locations (in case this was an internet issue)
- two different linux distributions (centos/debian)
- modifying chunk sizes
Here is the code for an HHTP append operation between initiating the session and closing it:
curl -k -X POST -L --show-error --globoff -i --header "Authorization: Bearer $TOKEN" --header "Dropbox-API-Arg: {\"cursor\": {\"session_id\": \"$SESSION\",\"offset\": $RANGE},\"close\": false}" --header "Content-Type: application/octet-stream" --data-binary @$CHUNK "$APPENDURLV2" 2> /dev/null