Browse Definitions :


What is write-through in storage?

Write-through is a storage method in which data is written into the cache and the corresponding main memory location at the same time.

With write-through caching, the computer's central processing unit writes data to its local processor cache and holds off on executing the corresponding application until the same data is also successfully written to the associated storage resource, which is usually main memory -- RAM -- or disk storage. The processor maintains high-speed access to cached data, while ensuring complete consistency between cache and data storage.

How does write-through cache work?

The concept of caching is well established in computer design as a means of accelerating processor and computer performance by placing frequently used data in a small amount of extremely fast memory -- the cache -- which is placed adjacent to the processor. This allows the processor to find often-used data much faster than accessing the same data from disk or even from much faster main memory. Modern processors frequently work with several levels of cache, such as first-level, or L1, cache or second-level, or L2, cache.

When a processor writes or outputs data, that data is first placed in a cache. The cache contents are then written to main memory or disk using any of the following three major algorithms or policies:

  • Write-through cache. With a write-through caching policy, the system's processor writes data to the cache first and then immediately copies that new cache data to the corresponding memory or disk. The application that's working to produce this data holds execution until the new data writes to storage are completed. Write-through caching ensures data is always consistent between cache and storage, though application performance could see a slight penalty because the application must wait for longer input/output operations to memory or even to disk.
  • Write-back cache. With a write-back caching policy, the processor writes data to the cache first, and then application execution is allowed to continue before the cached data is copied to main memory or disk. Cache contents are copied to storage later as a background task -- such as during idle processor cycles. This allows the processor to continue working on the application sooner and helps to improve application performance. However, this also means there could be brief time periods when application data in cache differs from data in storage, which raises a possibility of application data loss in the event of application disruption or crashes.
  • Write-around cache. A write-around caching policy doesn't use cache and writes data directly to storage assets such as main memory or even disk. This is sometimes preferred when an application must move large amounts of data that aren't well suited to cache. Write-around caching isn't appropriate for all applications, and not all applications benefit from this technique.
Different caching methods and their strengths.
This chart illustrates how write-through caching compares with write-back and write-around caching.

What is write-through cache used for?

Write-through cache is a caching technique or policy that controls how a processor and its local cache interact with other principal storage assets within the computer, such as RAM or disk -- whether solid-state drive or traditional hard disk drive -- and some storage-centric enterprise applications such as Structured Query Language, or SQL.

Write-through cache, as the name implies, writes data to the processor's local cache first and then immediately writes that cached data through to the final storage target in memory or disk. The application's execution halts until the data is successfully written to the final storage asset.

The purpose of write-through cache is to achieve data consistency between the processor's cache and application storage. Write-through caching ensures data in cache and storage is always identical, so there's no chance of data loss or corruption if the application crashes or the computer system fails before cache is written, which might happen with write-back caching. Write-through caching is often the preferred technique for critical computing tasks that can't tolerate the risk of data loss.

However, write-through caching holds application execution until new cache data is committed to storage. This can impose a slight penalty on effective or apparent application performance.

Write-through vs. write-back

Both write-through and write-back caching policies define the way that data is moved from the cache to major storage such as memory or disk.

Write-through cache immediately copies new cache data to corresponding storage in main memory or disk. This ensures data is always consistent between cache and storage before application execution is allowed to continue. Write-through cache is considered the safest form of caching because no data is lost or corrupted if the application or system fails. But this comes at the expense of application performance.

By comparison, write-back cache allows application execution to continue before cached data is committed to storage. Cached data is copied to storage at certain intervals or as a background task. This allows for better application performance, but it also poses a risk of data loss or corruption if the application or system should fail before cached data is committed to storage.

What are the benefits and disadvantages of write-through cache?

As a general concept, processor cache often helps to enhance application performance by allowing a processor to access recent data from cache far faster than it could access that same data from other storage resources such as main memory or disk. However, for cache to be helpful, the application needs the processor to read the same cached data often -- otherwise there's no need for cache.

Write-through cache provides this processor performance benefit by writing data to a cache first. However, the new data placed into the cache is also committed or copied to the corresponding location in main memory or disk before the application's execution is allowed to continue. This ensures the data in cache and storage is always consistent and there's no data lost or corrupted if the application fails for any reason. Write-through cache is usually a preferred technique for important applications that can't tolerate the risk of data loss.

However, the write-through process must halt application execution until the data is fully committed to storage. While this might only take a matter of milliseconds, frequent caching results in frequent pauses, and this can reduce the application's apparent performance. Human users typically won't be able to discern any impact of caching policies on application performance, but performance-centric applications might not be appropriate for write-through caching.

Learn how cloud storage caching works and the different types of caching appliances.

This was last updated in September 2023

Continue Reading About write-through

  • NBASE-T Ethernet

    NBASE-T Ethernet is an IEEE standard and Ethernet-signaling technology that enables existing twisted-pair copper cabling to ...

  • SD-WAN security

    SD-WAN security refers to the practices, protocols and technologies protecting data and resources transmitted across ...

  • net neutrality

    Net neutrality is the concept of an open, equal internet for everyone, regardless of content consumed or the device, application ...

  • privacy impact assessment (PIA)

    A privacy impact assessment (PIA) is a method for identifying and assessing privacy risks throughout the development lifecycle of...

  • proof of concept (PoC) exploit

    A proof of concept (PoC) exploit is a nonharmful attack against a computer or network. PoC exploits are not meant to cause harm, ...

  • virtual firewall

    A virtual firewall is a firewall device or service that provides network traffic filtering and monitoring for virtual machines (...

  • diversity, equity and inclusion (DEI)

    Diversity, equity and inclusion is a term used to describe policies and programs that promote the representation and ...

  • ADP Mobile Solutions

    ADP Mobile Solutions is a self-service mobile app that enables employees to access work records such as pay, schedules, timecards...

  • director of employee engagement

    Director of employee engagement is one of the job titles for a human resources (HR) manager who is responsible for an ...

Customer Experience
  • customer retention

    Customer retention is a metric that measures customer loyalty, or an organization's ability to retain customers over time.

  • virtual agent

    A virtual agent -- sometimes called an intelligent virtual agent (IVA) -- is a software program or cloud service that uses ...

  • chatbot

    A chatbot is a software or computer program that simulates human conversation or "chatter" through text or voice interactions.