Memcache not working?

vacilando - October 7, 2009 - 19:35
Project:Cache Router
Version:6.x-1.0-rc1
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Issue tags:memcache
Description

Cache Router works for me with the 'file' engine, but it fails completely with the 'memcache' engine.

This is in my settings.php:

$conf['cache_inc'] = './sites/all/modules/cacherouter/cacherouter.inc';
$conf['cacherouter'] = array(
  'default' => array(
    'engine' => 'memcache',
    'server' => array('MYIP:MYPORT'),
    'shared' => TRUE,
    'prefix' => 'MYPREFIX',
    'path' => 'sites/MYSITE.TLD/files/cacherouter',
    'static' => FALSE,
    'fast_cache' => FALSE,
  ),
);

I know memcached works because when I run a test script, I can see results using the PECL memcache.php monitor (here). Also when I try using the other Drupal module http://drupal.org/project/memcache, the monitor is showing growing cache, hits and misses.

But when I turn on Cache Router with the above settings, the site does not respond at all, and there are absolutely no cache records in the memcache monitor. I looked at the native Drupal MySQL cache tables - but those are not filling in either. It's as if cache was not being written at all.

I looked at PHP error log, but there is nothing pointing to any problem within Cache Router or elsewhere.

What to do? How do I test what's wrong?

#1

vacilando - October 7, 2009 - 20:07

There is something in PHP log after all:

[07-Oct-2009 14:42:31] PHP Fatal error:  Maximum execution time of 120 seconds exceeded in /MYPATH/sites/all/modules/cacherouter/engines/memcache.php on line 185

A problem with lock()? Why?

#2

intoxination - October 23, 2009 - 14:07

If your memcache isn't running on localhost:11211 then it won't connect. That's from either a typo in the __construct or in the readme. I just spent about 30 minutes figuring this out myself, and here is what I found:

'server' => array('MYIP:MYPORT'),

Change that to:

'servers' => array('MYIP:MYPORT'),

And everything works right.

#3

vacilando - October 24, 2009 - 08:38

Tried it. Indeed, when I change 'server' to 'servers', pages do start rendering again. However, there is nothing read or written to memcache; the monitor remains empty.

(Btw, in absence of a working solution for memcache with Cache Router, I have switched to http://drupal.org/project/memcache and I must say it works very well. On top of replacing Drupal's usual cache, it also provides session caching. However, it still remains unclear which module is better for sites that only use memcache caching -- watch this: #338906: Memcache API versus Cache Router.)

#4

Bensbury - November 12, 2009 - 05:50

There is definitely something fruity going on.

I was given the mission to reduce the wcpu hit on the site I made.
My CTO said memcache was the way to go and so I set up cache-route to test it out.

Had trouble getting it to work, but when I flip on memcache in the settings the wcpu goes nuts.

Normally the httpd command is clocking in a 6-9% result on the wcpu
I've been told to reduce it to 4%

Flipping on DB makes no discernable difference.

Flipping on memcache, it appears in the processes at about 2-4% which is cool except it is accompanied by a whacking 10 - 20% httpd call.

And just now memcache also rocks in with a 20% cpu hits accompanied by a 16% httpd call.
While memcache is registering, it looks like it brings with it an accompanying process.

Now granted I know zip all about performance tuning, but from just looking at the cpu process on the server it shows big hits made when memcache is turned on.

Can someone educate me?

#5

bennos - November 20, 2009 - 17:02

this is your sight. can you make some test, with apachebench or something like that.

#6

Bensbury - November 26, 2009 - 12:50
Status:active» closed

I fixed it.
It was a wrong reference to memcache which caused it to flip out.

I just didn't know when memcache was working, it only showed up as taking effect when it wasn't lol.

#7

Bensbury - November 26, 2009 - 12:51
Status:closed» active

Sorry, didn't mean to close that.

 
 

Drupal is a registered trademark of Dries Buytaert.