I'm building an application with multiple server involved. (4 servers where each one has a database and a webserver. 1 master database and 3 slaves + one load balancer)
There is several approach to enable caching. Right now it's fairly simple and not efficient at all. All the caching is done on an NFS partition share between all servers. NFS is the bottleneck in the architecture.
- I have several ideas implement caching. It can be done on a server level (local file system) but the problem is to invalidate a cache file when the content has been update on all server : It can be done by having a small cache lifetime (not efficient because the cache will be refresh sooner that it should be most of the time)
- It can also be done by a messaging sytem (XMPP for example) where each server communicate with each other. The server responsible for the invalidation of the cache send a request to all the other to let them know that the cache has been invalidated. Latency is probably bigger (take more time for everybody to know that the cache has been invalidated) but my application doesn't require atomic cache invalidation.
- Third approach is to use a cloud system to store the cache (like CouchDB) but I have no idea of the performance for this one. Is it faster than using a SQL database?
I planned to use Zend Framework but I don't think it's really relevant (except that some package probably exists in other Framework to deal with XMPP, CouchDB)
Requirements: Persistent cache (if a server restart, the cache shouldn't be lost to avoid bringing down the server while re-creating the cache)