Application of RAID on database storage

Source: Internet
Author: User

With the limitations of data security, performance, and capacity on a single disk, disk arrays (redundant Arrays of inexpensive/independent Disks,raid) appear, and RAID combines several separate disks in different ways, Form a disk group to achieve higher data security, performance, and capacity than a single disk.

I. Common RAID levels
RAID has several levels of raid0~raid7, plus some composite raid modes, such as: RAID10, RAID01, RAID50, RAID53.

The commonly used RAID modes are RAID0, RAID1, RAID5, RAID10.


1. RAID0
RAID0 is often said data stripping, the data is scattered in the array of physical disks, requires 2 or more hard disks, low cost, performance and capacity with the number of drives, at all RAID levels, the speed of RAID 0 is the fastest, but the raid 0 No redundancy or bug fixes are available, and if one disk (physical) is damaged, all data is unusable.

For a RAID array with disaster tolerant mode, the array system automatically synchronizes the data to the new hard disk when a disk is damaged, as long as the new hard disk is replaced. (If hot plug is not supported, it needs to be shut down and then switched on)

2. RAID1
RAID1 is often said data mirroring, 2 and above the hard disk (even several), is divided into 2 groups, the data in each group of disks each, if one of the groups have disk corruption, the other group can guarantee that data access will not be interrupted. RAID1, like RAID0, has a very good reading speed, but the speed of writing has dropped.


3. RAID5
RAID 5 is a data security, performance, capacity, cost, feasibility of a relatively balanced solution, it is therefore, similar RAID2, RAID3, RAID4, RAID6 are rarely practical application.
RAID5 requires 3 blocks or more of hard disk, it is not to the stored data directly to backup, but the data and the corresponding parity information stored on the various disks that make up the array, in short: Any broken disk, the other N-1 disk can be used parity information, Recover the data from the broken disk.
RAID 5 can be understood as a compromise between RAID 0 and RAID 1, with data reads similar to RAID 0, with a lower disaster tolerance than RAID1 (RAID5 only allows a piece of disk damage), because more parity information is used to write data slower than RAID1.

4. RAID10
RAID10, the name can be seen as RAID0 and RAID1 of the combination, obviously need at least 4 pieces of disk. However, first RAID0 after RAID1, or first RAID1 after RAID0, is not the same.

RAID01, is to do RAID0 first, and then to 2 groups RAID0 again do RAID1, assuming that at this time a RAID0 broken a disk, this RAID0 is not available, all the IO points to the remaining RAID0;


RAID10, is to do RAID1 first, then to 2 groups RAID1 again do RAID0, assuming that at this time some RAID1 broken a disk, the current RAID1 can still provide services, and the other RAID1 can also break a disk.

So, we usually choose RAID10, not RAID01.

5. Read and write performance at different RAID levels
Assume that all use 4 disk, RAID0,RAID1,RAID5,RAID10 in multi-threaded/multi-CPU case, can read multiple disks at the same time, read the performance is very good;
Write Performance (IOPS) in descending order, roughly: RAID0 > RAID10 > RAID1 > RAID5.

Two. Space calculations for raid
When doing raid, usually choose the uniform size of the disk, if there is a different space size, different read and write speed of the disk, the array system will be small space, low speed as the standard, large space, high speed disk compatibility. For example: 100g,50g 2 disk to do RAID0, get space for 50g*2 = 100G.

Space calculation formula for raid:
RAID0 Space: Disk Size * N
RAID1 Space: (Disk Size * N)/2
RAID5 Space: ((N-1)/N) * (disk size * N) = (N-1) * Disk size
RAID10 Space: (Disk size * N/2)/2 + (disk size * N/2)/2 = (disk size * N)/2

Suppose you use 4 disks, each disk is 100G
RAID0 Space: 100G * 4 = 400G
RAID1 Space: (100G * 4)/2 = 200G
RAID5 space: (4-1) * 100G = 300G
RAID10 Space: (100G * 4)/2 = 200G

Three. IOPS calculation for raid
1. The ioPS of a single drive is fixed
For a calculation of the IOPS of a single disk, in the " 0. The relationship between disk read-write and Database " has a detailed method, but usually this value is relatively fixed, do not need to repeat the calculation, refer to the following:

It can be found that the same number of RPM, different types of single disk, ioPS are maintained in a similar order of magnitude.

2. IOPS calculation for raid
With the ioPS of a single disk, the IOPS calculation for multiple disks is simple, for example, for storage of RAID0 or simple tandem disks (Jbod:just a bunch of disks), the total IOPS of 10 175 ioPS is 10*175 = 1750 IOPS.
However, for other RAID levels this is not the case, because the raid has multiple write IO overhead, simply: The raid initiated a write Io,raid internal will have more than one write IO occurs, the raid internal IO overhead is as follows:

Get formula: user Read io+n* user write Io = Total ioPS (N is the number of IO overhead in RAID)

Assuming that the user reads and writes half of the requests (50%), it also takes 10 175 IOPS disks as an example:
50% * Total number of user IO requests + N * (50% * Total User io requests) = 175 IOPS * 10

Take RAID1 as an example, then n = 2, the above becomes: 1.5 * Total number of user IO requests = 1750 IOPS
Total number of user IO requests = 1167 IOPS
This is the 10 175 IOPS disk that did the RAID1 to provide the IOPS.

3. RAID ioPS Computing in real-world applications
In practice, we don't usually calculate the iops of an existing raid, but instead: choose a good disk spec, RAID mode, test the read/write ratio of the system, the IOPS the system needs to achieve, and see how many hard drives are required to complete the array to achieve this IOPS requirement?

Assume: Select the 175 iops disk, do RAID1, the system read and write ratio of 60%:40%, the system needs to reach the IOPS
Q: How many blocks of this size do you want to configure?

Change the above formula to a general formula:
Reads * workload_iops + writes_impact * (writes * workload_iops) = 175 * M
60% * + 2 * (40% * +) = 175 * M
M = 16 (that is, you need to configure 16 175 IOPS disks to reach the specified IOPS,RAID1)

It may be felt that the system's ratio of read and write requests, how much iops the system needs to reach, does not know that if there is no pre-test, it can only be estimated based on experience.

Four. Raid on the database storage application
take the SQL Server database as an example to see what scenarios the different RAID levels apply to:
RAID0, because there is no disaster tolerance mechanism, is rarely used alone.
It has been mentioned that tempdb can be placed in RAID0, because Tempdb does not have to worry about data loss, in fact, tempdb fails, SQL Server does not work properly, so it is not recommended to do so, it is recommended to use tempdb as a user database to treat;

RAID1, operating system, SQL Server instance, log file;
RAID5, data files, backup files;
RAID10, all types are applicable, but in consideration of costs, RAID10 is not generally used.

Application of RAID on database storage

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.