My MongoDB cache backend adapter for Zend Framework is on Gibhub
I just put my MongoDB cache backend adapter (for Zend Framework 1.11, not for ZF2!) on Github. It's a fork from Stunti (Olivier Bregeras) with some fixes and improvements, so Oliver did the hard work, not me!
You can find it here: Zend_Cache_Backend_Mongo
Details about Zend_Cache can be found here: Zend_Cache
MongoDB is very easy to install on Debian / Ubuntu, it's not more than a
apt-get install mongodb-server
to get the server running, listening (only) to localhost. DBs in MongoDB are created when they are requested, so you don't need to do anything apart from getting my cache backend running. :-)
I did some performance tests with it and compared to Memcache, here are my numbers:
Memcache
inserted 1000 items in 201ms (items/second: 4986) loaded 50000 random items in 5455ms (items/second: 9165) 1000 cache miss requests 109ms (items/second: 9153) Memory peak usage: 6029312 Byte (5.75 MB)
MongoDB
inserted 1000 items in 339ms (items/second: 2946) loaded 50000 random items in 5747ms (items/second: 8700) 1000 cache miss requests 115ms (items/second: 8660) Memory peak usage: 6029312 Byte (5.75 MB)
So MongoDB is a bit slower in writes and has almost the same read performance.
But the big advantage is that MongoDB supports tags which Memcache doesn't, so you can use the MongoDB backend adapter standalone (no two levels cache) with the full feature set (also the data is persistent in MongoDB) and almost the performace of Memcache. You can also use replication or even sharding on MongoDB, but you need to set this up for yourself.
Enjoy!
P.S.: Once I'll find the time I'll describe how MongoDB can do even better as a caching layer that caches your data as complex objects (including arrays) that supports atomic updates (even increments) without the need to read the data first.

















