1

I am running on a load balanced server setup with memcached installed in order to improve site performance through caching. However memcached doesn't look to be working correctly. I am currently running three instances of memcached on ports 11111, 11211 & 11311

I have verified the following: - memcached module in php is enabled and present in phpinfo - The service memcache is running on both servers - memcached has been configured in Magento (see local.xml below)

File memcached

<backend>memcached</backend>
<memcached>
<servers>
<server>
  <host><![CDATA[127.0.0.1]]></host>
  <port><![CDATA[11211]]></port>
  <persistent><![CDATA[1]]>   </persistent>
</server>
<server>
  <host><![CDATA[server2-hostname]]></host>
  <port><![CDATA[11211]]></port>
 <persistent><![CDATA[1]]></persistent>
</server>

but whenever I telnet into memcached I get the following output:

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

stats

STAT pid 8383

STAT uptime 2561

STAT time 1366852648

STAT cmd_get 0

STAT cmd_set 0

STAT cmd_flush 0

STAT cmd_touch 0

STAT get_hits 0

STAT get_misses 0

STAT delete_misses 0

STAT delete_hits 0

STAT bytes_read 7

STAT bytes_written 0 ... END

Which implies nothing is being correctly cached.

Anyone any ideas why this might be?

  • 1
    I highly doubt you have that much traffic to warrant three servers purely for Memcache. If you want better performance, look elsewhere. – Ben Lessani - Sonassi Apr 25 '13 at 7:47
1

This problemen is possibly caused due to that you are missing the PHP module for memcache, if this is not installed Magento can not write to the Memcache server.

| improve this answer | |
0

Unless something has changed if you are using memcached you are actually using zend's 2 level cache.

Read app/etc/local.xml.additional to see:

<slow_backend></slow_backend> <!-- database / file (default) - used for 2 levels cache setup, necessary for all shared memory storages -->

That file has all the information you need to specify fast and slow caches. I imagine you are missing some settings and perhaps defaulting to file based cache.

I'll save you a bunch of time and strongly suggest you use redis instead of memcached + database with this extension. https://github.com/colinmollenhour/Cm_Cache_Backend_Redis#readme

2 layer cache means all tags will be stored in the database in core_cache and core_cache_tag because memcached and apc (shared memory caching layers) are simple key/value stores and don't have more complex datatypes they can store. Anytime a cache tag needs to be deleted (which is quite often) it will hit the database to figure out which cache ids belong to a certain cache tag. Then they are deleted in both the slow and fast caches.

If you use Redis instead both tags and cached items are stored in memory.

At my company we used one cache node with lots of memory but not much cpu shared by multiple application servers.

Here is more discussion on the topic: http://www.magentocommerce.com/boards/viewthread/278526/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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