> I'm surprised how little I can find on this topic... references to the > stampeding problem (which is resolved by using get_locked) are about > all the info I can find. Sorry in advance if i'm missing some earlier > discussion - i've searched quite a bit and can't find anything about > it. > > Are people interested in a patch? It really doesn't seem too hard... >
This is actually a decent summary on it: http://code.google.com/p/memcached/wiki/NewProgrammingTricks#Avoiding_stampeding_herd The add lock + soft timeout is the best, since blocking sucks hard. If you must block, Gearman's generally tbe best approach since it has broadcast-response without adding the complexity into memcached. I've seen a number of get/lock/etc implementations to do something like this but none of them feel very complete. Blocking is wrong, add does an extra roundtrip, etc. I did hear a promising idea recently, and we'll talk about it more once I have time to go over the full details. For the meantime you should pick one of the methods above and go nuts :) They work well enough, without polling, and you don't have to modify anything that you or we'll have to support forever.
