A design pattern for caching – two tier caching with strong consistency between servers
This is a very interesting and useful pattern in practice. I haven’t seen any books for classic patterns to talk about this. But I think that it should be a classic one for caching. To make it clear I think that it is an old pattern. I do not invent it and I do not discover it. I designed the solution for our problem then I realized that it should be a pattern. I just want to write it down since I didn’t know it is a pattern before designing the solution and the pattern is useful in real world.
- You have a not scalable data source which has relatively stable data (e.g. config or metadata) but the data does change.
- You have many servers (front ends and backends) to access that data. Since the data source is not scalable you need caching.
- You want strong consistency between the servers. i.e. when one server sees a new version of data all other servers need to see the new version or newer version(s). Simple put it is shared caching.