---
title: "Can you explain the concept of cache coherency and how it applies to server-side caching?"  
description: "Can you explain the concept of cache coherency and how it applies to server-side caching?"  
author: "Revati S Misra"  
published: 2023-05-24  
updated: 2023-05-25  
canonical: https://www.mindstick.com/forum/158484/can-you-explain-the-concept-of-cache-coherency-and-how-it-applies-to-server-side-caching  
category: "cache"  
tags: ["server side validation", "cache", "server"]  
reading_time: 3 minutes  

---

# Can you explain the concept of cache coherency and how it applies to server-side caching?

Can you [explain the concept](https://www.mindstick.com/forum/159605/explain-the-concept-of-unique-key-violation-error) of [cache](https://www.mindstick.com/blog/222/clearing-cache-in-asp-dot-net) coherency and how it applies to [server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over)-side [caching](https://www.mindstick.com/blog/43/caching-in-asp-dot-net)?

## Replies

### Reply by Aryan Kumar

Cache coherency is a fundamental [concept](https://www.mindstick.com/blog/79/routing-concept-in-dot-net) in computer architecture and refers to the consistency of data stored in various caches that are part of a multilevel cache hierarchy. As part of server-side caching, cache coherency ensures that data cached on different servers is consistent and up-to-date.

Server-side caching allows multiple servers to cache copies of the same data, improving performance and reducing the load on backend systems. However, when multiple copies of data are cached on different servers, maintaining cache coherence is important. Cache inconsistency can lead to inconsistencies and clients being served stale or conflicting data. Here's an overview of how cache coherence applies to server-side caching.

1. **Data synchronization:**\ When a client requests data from the server, the server first checks the cache. If the requested data is not found, the server can retrieve the data from the backend system and cache it. However, when multiple servers cache the same data, they need a mechanism to keep them updated and in sync.
2. **Cache Invalidation:**\ When a server modifies or updates certain data, it must notify other servers that cache copies of the same data to invalidate their caches. This can be done through cache-busting messages that prompt other servers to delete or update their cached copies. Cache invalidation strategy:\ There are several strategies for dealing with cache invalidation.

A common approach is:

1. **carbon copy:**\ With this strategy, whenever the server updates data, all caches containing copies of that data are immediately updated. This approach ensures cache coherence, but can introduce additional delays on writes.
2. **Write a reply:**\ With this strategy, the server updates its local cache immediately and defers updating other caches until needed. This approach improves write performance, but can introduce temporary inconsistencies until the caches are synchronized.
3. **Cache verification:**\ Instead of invalidating the cache immediately on update, the server can use validation techniques such as her ETag and Last-Modified headers. When the server receives a request for cached data, it verifies the freshness of the data against its original source. If the data is still valid, the server can serve it without requiring invalidation.
4. **Time-based invalidation:**\ A server can assign a specific expiration or duration to cached data. Once the expiration time is reached, the cache is invalidated and subsequent requests will trigger a refetch from the source.
5. **Integrity log:**\ Distributed systems with multiple cache servers use cache coherence protocols such as MESI (Modified, Exclusive, Shared, Invalid) and MOESI (Modified, Owned, Exclusive, Shared, Invalid) protocols. These logs help maintain consistency and coordinate cache updates across different servers.

Achieving cache coherency in server-side caches requires careful design and implementation to ensure data consistency and minimize inconsistencies. The choice of cache invalidation strategy and consistency protocol depends on factors such as performance requirements, data volatility, and application and cache infrastructure specifications.


---

Original Source: https://www.mindstick.com/forum/158484/can-you-explain-the-concept-of-cache-coherency-and-how-it-applies-to-server-side-caching

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
