Whenever we talk about Caching most of the time we talk about read caches which helps in reducing read latency and insulates persistence system, providing a lot of performance optimization in a read-heavy system. But what about write caches ? How can cache help in improved performance for write operations ?

There are some use cases where caching for writes make sense. For example, if we make use of a write-behind cache, we can write to a local cache, and at some later point the data would be flushed to a downstream source, probably the canonical source of data.

This can be useful when:
  1. we have bursts of writes, or
  2. when there is a good chance that the same data will be written multiple times.
When used to buffer and potentially batch writes, write-behind caches can be a useful further performance optimization. Otherwise it would be very inefficient to try to make a backend service call or write the data to the persistence system immediately everytime a data object is updated if multiple updations are done on the same data object rapidly in very short span of time.

With a write-behind cache, if the buffered writes are suitably persistent, even if the downstream service is unavailable we would queue up the writes and send them through when it is available again.

The above content is written by:

Abhishek Dey

Abhishek Dey

A Visionary Software Engineer With A Mission To Empower Every Person & Every Organization On The Planet To Achieve More

Microsoft | University of Florida

View LinkedIn profile

If you have any feedback, please use this form: https://thealgorists.com/Feedback.

Subscribe to Our Youtube Channel

Follow Us On LinkedIn