We have some pretty heavy advagg requests with performing compression on the files. I have bypassed compression for some of our heaviest files that were resulting in 60 second fatal errors. We still have a few under 30 seconds though and are getting some pretty intense load storms after a cache clear. We set memcache_stampede_wait_time = 30 and the load storms are barely noticeable now. I see in the documentation that we should also set the stampede_semaphore to at least match the wait_time.

What should we be looking for if we do that? Is this a really bad idea? Can we specify the wait_time for just the cache_advagg cid?

We are on 1.4 and had some white screen issues with 1.6 (upgrading is a future story).

Any advice appreciated. Thank you.

Comments

Elijah Lynn created an issue. See original summary.

elijah lynn’s picture

Just gonna use this thread as some rubber duck debugging:

So I see the default for stampede_semaphore is 15 seconds in the vget(), but the lock_acquire() function $timeout default is 30 if that doesn't get set. So it does appear to be safe on some level if both core and memcache have the lock_acquire($name, $timeout = 30).

I am gathering that means it could take up to 30 seconds to acquire a lock and finally give up and I should watch for that. Given that the memcache default is 15 I wonder if we should try setting the stampede_wait_time to 15 seconds. I should add that we tried 5 seconds first but still had a high stampede after that.

elijah lynn’s picture

Here are the relevant bits from readme.txt:

Only change the following stampede protection tunables if you're sure you know
what you're doing, which requires first reading the memcache.inc code.

The value passed to lock_acquire, defaults to '15':
  $conf['memcache_stampede_semaphore'] = 15;

The value passed to lock_wait, defaults to 5:
  $conf['memcache_stampede_wait_time'] = 5;

The maximum number of calls to lock_wait() due to stampede protection during a
single request, defaults to 3:
  $conf['memcache_stampede_wait_limit'] = 3;

When adjusting these variables, be aware that:
 - there is unlikely to be a good use case for setting wait_time higher
   than stampede_semaphore;
 - wait_time * wait_limit is designed to default to a number less than
   standard web server timeouts (i.e. 15 seconds vs. apache's default of
   30 seconds).
elijah lynn’s picture

I see Drupal core's lock_wait and lock_acquire defaults are both 30 seconds. So I assume that this could be semi-safe to do. It just means we would need to fiddle with the Apache and AWS ELB timeouts to make sure they are both 90 seconds since we would be at 3 attempts * 30 seconds.

elijah lynn’s picture

Status: Active » Fixed

Our testing went well with 15 seconds so I feel safe with just memcache_stampede_wait_time at 15 seconds and leaving the rest alone, our ELB is already at 60 seconds so we are good there.

Hopefully this helps others. Feel free to dump comments here that may be relevant to others in this situation.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.