I have a website right now that is currently utilizing 2 servers, a application server and a database server, however the load on the application server is increasing so we are going to add a second application server.

The problem I have is that the website has users upload files to the server. How do I get the uploaded files on both of the servers?

I do not want to store images directly in a database as our application is database intensive already.

Is there a way to sync the servers across each other or is there something else I can do?

Any help would be appreciated.


  • 1
    Womble the Fortune Teller sees NFS in your future... – womble Jul 8 '12 at 19:14

This is difficult to answer because it's entirely dependent on your application. It sounds like you have some core application architecture issues that won't be resolved in a ServerFault question. With that said, there are some steps you can take to resolve the issue you described.

The most appropriate course of action in a situation like this is to break the file share into a separate service of its own. Don't duplicate files if you have a network that can let the files be "everywhere (almost) at once." You can do this through NFS/CIFS or through a proper storage protocol like iSCSI. Mount as local storage in the appropriate directory. Depending on the performance of your network and your storage needs, this could add a couple of undetectable milliseconds to page load time.

  • I would add that if this is an important service, you will want to have a separate NFS server that does nothing else. Or, rather, you will want two of them in a cluster, if uptime matters to you. – Jenny D Jul 8 '12 at 19:15

I can think of different solutions.

You could share files via NFS or on a iSCSI drive. - I doubt this gives good performance.

You could put the files on a seperate server and use it like a CDN. - This is a favourable way because it allows the browser to download assets asyncrously.

You can use a real CDN like Cloudfront

  • I've covered the details of this method of storing files on a separate server and using it like a CDN in an answer to a previous question, if anyone needs more details of what it looks like. – womble Jul 8 '12 at 19:16

csync2 is your solution: http://oss.linbit.com/csync2/

It is designed for exact your problem. Maybe you read this blogpost: http://thuannvn.blogspot.de/2010/01/csync2-is-so-cool.html



Another answer could be to use a piece of software called BTSync, it is very easy to install and use and could allow you to easily keep files in sync accross as many servers as you need to. It takes only 3 terminal commands to install and is very efficient.

Take a look here

and here

Your Answer

