Magento – Optimizing app/etc/local.xml – caching like Redis

adminhtmlbackendlocal.xmlmagento-1.7performance

This is an interesting one. I've been looking into methods of improving the performance of the Magento backend. I stumbled across this module:

colinmollenhour/Cm_Cache_Backend_File

Which looks quite promising. I believe there was a presentation about this at Imagine 2012. In any case, in the instructions to install, I read this:

  1. Edit app/etc/local.xml changing global/cache/backend to Cm_Cache_Backend_File

In other words:

<config>
<global>
    <cache>
        <backend>Cm_Cache_Backend_File</backend>
    </cache>
    ...
</global>
...

For the life of me however, I couldn't find the <cache>...</cache> tags.

Doing a quick search on Google for

optimize app/etc/local.xml

I found:

pagodabox/magento-install-optimized

Which lists the following changes:

<config>
<global>
    <session_save><![CDATA[]]></session_save> <!-- db / memcache / empty=files -->
    <session_save_path><![CDATA[]]></session_save_path><!-- e.g. for memcache session save handler tcp://10.0.0.1:11211?persistent=1&weight=2&timeout=10&retry_interval=10 -->
    <session_cache_limiter><![CDATA[]]></session_cache_limiter><!-- see http://php.net/manual/en/function.session-cache-limiter.php#82174 for possible values -->
    <cache>
        <backend></backend><!-- apc / memcached / xcache / empty=file -->
        <slow_backend></slow_backend> <!-- database / file (default) - used for 2 levels cache setup, necessary for all shared memory storages -->
        <slow_backend_store_data></slow_backend_store_data> <!-- 1 / 0 (default) - used for 2 levels cache setup, sets whether store data in db slow cache backend -->
        <auto_refresh_fast_cache></auto_refresh_fast_cache> <!-- 1 / 0 (default) - used for 2 levels cache setup, sets whether refresh data in fast cache backend -->
        <memcached><!-- memcached cache backend related config -->
            <servers><!-- any number of server nodes can be included -->
                <server>
                    <host><![CDATA[]]></host>
                    <port><![CDATA[]]></port>
                    <persistent><![CDATA[]]></persistent>
                    <weight><![CDATA[]]></weight>
                    <timeout><![CDATA[]]></timeout>
                    <retry_interval><![CDATA[]]></retry_interval>
                    <status><![CDATA[]]></status>
                </server>
            </servers>
            <compression><![CDATA[0]]></compression>
            <cache_dir><![CDATA[]]></cache_dir>
            <hashed_directory_level><![CDATA[]]></hashed_directory_level>
            <hashed_directory_umask><![CDATA[]]></hashed_directory_umask>
            <file_name_prefix><![CDATA[]]></file_name_prefix>
        </memcached>
    </cache>

    <!-- example of two level cache setup with slow backend at files. -->
    <full_page_cache>
        <backend_options>
             <cache_dir>full_page_cache</cache_dir>
         </backend_options>
         <slow_backend_options>
             <hashed_directory_level>1</hashed_directory_level>
             <hashed_directory_umask>0777</hashed_directory_umask>
             <file_name_prefix>fpc</file_name_prefix>
             <cache_dir><![CDATA[full_page_cache]]></cache_dir>
         </slow_backend_options>
     </full_page_cache>

    <remote_addr_headers><!-- list headers that contain real client IP if webserver is behind a reverse proxy -->
        <header1>HTTP_X_REAL_IP</header1>
        <header2>HTTP_X_FORWARDED_FOR</header2>
    </remote_addr_headers>
</global>

My questions are as follows:

  1. Has anybody made ANY of these modifications to the local.xml file before?
  2. If so, what was the result thereof?
  3. Are there perhaps any other tips regarding this file which could help improve performance?

Edit:

Looking at a local.xml.template in stock Magento CE 1.9.0.1, I see no mention of the <cache>...</cache> tags.

Best Answer

If you are looking to improve the performance of the backend, neither Redis or Memcached (or any other backend) will make much of a difference.

In the admin, the cache is rarely accessed (config/layout only), both of which are infrequently hit and not particularly demanding anyway.

Memcached/Redis improve server concurrency under load, but do not improve individual user page load time.

Ultimately, if your admin is slow, its almost certainly caused by insufficient/incorrectly configured hosting. Its an environment that will highlight and accentuate any performance bottlenecks in the server config itself (that can't be hidden behind the block cache/fpc/varnish in the frontend).

But a quick tip would be to remove the admin notifications altogether. This can make the admin really slow.