One of the disk cache topics, cache hit and cache miss & the difference between cache and Cache

Source: Internet
Author: User
Tags internet cache
Caching is an important technology in most computers. In fact, all data access in the computer can be seen as a variant of the basic cache concept.

Caching is an important technology in most computers. In fact, all data access in the computer can be seen as a variant of the basic cache concept.

At any time, as long as the system has multiple devices and the performance of these devices is different, there is a possibility of constantly changing the work location from a slow device to a fast device to improve the system performance, this is the basic idea of caching. That is, data is copied from one location to another to make retrieval faster. Although this is a simple concept, it contains many whimsy.

Simply put, the preparation for meeting a certain expected future needs is cache. Cache is a kind of human nature. In order to ensure a sufficient supply of items, you need to plan in advance, and then select a place that can provide the fastest service to store them, this is the so-called reliable material management. It is also the core concept of a computer system. The information needed will be placed in a location that can be accessed as quickly as possible.

The concept of caching can be used on several devices, including:
• High-Speed memory cache faster than normal memory.
• Disk caches that are faster than disk drives and contain memory chips.
• Faster Internet access and Internet cache implemented by disks.

This topic mainly involves disk caching. Generally, the memory used for caching is easy to lose. If the power supply is cut off, the data stored in the cache will be lost. In this sense, the cache memory is a temporary storage, but the cache used by disk devices and subsystems is non-easy to lose storage. Easy to lose (memory) and non-easy to lose storage relationships

This topic is as follows:

Cache hit and cache miss

Differences between cache and Buffer



Cache hit and cache miss

When I/O operations start to retrieve data from the disk cache rather than from the non-Easy loss storage, cache hits (such as disk devices or subsystems) occur. In addition to providing fast responses from memory, cache hits also shorten the distance between I/O paths ..



In another case, although the cache is searched but no data is found, the data must be read from the non-Easy loss storage, which means that the cache is not hit. Because it takes time to search for cache, cache miss increases the time for I/O operations. Cache miss process:


If the cache implementation is not ideal, a high hit rate will be generated, because each cache miss takes additional time, resulting in a reduction in system performance. The term used to describe the relative precision of cache is the cache hit rate. The cache hit rate is the result of dividing the number of cache hits by the total number of I/O requests. For Open System servers, such as UNIX, Windows NT, and NETWare systems, the hit rate generally does not exceed 50%. By the way, large computer systems use different data access methods to achieve a higher hit rate (90% ).

The cache hit rate is calculated as follows:

Differences between cache and Buffer

"Cache" and "Memory" are sometimes interchangeable. However, the memory in the tape drive is usually not cached, but buffered. Although their physical composition is the same, the buffer only acts as a temporary data storage, and data is transmitted from one location or device to another location or device. Generally, buffering is performed under the control of processes with short lifecycles. Once data transmission is completed, these processes immediately release the memory address. A common type of buffer is the f I F O buffer, which is a first-in-first-out structure. Its structure is as follows:


On the other hand, the cache memory is controlled by one or more system algorithms that maintain and manage memory resources for a long time. cached data can be stored in the cache for a long time.

Buffer is often useful for controllers and devices with different coordination mechanisms. This type of buffer can be seen as a converter. The chips on the host I/O controller can transmit data quickly through the I/O path, and their performance can reach the nanosecond level. For an electromechanical storage device such as a disk or tape drive, the data transmission speed can only be within microseconds. Therefore, the device manufacturer puts the buffer memory into the device to reduce access latency and adapt to the performance of the host controller. In this way, the host controller can perform overlapping operations on multiple devices at the same time, and the figure shows this overlap process.



On the other hand, caching uses more complex intelligent technologies to determine what data it will store. Buffer is composed of relatively simple memory chips which are constantly detached and filled, but the disk cache algorithm uses complicated logic processing: the data should be stored in the cache, the data should be withdrawn from the cache. Depending on the application, these cache algorithms vary greatly.

The cache algorithm can be implemented either in the host software or in the storage subsystem or in the host controller. When the cache is implemented by an electronic line, it is called a cache controller. In addition to managing the content in the disk cache memory, it can also control disk operations in the subsystem, the details of these operations are the main topics in the next chapter. The figure shows the disk cache structure with a cache controller and cache memory:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.