I created a sub-domain for static content to be able to serve it more efficiently by several load-balanced web servers. This static content is updated automatically, at a rate of ~1k files/day.

Right now I use rsync to update the servers in a master/slave way but since the content has a growing number of 100k+ files, it takes more and more time and puts an increasing I/O load on both the master and the slaves.

I cannot use the solution I proposed on the Improve rsync performance question since I cannot know which files are modified without stat-ing them all, and that wouldn't solve the increasing I/O cost. I also have to handle file deletion.

I thought about using something like a r/o NFS on the slaves but that could somewhat defeat the load-balancing effect and put a gratuitous SPOF.

Btw, the servers are running AIX, but I'm also interested in a solution in a more generic context.

  • 1
    It's worth asking: are you sure you need two machines to serve this data at all? If you are using Apache with the prefork MPM you will find there's plenty of room left to grow on a single machine if you use something better (worker MPM, or an entirely different httpd like nginx). If you can do this, then you can setup a standby server and run a low priority rsync continually to ship the data across. – Alex J Jun 1 '09 at 7:49
  • @Alex: +1 since you do raise an often over-looked point. But yes, unfortunately, I do need multiple servers and I'm stuck with a prefork apache :-) – Steve Schnepp Jun 1 '09 at 8:02
  • You don't say how the files are put on the "master" or how they are organized. One big directory or split into sub directories? Seeing as some process must be creating or adding all these files, can it also produce (or use it's log to produce) a file list or recently added files? How are the file put on the master? Is there a log for that (samba, ftp xfer, or even inotify)? – David Aug 4 '09 at 1:30
  • It's organized in a somewhat mixed way: split into subdirs, but there are some huge dirs also. The files are produced by various ways, but mostly application & sftp. – Steve Schnepp Aug 4 '09 at 5:40

Why don't you just use reverse proxy, such as Squid?

  • how would that be relevant ? – Antoine Benkemoun Jun 1 '09 at 8:59
  • How wouldn't it? It's exactly the scenario for which caching proxy such as Squid where created. – vartec Jun 1 '09 at 9:24
  • +1: I ended using Squid. But I'm in the process of hand-crafting a better solution (based on a timed find -ctime) – Steve Schnepp Jul 17 '09 at 8:11

You should maybe consider DRBD with OCFS so that you can have master/master nodes. This creates no SPOF because each node has a local copy.

You can also make two NFS node servers (DRBD master/standby or DRBD master/master with LB). If you have many nodes, this is the best option.


If you are using rsync, make sure that the files do not get accessed each time you sync them. This way only the file lists and the timestamps get compared and that should be reasonably fast, even with millions of files.

rsync -t should replicate the time stamps and compare timestamps only. If that doesn't work, use the option size-only (if your file may change without changing the size, be careful)

  • Actually, an strace shows that all the files still get stat-ed in order to retrieve their mtime. – Steve Schnepp Sep 8 '09 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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