Tuesday, 1 April 2014

Installing memcache with magento

memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
Advantages
--A very fast cache backend.
--Easily used with multi-server(clustered) environment
Disadvantages
Memcached does not support tagging, you still have a slow file system as slow level cache.
Requirements
- Memcached server
- PHP extension for memcached

Configuring with magento:
Once you have done with the memcache installation on the server you using for memcache.

Open app/etc/local.xml
<global>
<cache>
        <backend>memcached</backend>
        <slow_backend>database</slow_backend>
        <id_prefix>cache_</id_prefix>
        <memcached>
                <servers>
                    <server>
                        <host><![CDATA[your_memcache_server_ip]]></host>
                        <port><![CDATA[11211]]></port>
                        <persistent><![CDATA[1]]></persistent>
                        <weight><![CDATA[1]]></weight>
                        <timeout><![CDATA[60]]></timeout>
                        <retry_interval><![CDATA[10]]></retry_interval>
                    </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[STORE_]]></file_name_prefix>
        </memcached>
</cache>
</global>


Checking whether memcache is working or not
Go to memcache server with ssh login
 memcached-tool  server_ip:11211 stats

It will show stats like
STAT pid 2239
STAT uptime 10228704
STAT time 1236714928
STAT version 1.2.3
STAT pointer_size 32
STAT rusage_user 2781.185813
STAT rusage_system 2187.764726
STAT curr_items 598669
STAT total_items 31363235
STAT bytes 37540884
STAT curr_connections 131
STAT total_connections 8666
STAT connection_structures 267
STAT cmd_get 27
STAT cmd_set 30694598
STAT get_hits 16
STAT get_misses 11
STAT evictions 0
STAT bytes_read 2346
.....



No comments :

Post a Comment