Array card cache RAID Cache

Introduction

Disk array (Redundant Arrays of Independent Drives, RAID) means "an array of independent disks with redundancy capabilities".

A storage chip on the circuit board of the RAID card has extremely fast access speed compared with the hard disk platter, and is actually a buffer between the relatively low-speed hard disk platter and the relatively high-speed external device (such as memory). The size and speed of the cache are important factors directly related to the actual transmission speed of the RAID card. A large cache can greatly improve the data hit rate and thus improve the overall performance of the RAID card. Most RAID cards are equipped with a certain amount of memory used as a cache. Different RAID cards are equipped with different memory capacities when they leave the factory, generally ranging from a few megabytes to hundreds of megabytes, depending on the application range of the disk array product.

RAID structure

insert image description here

  • The RAID processor is a PCI slave device that accepts and executes commands from the system. At the same time, occupying the PCI interrupt means that the SCSI disk subsystem makes an interrupt request to the system, requests to occupy the PCI bus, and returns a response to the system command, such as transporting data on the SCSI hard disk.
  • The SCSI controller is a unified expansion interface for connecting disk devices.
  • There is also cache (CACHE MEMORY) in RAID, which provides cache data, read-ahead (Read-ahead) and write-back (Write-back) functions to improve disk IO performance.
  • XOR chip: It is specially used to calculate the verification data of RAID 3, 5, 6 and other verification types.

RAID Cache

Array card caching is a process in which the array card first transfers data to the cache, and then exchanges data between the cache and the external data bus. It actually refers to the buffer between the relatively low-speed hard disk platter and the relatively high-speed external device.

The main function of the array card cache is to speed up the data read and write speed, improve the utility of the disk, avoid unnecessary waiting time, reduce the delay caused by the operation, improve the system performance and get a better response time, so the role of the array card cache is very large.

  • Write Through and Write Back are two ways to use the array card Cache, also known as write through and write back.
  • Write Through: The system's disk write operation does not use the array card's Cache, but directly interacts with the disk for data. The write operation does not use the cache at all, and the data is always written directly to the disk, which affects the write performance.
  • Write Back (Write Cache) Write back: Use the array Cache as the setter between the system and the disk. The system first transfers the data to the Cache, and then the Cache transfers the data to the disk; write cache. From the application point of view, it is much faster than waiting for the disk write operation to complete. Therefore, write performance can be improved. The controller writes the data in the cache that has not been written to the disk to the disk.
  • The configuration in the production environment should be configured according to the specific business type and environment. For example, if there is an external UPS power supply, choose Write Back; Choose Write Through.
  • Write Back with BBU: This is an optional option when the array card is equipped with a Battery Backup module. Its function is to protect the data in the Cache when the system is powered off, and to avoid the loss of intermediate data caused by a power failure.

Note
On the surface, the Write Cache method has better read and write performance than the Write Through method, but it also depends on the disk access method and disk load.
The Write Back (Write Cache) method is usually faster when the disk load is light.
When the load is heavy, whenever the data is written to the cache, it must be written to the disk immediately to release the cache to save the new data to be written. At this time, if the data is directly written to the disk, the controller will run at a faster speed . Therefore, when the load is heavy, writing data to the cache first will reduce the throughput.

To put it simply, Write Back (Write Cache) is a method of writing to the cache first and then writing to the disk. If the I/O is busy and the CPU load is high, the efficiency will be lower than writing directly to the disk.

Cache Policy Cache Policy

  • No-Read-Ahead (non-read-ahead) specifies that the controller does not use read-ahead mode on the current logical drive.
  • Read-ahead specifies that the controller uses read-ahead on the current logical drive.
  • Adaptive (adaptive) specifies that if the last two disk accesses occur in consecutive sectors, the controller begins to use Read-ahead (read-ahead). If all read requests are random, the algorithm returns to No-Read-Ahead (non-read-ahead), but it is still necessary to determine whether all read requests are likely to be operated sequentially.
    Cache Policy Appropriate for reading on a specific logical drive. It does not affect the Read ahead (read ahead) cache.
  • Cached I/O specifies that all read data is cached in cache memory.
  • Direct I/O specifies that read data is not cached in cache memory. This is the default setting. It does not override cache policy settings. Data is transferred to the cache and the host simultaneously. If the same block of data is read again, then read from the cache memory.
    Write Policy Sets the cache method to write back or write through.
  • In Write-Back (Write Cache) caching, when the controller cache has received all the data in a transaction, the controller signals the completion of the data transfer to the host.
  • In a Write-Through cache, the controller signals the completion of the data transfer to the host when the disk subsystem has received all the data in a transaction.
    Write-through (write-through) cache has the advantage of data security compared with Write-back (write-back) cache, but Write-back (write-back) cache has performance advantages over Write-through (write-through) The advantages.

RAID battery

The role of the RAID battery:

  • It is used to protect the data in the Cache when the system is powered off, avoiding the loss of intermediate data caused by the power off.
  • Before replacing the RAID card battery, although the server has been offline and no data is written, there is still some data stored in the RAID cache and not written to the hard disk; but generally, when the RAID card battery is broken, the RAID card will automatically save Writing cache (that is, write back) is disabled and changed to write through mode, which will reduce the writing performance to a certain extent, but it will not affect data security.
  • If the RAID battery and a certain hard disk fail at the same time, you should replace the RAID card battery first, and then replace the failed hard disk after the server restarts successfully and the RAID card works normally, so as to ensure data security to the greatest extent.

Guess you like

Origin blog.csdn.net/qq_37432174/article/details/131038596