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

  • personally identifiable information (PII)

    Personally identifiable information (PII) is any data that could potentially identify a specific individual.

  • zero-day vulnerability

    A zero-day vulnerability is a security loophole in software, hardware or firmware that threat actors exploit before the vendors ...

  • DNS attack

    A DNS attack is an exploit in which an attacker takes advantage of vulnerabilities in the domain name system.

  • data collection

    Data collection is the process of gathering data for use in business decision-making, strategic planning, research and other ...

  • chief trust officer

    A chief trust officer (CTrO) in the IT industry is an executive job title given to the person responsible for building confidence...

  • green IT (green information technology)

    Green IT (green information technology) is the practice of creating and using environmentally sustainable computing resources.

  • 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
  • digital marketing

    Digital marketing is the promotion and marketing of goods and services to consumers through digital channels and electronic ...

  • contact center schedule adherence

    Contact center schedule adherence is a standard metric used in business contact centers to determine whether contact center ...

  • customer retention

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