0

I'm trying to use: Memcache API and Integration | Drupal.org w/ my Drupal6 and unable to determinate what am I doing wrong as when I hit memcache.php (MEMCACHE INFO) my Cache Usage shows me 100% of Free.

here is my info:

settings.php

$conf['cache_inc'] = './sites/all/modules/contrib/memcache/memcache.inc';
$conf['memcache_servers'] = array(
        '192.168.52.153:11211' => 'default'
);
$conf['memcache_bins'] = array(
        'cache'         => 'default',
        'cache_filter'  => 'default',
        'cache_menu'    => 'default',
        'cache_page'    => 'default',
        'session'       => 'default',
        'users'         => 'default'
);

drush

 Performance and         Memcache (memcache)                                 Module  Enabled        6.x-1.10      
 Performance and         Memcache Admin (memcache_admin)                     Module  Enabled        6.x-1.10      

system

# rpm -q php-pecl-memcache memcached
php-pecl-memcache-3.0.5-4.el6.x86_64
memcached-1.4.4-3.el6.x86_64
# service memcached status
memcached (pid  1482) is running...
# 

SELinux

# getsebool httpd_can_network_connect_db
httpd_can_network_connect_db --> on
# getsebool httpd_can_network_memcache
httpd_can_network_memcache --> on
# 

iptables

# iptables -L -n | grep 11211
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:11211 
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           state NEW udp dpt:11211 
# 

netstat

# netstat -an | grep 11211
tcp        0      0 0.0.0.0:11211               0.0.0.0:*                   LISTEN      
tcp        0      0 :::11211                    :::*                        LISTEN      
udp        0      0 0.0.0.0:11211               0.0.0.0:*                               
udp        0      0 :::11211                    :::*                                    
# 
1
  • if you have a drush, do drush vget |grep cache and post back.
    – awm
    Feb 26, 2014 at 18:46

2 Answers 2

0

First ensure that your cache confiuration are working witout Memcache. Disable memcache modules and enable caching through the UI or in settings.php

$conf['cache_lifetime'] = '1800';
$conf['cache'] = TRUE;

Then check the response headers for anonymous users and look for x-drupal-cache. If it is a hit then you have it working if it's a miss then you must investigate further. You can check the cache_page table in the database table to start with.

If DB caching is working, proceed and add the memache settings and enable the module. Memcache integration only divert db cache to memcache. Once you do this, truncate the cache_page table, then check it after visiting pages as anonymous user. You can also check Memcache statistics. If the table fills up then memcache is not working fine and we will need more info. You can use drush to check the settings. drush vget |grep cache and post back.

Lastly check cache settings at admin/performance/cache if it is set to external you need to change that to normal for Memcache to work.

10
  • I'm using Varnish and caching part IS working, as far as memcache I'm not seeing even one single HIT.
    – alexus
    Feb 26, 2014 at 20:25
  • How did you verify the caching part is working? do you see entries in the cache_page table? are you using the varnish module too? I suggest you disable varnish temporary (provided this is a local env) and debug.
    – awm
    Feb 26, 2014 at 20:37
  • Varnish is working fine, as I'm able to see X-Cache: HIT, so as I said before caching of pages is working fine! That's not an issue) yet memcache IS.
    – alexus
    Feb 26, 2014 at 21:29
  • Varnish is completely different. It is another layer on top. If varnish is working or not does not tell you anything. Bypass varnish and check. Again, do you have the vanish module?
    – awm
    Feb 26, 2014 at 21:55
  • 1
    Sorry for the confusion. Basically you need to verify your db cache (normal mode) works before you add memcache. Memcache works with drupal. In other words every cache_get goes to memcache instead of database (with varnish you don't even get to cache_get. If memcache is not caching, I am inclined tobelieve that caching is not working at all. Lets move this to chat..
    – awm
    Feb 27, 2014 at 20:31
0

Even though I had following line in settings.php

# grep cache_inc XXX.XXX.XXX/settings.php 
$conf['cache_inc'] = './sites/all/modules/contrib/memcache/memcache.inc';
#

something was "off":

# drush -r /var/www/html/current/ -l XXX.XXX.XXX vget cache_inc
No matching variable found.                                                                             [error]
# 

I was able to pinpoint my issue inside of setttings.php file, that caused cache_inc not to loaded into array:

$conf = array(
        'mimedetect_magic' => '/usr/share/misc/magic.mgc',
);

So, I end up changing it to:

$conf['mimedetect_magic'] = '/usr/share/misc/magic.mgc';

And NOW my memcache start working right away! (I'm able to see HITs in MEMCACHE INFO)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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