News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Dave Marshall's Blog:
Defending against Cache Stampedes
January 13, 2012 @ 13:13:08

Dave Marshall has a new post to his blog showing one method for defending against cache stampedes from assaulting your caching servers and (possibly) bringing them down.

I've recently had a problem with a rather large operation (that could probably be optimised considerably, but nevermind), where by if the cached result of the operation expired, several web server threads would attempt the operation, causing some major headaches for our database and web servers. This is something I've come across before, and is commonly(?) known as a Cache Stampede. This is bad, this post describes the basics of what I've done to deal with it.

His example uses a Zend_Cache interface to Memecache, but it could be applied in other places too. His method uses a binary semaphore to check and see if there's a "lock" and sleep for a bit before checking again. Sample code is included showing how to create this system and how to refresh the data with a new expiration on a cache miss.

0 comments voice your opinion now!
cache stampede zendcache tutorial binary semaphore miss prevention


blog comments powered by Disqus

Similar Posts

NetTuts.com: Build Ajax Data Grids with CodeIgniter and jQuery

Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 11)

Chris Jones: Quick Debugging of PHP Scripts in Emacs with Geben and Xdebug

Wes Shell's Blog: Encapsulation in PHP

WebReference.com: The Building Blocks: Data Types, Literals, Variables, and Constants - Part 2


Community Events





Don't see your event here?
Let us know!


code framework interview community developer configure threedevsandamaybe library laravel application api language podcast series list project introduction release bugfix wordpress

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework