Boost magento performances managing the two level cache

MagentoIf you are after some improvements on magento “speed”, you will probably interested in why it is so slow, a great explanation about why (a piece at least) magento is slow, is detailed here.

To sum it up, assuming you are using memcached to store the sessions (and I hope you do), here a small snippet to be applied to your app/etc/local.xml file to handle that second level cache:

<config>
 <global>
 [...]
  <cache>
   <backend>memcached</backend>
   <slow_backend>database</slow_backend>
   <fast_backend>memcached</fast_backend>
   <slow_backend_store_data>1</slow_backend_store_data>
   <auto_refresh_fast_cache>0</auto_refresh_fast_cache>
   [...]
  </cache>
 [...]
 </global>
</config>

As it is in the snippet, the second level is stored in the database instead of writing everything in the files as it does by default, using this (after restarting memcached) you will notice a huge boost in speed, you can also disable it by setting the slow_backend_store_data to 0, but that will slow down a lot the website when the cache is empty.

Enjoy!