- I have two websites that will share some resources, lets say, index.php, functions.js and style.css, and these scripts will be used on almost all pages on the websites.
- I have two audiences to cater for (in terms of download speed), the users within the same network that the sites hosted on (100mb/s aprx) and external users.
I am looking for the best way to cache each kind of script (.js, .css, .php) and examples of how this would be done with their pros and cons over other methods if possible. By caching I mean locally, network and server caching.
Note: index.php is a dynamic page which should be refreshed from cache every 2 hours. It would be nice if you start your answer with .js, .css, .php or a combination so I can easily see what type of script you are talking about caching.
Thanks All!
Performance tuning through cachine could be categorized into multi-layers:
Good introduction and practical code examples can be found in Chapter 9 (Performance) – Developing Large Web Applications. It will talk about Caching CSS, Javascript, Modules, Pages, Ajax and Expire headers.
If we need to keep things simple on server-side do the following:
In future if you have multiple servers and the performance becomes to be crucial before then you will need to look at:
Finally as references in web application performance check: