We are going to start a new series of articles about current and prospective caching mechanisms in In-Portal CMS. Today, in our first article we are going to talk basic views and understandings about purpose and needs of caching.
What is caching? Generally speaking caching engine transforms dynamic web-pages to static web-pages. Of course static pages work faster and provide much less web-server load, but nowadays we know this is not going to work.
Why do we need caching? Well, caching is simply most powerful application speed improvement mechanisms. Whenever decision is made to use caching, then there are several things to keep in mind though:
- what variable parameters (browser parameters, user request parameters, not obvious parameters) affect caching result;
- really algorithm, that’s going to be cached can’t be improved so it would work faster?
- maybe refactoring is what’s needed, not caching.
There is no general rules for applying caching to every web-site page. Each page should be carefully inspected to gain knowledge about it’s purpose on site. There is at least one tool named Google Analytics (which is free by the way), which can be used to detect each site page popularity and other parameters, which will allow developer to implement most appropriate caching strategy for every site page. For example if web-site has one very slow page, that is visited 10 times a month, then there is no need to spend time in attempts to optimized it. Pages with largest amount of hits (among given web-site of course) should be optimized first.
What parts of the website we should cache? Now let’s talk about dynamic websites. Pages on dynamic web-site have the content that is dependent on various external parameters, for ex. user input in form or specific table contents in database. All user input parameters (GET) also can be determined using Google Analytics. For example if cached page is “search results” (which in real life most likely won’t be cached at all), then main input parameter is “search keyword”. Using Google Analytics we could determine what search keywords are most popular and optimize search result page to perform faster search using given keywords.
In the next article will start more technical talk about caching options.