Disk Array Principle
1. Why do you need a disk array?
How to increase the speed of the disk, how to prevent data from being lost due to disk failure and how to use disk space, has been the trouble of computer professionals and users; the price of large-capacity disks is very expensive, forming the user A big burden. The production of disk array technology solves these issues.
In the past decade, the processing speed of the CPU has increased by 50 times. The access speed of memory has also increased significantly, and the data storage device-mainly the disk (hard disk) - only increased access speed Three, four times, forming a bottleneck of computer systems, pulling the overall performance of the computer system (THROUGH PUT), if it is not effective to improve the disk access speed, the imbalance between CPU, memory, and disk will make CPU and memory Improvement formation waste.
There are two main modes of improving disk access speed. First, Disk Cache Controller, which will have the data read from the disk to reduce the number of disk access, and the read and write of the data is carried out in the middle of the memory. Increase the speed of access, and if the data to be read is not in the memory, or when you want to write data to disk, do disk access action. In this way, in the single-tasking envioronment, such as DOS, there is a good performance for a large amount of data (small and frequent access, but Multi-Tasking) The environment is under the environment (because the action of the SWApping) or the database (Database) is accessed (because each record is small), its performance cannot be displayed. This form is without any security.
The second is the technology of using disk arrays. The disk array is a plurality of disks constitute an array, as a single disk is used, which stores the data in different disks in different disks, ands the data, and the relevant disk in the array has a significant reduction. The access time of the data, and there is a better spatial utilization. Different techniques utilized by disk arrays, called RAID Level, different Level for different systems and applications to solve data security issues.
Generally high-performance disk arrays are reached in hardware, further connecting disk to control and disk arrays in a controller (RAID Controler or Control Card, resolving people for different users) Four requirements: (1) Increase access speed, (2) Fault Tolerance, ie security (3) Effective utilization disk space; (4) to balance the performance difference between CPU, memory, and disk, improve computers Overall workability.
2. Disk array principle
Different techniques for different applications in disk arrays, called RAID Level, RAID is an abbreviation for Redundent Array Of INExpensive Disks, and each Level represents a technology, currently recognized standards in the industry RAID 0 ~ RAID 5. This Level does not mean that the technology is high, Level 5 is not higher than Level 3, the Level 1 is not less than Level 4, as for the product of the RAID Level, pure optiming environments and applications (Application) and is determined to have a inevitable relationship with the level of Level. RAID 0 and RAID 1 Suitable for PC and PC-related systems such as small network servers and workstations that require high disk capacity and fast disk access, is relatively inexpensive; RAID 3 and RAID 4 are suitable for large computers and images , CAD / CAM and other processing; RAID 5 is used for OLTP, because there is an urgent need for financial institutions and large data processing centers, there are more and more famous, RAID 2 is used, others such as RAID 6, RAID 7, and even RAID 10, etc., all of which make each of the manufacturers, there is no consistent standard, which is not explained here. To introduce each RAID Level, let's take a look at two basic techniques to form a disk array:
Disk Spo SPANNING:
Translated as a disk extension, it can exactly represent the meaning of DISK spanning this technology. As shown in the figure disk array controller, four disks are connected, and the four disks form an array (ARRAY), and the controller of the disk array is a single disk, such as the DOS environment. C: disk. This is the meaning of Disk spanning because the user does not have to plan the distribution of data in each disk, and improve the usage rate of the disk space without planning the small capacity disk. And make the disk capacity can be almost unlimited; and each disk is taking the action, which is more fast than a single disk. Obviously, there is a variety of techniques of the formation of this array to produce RAID. Disk or data segmentation: DISK Striping Or Data Striping:
Since the disk array is considering multiple disks of the same array as a single virtual disk, its data is stored in a block array in the block array in the manner of block or segment, and the data is segmented as needed. The first disk started, put it until the last disk returns to the first disk until the data distribution is completed. As for the segmented size, some systems or is most efficient in 1kb, or 4KB, or at 6kb, or even 4MB or 8MB, unless the data is less than one sector (Sector, ie 521bytes), otherwise Its segmentation should be a multiple of 512byte. Because the read and write of the disk is in units of sectors, if the data is less than 512bytes, the system reads the sector, it is also possible to make a combination or group (view or write) action, waste time. From the figure above, we can see that data can be read from different disks, and the entire array can read and write at the same time. Therefore, the data segmentation has the best efficiency, theoretically, I originally read one contains The time required for four segments = (TRANFER TIME Data of Disk) X4, now you can complete it.
If the number of the disk is represented by N, R represents reading, W represents writing, and S means a space, the performance of the data segment is: r: n (can read all disks simultaneously) W: N (can be written at the same time Enter all disks) S: N (available all disks, and have the best usage)
Disk striping is also known as RAID 0, many people think that RAID 0 is nothing, in fact, this is a very wrong concept, because RAID 0 has the highest efficiency of the output of the disk. The disk array has more efficient reasons in addition to the data segmentation, it can perform multiple output requirements simultaneously, because each disk in the array can operate independently, segmented in different disks, different disks At the same time, it is read and written, and it is possible to move the memory and disk for parallel access, but only hardware disk arrays have this performance performance.
From the above two points, we can see that Disk spanning defines the basic form of RAID, providing a cheap, flexible, high-performance system structure, and Disk striping solves the data access efficiency and disk utilization problem, RAID 1 To RAID 5 is a scheme for providing disk security on this basis.
RAID 1
RAID 1 is a technology using disk mirroring. Disk mirroring applications are used in many systems before RAID 1. It is the way to add an additional backup disk outside the working disk (the backup disk), the data stored in the two disks is exactly the same, data Write a backup disk while writing to work disks. Disk mirroring is not an RAID 1, such as Novell NetWare also provides a function of providing disk mirroring, but does not mean that NetWare has the function of RAID 1. General disk mirroring and RAID 1 have two largest differences:
RAID 1 No working disk and backup disk, multiple disks can operate simultaneously and overlapping the function of overlaping, or even different mirror disks can operate simultaneously, this is an optimized way , Called load-balance. For example, there are multiple users to read data at the same time, and the system can simultaneously drive mirror-mounted disks while reading data to mitigate the load of the system, add I / O performance.
The disk of RAID 1 forms an array in a manner extension, and the data is stored in a data segment, so it is almost the same performance as RAID 0 when reading. From the RAID structure, you can see the difference between RAID 1 and general disk mirroring.
The picture below is RAID 1, each data is stored two copies: From the figure, you can see: R: N (all disk can be read at the same time) W: N / 2 (number of copies of disk) S: N / 2 ( Utilization can use all disks when reading data, give full play to the advantages of the data segment; when writing data, because there is a backup, it is necessary to write two disks, the efficiency is N / 2, the usage rate of disk space There is only half of all disks.
Many people think that RAID 1 should add an additional disk to form a waste and not optimistic about RAID 1. In fact, the disk is getting cheaper, and it is not necessarily burden, and the RAID 1 has the best fault tolerance. The efficiency It is also best in addition to RAID 0.
In the technical display of the disk array, from RAID 1 to RAID 5, it means that the system can continue to work without stopping, and the system can continue to work without stopping, and the system can still be used. The fault tolerance indicates that even if the disk is faulty, the data can remain intact, allowing the system to access the correct data, and the SCSI disk array is more able to switch the disk in the work and automatically rebuild the fault disk data. The disk array can be fault tolerant and non-stop, because it has redundant disk space deliberately, this is the meaning of Redundant.
RAID 2
RAID 2 is a bit (BIT) or block (block) to join the Haiming code Hamming Code, which is written in the disk array to each disk, and the address (address) is the same, that is In each disk, its data is in the same track (Cylinder or TRACK) and sector. The design of RAID 2 is the technology of Spindle Synchronize. When accessing data, the entire disk array works together, and there is a parallel access in the same position of each of the disks, so there is the best access time (Accesstime) The bus (BUS) is a special design that transmits the accessible data in parallel with large bandwidth, so it has the best transmission time. Access applications in large files, RAID 2 has the best performance, but if the file is too small, it will pull it down because the access of the disk is in the sector, and the access of RAID 2 is all disks. Parallel action, and is the access to the unit element, so the amount of data smaller than one sector will make its performance greatly. RAID 2 is designed to use computers that require continuous and large amounts of data, such as large computers, workstation, Workstation, etc., and does not apply to a general multi-user environment, web server (Network Server), small machine or PC.
RAID 2 secures the technology of Memory Array, using multiple additional disk-bit correction and dunk-bit detection; as for how many additional disks, The methods and structures they are used, such as eight arrays of eight data disks may require three additional disks, with a high-end array of thirty data disks. Seven additional disks may require seven additional disks.
RAID 3
RAID 3's data storage and access mode is the same as RAID 2, but in terms of security, Parity Check replaces the Haiming code to detect, so you only need an additional calibration disk (Parity Disk). The calculation of parity values is a logical operation of the relative application of each disk, and then writes the result to parity verifers, and any data is modified to do parity calculations, as shown:
For a disk failure, after replacing a new disk, the entire disk array (including parity disks) needs to be recalculated once, restore the data of the fault disk and write into a new disk; if the parity disk failure, Calculate parity values to achieve fault tolerance.
Compared with RAID 1 and RAID 2, RAID 3 has 85% disk space utilization, its performance is slightly poor than RAID 2, because of the parity calculation; the coaxial synchronized parallel access is good when reading files However, it is slow to write, and you need to recalculate and modify the contents of parity disks. RAID 3 and RAID 2 have the same application, applicable large files and applications in large amounts of data output, are not applicable to PC and web servers.
RAID 4
RAID 4 also uses a check disk, but it is different from RAID 3, as shown in the figure:
RAID 4 is a segment of the segment of the same position as the segment of the sector, and the Parity Block is formed, and the check disk is placed. This approach can perform different readings in different disks, greatly improve the reading performance of the disk array; however, when writing data, only one time is limited to verification disks, start all disks Reading data forms all data segments of the same checkout segment, and checks the calculation and writing with data to be written. Even so, the writing of small files is still fast than RAID 3, because its verification is calculated and the bit level is calculated; but the verification disk forms the bottleneck of RAID 4, reducing performance, because there is RAID 5 and make RAID 4 less. RAID 5 RAID5 avoids the bottleneck of RAID 4, and the method is to put the verification data in each disk in a loop without checking the disk, as shown below:
The first disk segment of the disk array is the check value. The second disk to the rear disk is folded back to the first disk. The segment of the second disk is the check value, from the third The segment of the disk is re-folded back to the second disk is data, so that this is pushed until it is finished. The first Parity Block in the figure is calculated from A0, A1 ..., B1, B2, and the second Parity Block is calculated from B3, B4, ..., C4, D0, that is, the verification value is The data of the segmentation of each disk is calculated. This approach can significantly increase the access performance of the small file, not only can read simultaneously, or may even perform multiple writes at the same time, such as written to disk 1 and its Parity Block is on disk 2, while writing Data to disk 4 and its Parity Block is on disk 1, which provides the best solution for online transaction processing (OLTP, ON-LINE Transaction Processing) such as banking system, finance, stock market, or large database. Because each of these applications is small, disk output is frequent and must be fault tolerant.
In fact, the performance of RAID 5 does not have this ideal, because any data is modified, after the same PARITYBLOCK is read out, then the verification calculation is written back, that is, RMW Cycle (Read-Modify-Write Cycle) This cycle does not include verification calculations); because of the whole body,: r: n (all disks can be read at the same time) W: 1 (can be written at the same time) S: N-1 (utilization )
The control of RAID 5 is more complicated, especially using hardware to control the disk array, because this approach is more than other RAID Level to master more things, there are more output demand, both speed, and Processing data, calculates the calibration value, makes error correction, etc., the price is higher; its application is preferably OLTP, as for image processing, etc., is not necessarily optimal.
2. Additional fault tolerance features of disk arrays: Spare or Standby Driver
The fact that the fault tolerance has become the most favored feature of disk arrays. In order to strengthen fault-tolerant functions, and quickly rebuild data in the case of disk failure, the general disk array system can use hot backups. (Hot spare or hot standby driver), the so-called thermal backup is when the Configure disk array system is established, specifying one of the disk as a backup disk, which is usually not working, but a certain array When the disk is faulty, the disk array replaces the fault disk in the backup disk, and automatically uses the data reconstruction of the fault disk in the backup disk, because the reaction is fast, plus the speed of the disk reduces the access of the disk, so data Reconstruction can be completed quickly, and the performance of the system is small. For large-scale data processing centers or control centers that require non-stop, hot spare is more important than avoiding any inconvenience caused by disk failure when the evening or unattended.
Another additional fault tolerance is a bad sector transfer (Bad Sector Reassignment). The bad sector is the main reason for disk failure. Usually, the disk failure occurs when reading and writing, indicating that this disk fault can no longer read and write, and there is even a lot of systems crafted because of the operation of reading and writing, but If the work cannot be completed or replaced by damage, the system performance is greatly reduced, and the maintenance cost of the system is too high. Bad sector shift is when the disk array system finds that the disk has a bad sector, replaces the sector in another blank and unburable sector to extend the service life of the disk, reduce the incidence of bad magnetic disks and the maintenance cost of the system. . Therefore, bad sector transfer features make disk arrays better fault tolerance while making the entire system have the best cost effectiveness ratio. Other quick-tap memory, such as an external battery reserve disk array, to avoid loss of data in the time of sudden power outages, or write consistency in RAID 1, although it is small technology, but not Neglect. 3. Hardware disk arrays or software disk arrays
There are so-called hardware disk arrays and software disk arrays, because the software disk array is connected to disk connection using a SCSI card, and the general user is mistaken to be a hardware disk array. The above is mainly for hardware disk arrays, and there are several biggest differences with the software disk arrays:
l A complete disk array hardware is connected to the system. l Built-in CPU, operate in parallel with the host, all I / O is completed in the disk array, reducing the workload of the host, increasing the overall performance of the system. l There are excellent bus mastering and DMA (Direct Memory Access) capabilities, accelerated access and transmission performance of data. l Combine with the memory stored without only increases the access and transmission performance of the data, but also increases the life of the disk due to reducing the access to the disk. l Can fully utilize hardware characteristics and respond quickly.
The software disk array is a program that performs an array through a SCSI card with a disk with a disk, which is cheap because there is no hardware cost (including R & D, production, maintenance, etc.), and the SCSI card is very cheap ( There is also a software disk array uses the specified very expensive SCSI card); its biggest disadvantage is that there are many processes in the host, adding the host's burden, especially the output of large demand. Most of the disk array systems on the market are hardware disk arrays, less software disk arrays.
4. Disk array or disk array controller
Disk array control cards are generally used in small systems for a single machine. Shared power with the host, the risk of being lost in lost Cache when turning off the host power. The disk array control card is only an interface of common bus mode. The operating system used by the host, the operating system used by the host, has a soft, hardware compatibility problem and potentially increase the unsettled factor of the system. When replacing the disk array card, you should take a disk corruption, the data is lost, and the risk of stopping at any time.
Separate disk array control is generally used in larger systems, can be divided into two types: single-channel disk arrays and multi-channel disk arrays, single-channel disk arrays can only pick one host, with large expansion restrictions. Multi-channel disk arrays can be used simultaneously with multiple systems to share disk arrays in a cluster, which makes the internal array control and a single disk array unused. Currently, most independent forms of disk array subsystems, itself is the hardware and operating environment of the host system? BR> - ※ Source:. Guangzhou Netease BBS bbs.nease.net. [From: 202.103.153.151] Sender: SECU (Secu), Word Area: Winnt Title: Re: NT Make RAID Send Station: Guangzhou Netease BBS (Mon Aug 24 17:59:42 1998), transfer
[In the masterpiece of Davychen (Xiaoque): 【In the masterpiece of Magicboy (Master):]::: Will use the SCSI hard drive to make software RAID and use more than possible IDE hard drive to make software mirror icons , Which:: Do you better performance? : Of course, SCSI, but do not achieve duplex with software mirror. Because the reference is only the data portion, the guiding area is not: above. If you use IDE, both RAID0, 1, 5, 10, 50 must be read and written at the same time. It may be very fast feet. / Font>: Tao or sector. RAID 0, 1 requires two hard drives, RAID 5 at least three hard drives.
First, the performance of IDE will not be higher than SCSI. Especially in the case of multitasking. The general advertisement is given to the maximum transmission speed, not a working speed. Compared with the SCSI disc, the IDE in the same period is mainly larger, the circuit is simple, so the price is much lower than SCSI, but it is far more than performance. RAID does not limit how many disks used, the more you should be, the better the time. For the RAID of the SCSI structure, the maximum number of disks is related to the number of SCSI channels (SCSI bus), and the maximum number of 15 disks (SCSI / 3) is mostly per channel 200 for FC-Al (fiber). Bind
Of course, there must be such a large disk box!