Using Cache-Control Headers in TYPO3
By Karsten Dambekalns
Large websites with a lot of visitors are often fighting performance problems. Since buying faster hardware isn't the best solution, TYPO3's page caching is very helpful in those cases. But this still needs server resources, so why not let the browser or a proxy cache the content? This article demonstrates how to configure TYPO3 to enable client-side caching and shows possible problems with this approach.
This article is intended for TYPO3 administrators who are considering client-side caching of content to improve performance.
You should be able to install and configure TYPO3 and know about the basics of TypoScript.
The Danish Consumer Agency runs the consumers' portal forbrug.dk which is one of the largest TYPO3 installations in the world with 130,000 unique visitors giving 13 million hits per month.
This was managed with only 1 server for the website and database and 1 server for delivering mail. During the fall 2004 they experienced spikes in their traffic (usually caused by being mentioned on TV and net media). These spikes were more than the installation could handle.
Possible solutions
Upgrading the CPUs in the server was quickly ruled out as a solution: Doubling the speed would have cost at least 15,000 Euro in hardware alone.
So a software solution was needed. They analyzed their documents and most of them are not changed during 24 hours – these could be cached without any problems. A few, however, must never be cached as they change (e.g. the result of a search).
„We tried making a small change where all pages were cached for 24 hours using Apache's proxy module as caching engine. While this gave a remarkable speed up (in the order of 10 times) this proved fatal to the few pages that must never cached.
The right thing to do was of course to make TYPO3 compliant with current caching practices (e.g. RFC-2616). After identifying the changes needed in term of HTTP-headers that should be generated, we turned to Kasper Skårhøj and had him implement the changes. The identification process took in the order of a man week, and implementing the changes in TYPO3 and testing them took also in the order of a man week.“ (Ole Tange, www.forbrug.dk)