I have an application that uploads files in the background while the main task is being created, similar to Gmail while you are composing an email.
User uploads a file, the backend parses it to see if it has any problems etc.
And after they create their task through the app, it takes the files in session (location in /tmp
) and uploads them to Amazon Simple Storage Service (AWS S3).
It happens that on a server with load balancing, each file can end up on a different server (different /tmp
as each server has its own root).
Which causes my problem locating the file in /tmp
(since it doesn't exist).
In order not to have this problem, I ended up using sticky sessions on the load balancer, with the downside that the balancer is now underutilized, which is not very useful for me.
What's the best way to handle file uploads in this case?