pgaertig / nginx-big-upload

Resumable and reliable file uploads of any size. Nginx extension written in Lua.
https://github.com/pgaertig/nginx-big-upload
Other
192 stars 49 forks source link

Resumable upload with loadbalancer #18

Closed iNDicat0r closed 8 years ago

iNDicat0r commented 8 years ago

The scenario is to have a loadbalancer in front of few backend servers with resumable upload support. As I can see nginx stores the state on individual backends so this prevents us from scaling. Thought of having a shared folder between the nodes but that means overhead In performance etc.. Suggestions are welcome

pgaertig commented 8 years ago

For sure your load balancer supports some kind of persistence or stickiness. You can try to stick user by cookie value, session cookie key or path segment. I wouldn't try IP affinity as user my reconnect and would expect to continue upload. However I would also test the scenario where the assigned back-end node goes down and client gracefully retries upload from scratch without previous state on server-side. In general it is good to have such logic implemented - sometimes users just suspend or hibernate their computers in the middle of upload, by the time they resume their balancing affinity may expire or partial uploads can be deleted.