One of the disk cache topics cache hit and cache misses & cache and Buffer differences _mssql

Source: Internet
Author: User
Tags volatile
Whenever the system comes with multiple devices, and the performance of these devices varies, there is the possibility of changing the work place from slow to fast devices to improve system performance, which is the basic idea of caching. That is, data is copied from one location to another, making it faster to retrieve. Although this is a simple concept, but it contains a lot of fantastic thoughts.

Simply put, the preparation that is needed to meet some expected future needs to be cached. Caching is a human nature, in order to ensure adequate supply of goods, the need to plan ahead, and then choose a place to provide the fastest service, store them, which is called reliable material management. It is also the core concept of the computer system, the information to be needed in the fastest access to the place, its description as shown.

The concept of caching can be used with several devices, including:
• High-speed memory cache that is faster than normal memory.
• A disk cache of memory chips that is faster than disk drives.
• Faster, disk-implemented Internet caching than access over the Internet.

This topic is primarily concerned with disk caching. Typically, the memory used for caching is volatile, and if the power is cut off, the contents of the data stored in the cache will be lost. In this sense, cached memory is a temporary storage, but the cache used by disk devices and subsystems is non-volatile. volatile (memory) and non-volatile storage relationships as shown in the figure

This topic is as follows:

Cache hits and cache misses

The difference between caching and buffering



Cache hits and cache misses

Cache hits occur when I/O operations start retrieving data from the disk cache rather than from nonvolatile storage, such as a disk device or subsystem. In addition to providing a quick response from memory, a cache hit shortens the distance from the I/O path. As shown in the figure.



Alternatively, although the cache was searched but no data was found, the data must be read from nonvolatile storage, which is the cache misses. Cache misses increase the time of I/O operation because it takes time to search the cache. The cache misses work process as shown in the figure:


If the cache implementation is not ideal, it will produce a high percentage of misses, because each cache misses will take additional time, resulting in system performance degradation. The term used to describe the relative accuracy of the cache is called the cache hit ratio, which is the result of the cache hit count divided by the total I/O requests. For open systems servers, such as UNIX, Win NT, and NetWare systems, the hit rate is usually no more than 50. Incidentally, because large computer systems use different data access methods, it can reach a higher hit rate (90%).

The cache hit ratio is calculated as follows:

The difference between caching and buffering

"Caching" and "memory" can sometimes be used interchangeably. However, memory in a tape drive is usually not a cache, but a buffer. Although their physical composition is the same, buffering only acts as a temporary storage of data, from one location or device to another location or device. Generally, buffering works under a relatively short lifetime process, and once the data has been transferred, the processes will immediately release the memory address. A common type of buffer is the F I f o buffer, which is an advanced first-out structure, as shown in the diagram:


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

Buffering can often be useful in coordinating the work of controllers and devices with differentiated performance, and the buffering of this approach is considered to be some kind of converter. The chips on the host I/O controller can quickly transmit data through the I/O path, and their performance can reach nanoseconds, while for a class of electromechanical storage devices such as disk and tape drives, the data can be transmitted only in microseconds. Therefore, the device manufacturer puts the buffer memory into the device to reduce the access latency to fit the host controller's performance. This allows the host controller to perform overlapping operations on multiple devices simultaneously, as shown in the diagram.



On the other hand, caching uses more sophisticated intelligent technology to determine what data it will store. Buffering is made up of relatively simple memory chips, which are constantly being unloaded and populated, but the disk caching algorithm uses complex logic: those data should be stored in the cache, and those data should be withdrawn from the cache. Depending on the application, these caching algorithms vary greatly.

The caching 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 a single electronic circuit, it is called a caching controller, which, in addition to managing the contents of the disk cache memory, controls disk operations in the subsystem, and the details of these operations are the main topics in the next chapter. Figure shows the disk cache structure with a cache controller and cached memory:


Before the community released a series of articles, and later because of picture problems, a lot of articles can not be seen, friends have reacted to this problem, now released, continuous updates, please top up: http://www.itpub.net/thread-1703788-1-1.html

Download on-demand package download http://www.jb51.net/books/59793.html

Author: Xiao Yang, Yanyang

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.