Timo Ewalds timo at tzc.com
Sun Dec 5 17:57:37 PST 2004

I run a large site that is using memcached to a small degree at the 
moment. Really it only caches things that are used on almost every page, 
not things that are specific to a single page or to a single user. As 
the database becomes the bottleneck instead of the webservers as it is 
right now, I'll need to drop SELECTs and UPDATEs. Caching things that 
are specific to individual pages will help drop the selects, but won't 
drop the updates. I do alot of updates of the form UPDATE ... SET count 
= count + 1 WHERE ... for stats and other logging, that could be 
combined into single queries over time. The various hit counters, banner 
view counters, etc, could all be done in the form of incr some memcached 
entry, then once a minute zero them and do a single query of the form 
UPDATE ... SET count = count + (sum of all from the memcached entry) 
WHERE ..., greatly reducing the UPDATE query count. How hard would it be 
to create a command similar to incr/decr that would just reset that key 
to 0 and return the old value?

Does anyone have a better solution to this problem, memcached related or 


More information about the memcached mailing list