My application uses a RESTful api to receive requests from users and generate files on demand. When the file has been made, it responds back with a dl link to said file.

When this was on a single server setup, I didn't have to worry about selecting the correct server to upload the file, as the file was generated and stored on the same server.

But on a multi-server setup, the request could be sent to Server A, stored on Server A and the user connected to the dl link via Server B (which has no file).

So far I have thought of a couple ideas, but I'd like your advice on what to do and/or how other sites do this.

Ideas:

  1. Have all servers write said files to a dedicated "storage" server where the download link will be served up from.
  2. Attach a key to the end of the filename, representing which server the file resides on.
link|improve this question
feedback

1 Answer

up vote 0 down vote accepted

You want to be using centralized storage for this.

Trying to sync uploaded files between servers is not practical in the long term. Especially if there is a large volumes of files to deal with.

At $work we have 10 web servers all using the same file server for reading files and saving files. (More read than write though.)

This file server is replicated to a hot standby file server using DRBD in a master/slave setup.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.