FineUploader / fine-uploader

Multiple file upload plugin with image previews, drag and drop, progress bars. S3 and Azure support, image scaling, form support, chunking, resume, pause, and tons of other features.
https://fineuploader.com
MIT License
8.18k stars 1.87k forks source link

getSas - PUT block context => decrease server calls to optimize upload flow #2052

Open coronag opened 6 years ago

coronag commented 6 years ago

Type of issue

Uploader type

GetSasKey => cache storage to avoid asking for a new sas key if the last one is still valid for a long time [...] If a sas key has a lifetime of 5 minutes and the last request was made 2 seconds before... it is not required to request a new one. It is more important with concurrent calls (many calls for a same sas key). We use 4MB chunks and concurrent is enabled. 4Mb is a good compromise for bad connections and concurrent helps good connections. Before each PUT request, a call is made to get a fresh SaS key. Our SasKey duration is 5 minutes. Client may avoid requesting the server for a fresh SasKey during for instance 1 minute. Why : this avoid for a very good connection to got many getSasKey request while the SasKey is still valid. Why not much more than 1 minute : for bad connections to avoid having an invalid saskey for a given block blob. Possible evolutions: - an option to specify a sasKeyStorage : if not set, still as actually and if one is given then fineupload will try to use it first before sending a request - not as good as the first one, because not good with all browsers : an option to avoid adding "timestamp" (withcacheburst method) so that the server can set an http cache respone to 1 minute for instance (browser cache).