So there is someone who thinks â€œeventual consistency is just cachingâ€. Though I liked the idea of discussing this, I donâ€™t agree with Udiâ€™s views on this.
â€œCacheâ€ is generally used to store data which is more expensive to obtain from the primary location. For example, caching mysql queries is ideal for queries which could take more than fraction of a second to execute. Another example is caching queries to S3, SimpleDB or Googleâ€™s datastore which could cost money and introduce network latency into the mix. Though most applications are built to use such caches, they are also designed to be responsive in absence of caching layer.
The most important difference between â€œcacheâ€ and a â€œdatastoreâ€ is that the dataflow is generally from â€œdatastoreâ€ to â€œcacheâ€ rather than the other way round. Though one could queue data on â€œcacheâ€ first and then update datastore later (for performance reasons) that is not the way one should use it. If you are using â€œcacheâ€ to queue data for slower storage, you are using the wrong product. There are better â€œqueuingâ€ solutions (activemq for example) that can do it for you in a more reliable way.
In most â€œeventually consistentâ€ systems, there is no concept of primary and secondary nodes. Most nodes on such systems are considered equal and have similar performance characteristics.
Since â€œcachingâ€ solutions are designed for speed, they generally donâ€™t have a concept of â€œreplicasâ€ or allow persistence to disk. Synchronizing between replicaâ€™s or to a disk can be expensive and be counter productive which is why its rare to find them on â€œcachingâ€ products. But many â€œeventually consistentâ€ systems do provide a way for developers to request the level of â€œconsistencyâ€ (or disk persistence) desired.
Do you have an opinion on this ? Please share examples if you have seen â€œcachingâ€ layer being used as an â€œeventually consistent datastoreâ€.
Update: Udi mentioned on twitter that â€œwrite through cachesâ€ are eventually consistent. Sure, they are if you are talking about a caching layer on top of a persistent layer. I think there is an argument which could be made that â€œcachesâ€ are eventually consistent, but the reverse may not be true which is what his original post mentioned.