cancel
Showing results for 
Search instead for 
Did you mean: 

memcached

memcached

Hi to all,

is there an official guide/documentation on memcached configuration for Magento?

I have found too many examples onlinebut none of them is working for me...

 

I can't understand what exactly i need to add to local.xml file.

And... how can i test that Magento is really using memcached??

 

Thanks in advance Smiley Happy,

Alberto

4 REPLIES

Re: memcached

Most of the guides are actually similar as which is generally as follows:-

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

You will need to make sure that the Memcached is properly installed at the server level and it is listening to port 11211. 

 

 

James Lee | Moderator • Magento Master
See My Recommended Magento Hosting & Security Tips

Re: memcached

Hi JLHC and, before all, thanks!

 

The config you showed me is similar to mine.

 

Here it is:

<cache>
<backend>memcached</backend>
<slow_backend>database</slow_backend>
<slow_backend_store_data>0</slow_backend_store_data>
<auto_refresh_fast_cache>0</auto_refresh_fast_cache>
<memcached>
<servers>
<server>
<host><![CDATA[127.0.0.1]]></host>
<port><![CDATA[11211]]></port>
<persistent><![CDATA[1]]></persistent>
</server>
</servers>
<compression><![CDATA[0]]></compression>   /* here you set <![CDATA[]]> (is this the way to get the default value?) */
<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>

 

As you can see here are some more instruction that, if i'm not wrong, are used to cache the administration panel. 

 

This code, from what i have understood need to be added to the file "/app/etc/local.xml" in this position:

<config>
<global>
</global>

/* memcached config goes here */
</config>

 

Is this all correct?

 

But... how can i verify that Magento is really using memcached?

I'm sure that the extension is installed and is listening to port 11211 but i really can't see any performance boost.

Prove of that in phpinfo and in a little script that try to cache/retrive a single object.

Re: memcached

Sorry for the delayed reply as I was caught up with many projects at the end of last year so I have not been checking the forum until now. 

 

Did you manage to test if Memcached is actually doing it's work? 

 

There are quite a few ways for you to test it as you can see here:-

https://stackoverflow.com/questions/1690882/how-do-i-see-if-memcached-is-already-running-on-my-chose...

https://stackoverflow.com/questions/631903/how-do-you-know-if-memcached-is-doing-anything

James Lee | Moderator • Magento Master
See My Recommended Magento Hosting & Security Tips

Re: memcached

If you can I would recommend use you memcached for sessions and Redis for cache/fpc.

 

The reason for this is if you put your cache into memcached you still have to store and manage your cache-tags in the database level (yet another overhead you don't need).

 

Moving to Redis for everything except sessions will strip out that database overhead.