: Separating static/uploaded content from the site 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)
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.
More posts by @Jamie184
1 Comments
Sorted by latest first Latest Oldest Best
Worry about Rsync later - for now you can do it all on the one box.
Your main domain is www.example.com/ on this domain you serve cookies (yum!).
The non-www redirects to the above.
Your static domain is 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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.