views:

49

answers:

1

Hello, I have a content management system running on a web server, that among others allows the user to upload assets like images, files, etc to the server.

The problem i have is that there will be 2 servers running behind a load balancer and i am trying to find an efficient way to handle the assets management.

The question i have is:

Will the assets be uploaded to one server every time? Or is there a chance that the images/files will end up into server1 or server2 depending on the load?

How to i serve the images if i don't know on which server they end up in? Will i have to keep the directories of these assets (images/files) synchronized between the two servers?

Thanks,

+1  A: 

Synchronization is a tough problem to crack. You can do ad-hoc synchronization using Couchdb but that requires good knowledge of the low-level issues. Therefore you need to choose a write master.

DRDB

You could look at DRDB :D Use one server as the write-master and the other as the slave. Then you can server content from both. This approach is amazing for database-pairs.

Note: seperating your code and URL's for write-master and serve-only will be anoying

Couchdb

You could use couchdb but I think that might be overkill. This is for the LARGE amounts of data and high-levels of fault tolerance.

NFS

You could export the asset directory on the write-master as an nfs drive and import it from the other computer. But in this case it wouldn't be load-balanced in all cases -- i.e., only if the files are cached by the slave. You could use a third computer as an NFS server -- this would allow you to scale to more web-servers.

A central NFS server might just be your best solution as you can do without a write-master as every front-end server can perform writes. This is the approach I would use unless I am thinking of going past the peta-byte range :P

Hassan Syed