News Feed
Sections




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

PurpleRockScissors.com:
Avoiding Cache Stampedes with Pseudo-Locks
October 22, 2010 @ 11:14:25

In this quick post to the Purple Rock Scissors blog, there's a suggestion from Rob Zienert about how you can avoid a "cache stampede" on your site's caching tool with the help of a pseudo-lock on the record.

A cache stampede occurs when a cached item expires and multiple clients attempt to repopulate the cache at the same time. Take for example a page cache expires and a few thousand people try to refresh the generated HTML. That's a lot of instant load - hitting the database, re-saving the cache and so-on: it's a lot of extra processing that can bring a website to its knees. One of the many ways to avoid this from happening is to apply pseudo-locks to a cache (and works great with Memcache).

He includes a code snippet example showing how to create the lock using a Zend_Cache setup by looking for a URI-based lock file and setting a "locked" value to true when someone else is using it.

0 comments voice your opinion now!
lock cache memcache zendcache tutorial


blog comments powered by Disqus

Similar Posts

Mike Willbanks' Blog: Zend Framework Cache Backend Libmemcached + Session Cache

DeveloperTutorials.com: How to Install PHP 5 on Linux

Stoyan Stefanov's Blog: Automating HTTPWatch with PHP

Godaddyhostingreview Blog: How to move Magento from Production to Live Server

IBM developerWorks: Use an XML database in PHP and Java applications


Community Events





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


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

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