4

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.

2
  • That pagoda thing, throw it out as it's specific to something else other than Redis. Oct 13, 2014 at 18:20
  • Consult app/etc/local.xml.additional for more applicable external cache setups. Oct 13, 2014 at 18:26

6 Answers 6

6

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.

1
  • This depends on where your bottleneck is. If you have a network share, and you are using "file" storage for sessions and caching, then using memcache for session storage may improve things drastically. Aug 27, 2015 at 20:51
3

Version 1.9.0.1 already has this Redis caching module in place.

If you look in your lib/ folder, you should see two subfolders, Cm and Credis.

How to use Redis on Magento CE is a start, you must have Redis 2.6.9+ installed on your server before you can proceed. Also PECL support for gzip or lzf is needed for the tag compression.

Consult your app/etc/local.xml.additional file to see how the <cache></cache> section is set up.

The below xml is included within the <global></global> node of <config></config>

    <!-- example of redis cache -->
    <cache>
        <backend>Cm_Cache_Backend_Redis</backend>
        <backend_options>
            <server>127.0.0.1</server> <!-- or absolute path to unix socket for better performance -->
            <port>6379</port>
            <database>0</database>
            <password></password>
            <force_standalone>0</force_standalone>  <!-- 0 for phpredis, 1 for standalone PHP -->
            <connect_retries>1</connect_retries>    <!-- Reduces errors due to random connection failures -->
            <automatic_cleaning_factor>0</automatic_cleaning_factor> <!-- Disabled by default -->
            <compress_data>1</compress_data>  <!-- 0-9 for compression level, recommended: 0 or 1 -->
            <compress_tags>1</compress_tags>  <!-- 0-9 for compression level, recommended: 0 or 1 -->
            <compress_threshold>20480</compress_threshold>  <!-- Strings below this size will not be compressed -->
            <compression_lib>gzip</compression_lib> <!-- Supports gzip, lzf and snappy -->
            <persistent>1</persistent> <!-- persistence value, 0: not in use, > 0 used as persistence ID -->
        </backend_options>
    </cache>
2

The tutorial on the inchoo website is very helpful: http://inchoo.net/magento/using-redis-cache-backend-and-session-storage-in-magento/

0
1
  1. Yes the local.xml is being modified all the time to implement caches like APC, Memcached, Redis, etc.

  2. If done correctly, it will improve the performance of your Magento store tremendously. Done wrongly and it will break the store. Make sure you keep a backup of the original copy.

  3. If you have Memcached, APC or Redis installed in your server, you can implement them.

1

lots of thread available online for the config file but its just related to Magento you need to think something for the server side optimization and server side cache, in that case you first need to install APC, Redis, XCache as you preferred. Also Cm_Cache_Backend_File is related to Redis Cache so in that case your port 6379 enabled and need to have redis and phpredis installed in order to create bridge between Magento and Redis Cache Server.

0

I found I can use Redis for both session and cache with my Amasty Full Page Cache. I just had to put the FPC inside

<cache><amfpc>... </amfpc></cache>

Not the answer you're looking for? Browse other questions tagged or ask your own question.