[TYPO3-dev] Caching Framework

Bernhard Kraft kraftb at think-open.at
Mon Mar 1 23:53:40 CET 2010


Hello !

Did anyone use some of the new Caching-Framework Backends like Memcached 
and get any measureable performance improvement?

I did some testing, and noticed that it does not really get faster even 
if you set all three cache types (cache_hash, cache_pages, 
cache_pagesection) to "Memcached" ...

I read a documentation from Dmitry:

http://dmitry-dulepov.com/article/how-to-enable-memcached-cache-in-typo3-43.html

But there also some people commented they did not get any performance 
improvement. So I started to investigate the whole story, and what I 
found out is:

* When doing a benchmark with "ab" it doesn't really make any difference
   if you use memcached or db backend, as mysql will cache the results
   anyways

* The bottleneck in fact is the serialize/unserialize stuff. If you
   analyze the sourcecode and un/serialized data, you'll notice that
   quite a few hundred kilobytes of data get un/serialized for each
   request. These are cached TypoScripts, TSConfig, HTML-Content, etc.

un/serializing is only required when you want to store the data in the 
database. A proper PHP caching/accelerating extension like "xcache" can 
directly store PHP variables in memory.

So I hacked the TYPO3 sourcecode and removed all unnecessary 
un/serialize calls and created a backend/frontend for the new Caching 
Framework to work together with xcache:

http://xcache.lighttpd.net/

(Using lighthttpd is not mandatory for xcache - it also works together 
very good with apache!)


The resulting benchmarks are quite nice. I doubled the number of pages 
served from cache, thus halfed the page generation time:

http://www.phlogi.net/f/t3/tsp/sp/-629a2eddeb/

~250ms per page instead of 530ms ...

If someone is interested in my changes I uploaded a diff against 4.3.1 here:

http://think-open.org/kraftb/typo3_xcache.diff

If you use traditional templating together with "automaketemplate" you 
could/should apply this diff:

http://think-open.org/kraftb/automaketemplate_xcache.diff


And of course you have to configure the Caching Framework correctly. 
Append at the end of your localconf.php:

http://www.phlogi.net/f/t3/tsp/sp/-0bc01c72b8/

As this brings ~100% performance improvement even for cached pages with 
xcache installed, I guess it is worth a try. If some people can confirm 
this patch is working an leads to an performance improvement, I could 
try to get this into the core!



greets,
Bernhard




More information about the TYPO3-dev mailing list