I am using memcache on high load server with pressflow for Drupal6, varnish and apc and when monitoring memcache I notice that most of time memcache write only.

So I backport memcache-lock.inc from D7 to Drupal 6 and attached file.

What do you think?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

iamer’s picture

Title: Memcahe on high load server write only » Memcache lock implementation for drupal 6
Status: Active » Needs review
FileSize
3.24 KB

Changing title and status since there is a patch to be reviewed.

nnewton’s picture

I've done some initial testing of this and it appears to work. I'm rather surprised that this port is in fact a single line change, but I guess thats a good thing.

-N

Terko’s picture

How I can implement this? This is new file, we need only to copy it in the memcache module folder?

robertDouglass’s picture

@teri@uhaaa.com, you'd include the memcache-lock.inc file in your sites/all/modules/memcache directory, then add
$conf['lock_inc'] = './sites/all/modules/memcache/memcache-lock.inc'; in settings.php.

Note that if this gets committed I'm changing the file to memcache_lock.inc - it drives me nuts that the memcache-session.inc file has a dash instead of underscore.

danielnolde’s picture

Where does this file/variable get used in code?
Having added the line in #4 to settings.php and stored the file of #1 (renamed to memcache-lock.inc, of course), nothing changed with this patch regarding low hit-rates. But i couldn't find any place in the code, where this file/variable is ever used ... so am i missing a small but important information here?

longwave’s picture

It is a memcache implementation that replaces http://api.drupal.org/api/drupal/includes--lock.inc - it should help with contention on high traffic sites, the low hit rate issue is a separate problem being dealt with in #911232: A high percentage of getMulti operations are failing to hit cache.

Jeremy’s picture

Component: Code » Documentation
Status: Needs review » Needs work

I have committed this include file to the D6 project, thanks!

We now need patches to update the documentation. Marking as needs work.

dalin’s picture

This totally did not work for me. I tested in my staging env and everything worked fine. I deployed to production and the site just fell over. Pages mostly would time out, but a few would load. I tried a few times to be sure that this was the problem.

This is unfortunate as semaphore queries are showing in my slow query log. Perhaps something is initiating locks on a regular basis that shouldn't be.

catch’s picture

@dalin - please try the latest dev of memcache - it has some fixes for the lock implementation. Also #969998: Shorter lock_wait() polling time will allow processes to continue quicker once the lock becomes available.