Object Caching for high-performance, scalable web applications

Object Caching for high-performance, scalable web applications
by Johann Schleier-Smith, CTO, Tagged LLC
http://corp.tagged.com/obj-cache-zip

– load balancer
– ZP (30 PHP servers)
– memcached (livejournal) (4 servers) (hash based on keys to decide the storage server)
. Oracle 10g RAC

– Low level cache architecture
. Object serialization
. Basic cache operations
– SET($key, $value, [$lifetime])
– GET($key)
– DELETE($key)
– GETANDWAIT($key)
. Advice: pick something

Object Caching: desirable qualities

1. Easy to make new objects cacheable
. Automatic generation of cache key name
. Automatic management of logic that ensures the cache and database stay in synch

2. Ease to use cacheable objects

Problems you aren’t expecting

-getAndWait($key)
. get cache
. if doesn’t exist get it from the database but first check if someone is taking care of that.
. set the cache

-Mid-Air collisions
. to avoid it, read just before you write and compare the timestamp of the cache to check if data was modified after we read it.

-Summary
. Complexity can be managed well by a good object oriented design
. pitfalls can be managed with simple rules