Skip to main content
GeneralMagento

How to Increase Magento’s Performance with Memcached?

By |December 17, 2014 August 23rd, 2022No Comments

Magento 2 websites are known for its high performance and scalability. Let’s start your Magento 1 to Magento 2 migration Now.

Performance has been an issue for many Magento implementations. Over the years, retailers have faced a few discomforts during their peak seasons. To overcome these bottlenecks, Magento has provided a few caching mechanisms that help to improve the performance of the eCommerce websites. Let’s have a look at the implementation process of a popular, distributed memory caching system known as Memcached.

Memcached

Memcached is a powerful caching system which is easy to deploy and can handle complex data caching processes. Magento by default, has an internal cache mechanism which works well for smaller level eCommerce websites. As the website grows with increased visitors, the internal caching mechanism will not be able to handle the huge data. Memcached has a dynamic and swift backend mechanism which handles the cache data in an efficient manner.

To begin, memcached should be configured in local.xml file which is present in app/etc/ directory.

Following code should be placed in the <global> block

<cache>
    <backend>memcached</backend>
    <slow_backend>database</slow_backend>
    <memcached>
        <servers>
            <server>
                <host><![CDATA[127.0.0.1]]></host>
                <port><![CDATA[11211]]></port>
                <persistent><![CDATA[1]]></persistent>
            </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>

In case of Enterprise edition the following code should be placed

<full_page_cache>
    <slow_backend>database</slow_backend>
    <backend>memcached</backend>
    <memcached>
        <servers>
            <server>
                <host><![CDATA[127.0.0.1]]></host>
                <port><![CDATA[11211]]></port>
                <persistent><![CDATA[1]]></persistent>
            </server>
        </servers>
        <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>
</full_page_cache>

While configuring Memcached, we should be aware of both the one level and two level caching systems in Magento. While the data is stored in Memcached for the first level, in the second level, the cached data is stored in the internal database. In such cases, the size of the database has to be continuously monitored (especially the core_cache_tag table). It’s recommended to have cron jobs which monitor and clears out the database for specified limits.

If the admin module is really slow to respond, we should monitor the records in sales_flat_quote table for community edition, and for the enterprise edition enterprise_customer_sales_flat_quote table should be tracked on a regular basis.

Implementing these caching mechanisms improves the overall shopping experience thereby helping retailers to achieve their business objectives.

DCKAP is an end to end E-Commerce solutions provider specializing in building Enterprise eCommerce store fronts in Magento. You can reach us at info@dckap.com (or) 1-877-872-3252 (US) (or) +44(0) 144 250 6383(UK)

Jeyakiruthika

Author Jeyakiruthika

Jeya is a Magento Developer plus and Magento Front End Developer certified Software Engineer. She is self motivated and early adopter to new technologies. She is successful risk taker and a pragmatic developer and a realist. She loves playing with her kid.

More posts by Jeyakiruthika

Discover What You’re Missing

Get the weekly email full of actionable ideas and insights you can use at work and home.