I have a site where I anticipate to have a large amount of users. I've heard that it is a good idea to separate user content (uploaded images) and place them on a separate static server where lighttpd would serve the content. This is supposed to speed up the requests significantly.My question is:Roughly how much improvement can I expect form doing this?How is it done? Users on my site upload files but then how do I automate the transfer process? What's the best practice? Rsync?Any other tips? ideas? I'd really appreciate your input.
Separating static/uploaded content from the site
php;apache;content;cdn;lighttpd
Worry about Rsync later - for now you can do it all on the one box.Your main domain is http://www.example.com/ on this domain you serve cookies (yum!).The non-www redirects to the above.Your static domain is http://static.example.com/ and on this domain you don't serve cookies or any other header items that are not really needed. Put js+css on there compressed and images served uncompressed. Set anything served on static to be public cache-able and with an expiry date some time into the future. Now setup your domains to point to the same place on the file system, i.e. if you really want to load test.jpg you can get exactly the same file from either place. Do this with httpd.conf settings and two virtual server entries.When your traffic gets to big levels you can migrate your static content server to a different box and rsync the whole document root to the new box. A cron job can be setup to do this every 5 minutes or so and the 404 of the static can redirect to the www to pick up on any resources not yet rsynced.