I/O system performance: performance indicators

Source: Internet
Author: User

 Http://storage.it168.com/a2011/0323/1169/000001169755_all.shtml#0-baidu-1-41052-29471509e6ee672a61f105bf71aa61aa

[It168 application]As a database administrator, paying attention to the system performance is one of the most important tasks in daily life. However, I/O performance is the most challenging, in the face of a variety of raw parameters and dazzling new terms, coupled with the flickering of storage vendors, we always feel confused in the cloud. This series of articles tries to summarize the various concepts related to disk storage from the basic concepts, so that you can understand the basic concepts related to Io performance, i/O performance monitoring and adjustment have a comprehensive understanding.

In this section, we first discard various complex storage systems and directly study the performance of a single disk, so as to understand the performance indicators of each Io System and the relationship between them. Note that this article only discusses disk I/O performance and does not take network I/O performance into account.

  Several Basic Concepts

Before studying disk performance, we must first understand the disk structure and working principle. However, I will not repeat it here. For details about the structure and working principle of a hard disk, refer to the related entry on Wikipedia-hard disk drive (English) and hard drive (Chinese ).

  Read/write Io operations

Disks are used to access data. Therefore, when I/O operations are involved, there will be two corresponding operations. When storing data, they correspond to write Io operations, when data is retrieved, it corresponds to the read Io operation.

  Single Io operation

When the Controller that controls the disk receives the read Io operation instruction from the operating system, the controller sends a read data instruction to the disk, at the same time, the address of the data block to be read is transmitted to the disk. Then, the disk transmits the read data to the Controller, and the Controller returns the data to the operating system to complete an IO write operation; similarly, a write Io operation is similar. The controller receives the write Io Operation Command and the data to be written, and passes it to the disk, after the data is written to the disk, the operation result is transmitted back to the Controller, and then the Controller returns the result to the operating system to complete an I/O write operation. A single Io operation is to complete a write Io or read Io operation.

  Random Access and sequential access)

Random Access refers to the large difference between the slice address provided by the current IO and the slice address given by the previous Io, in this way, the head needs to be moved between two Io operations to start reading/writing data again. On the contrary, if the slice address provided by the next Io is the same or close to the slice address ended by the last Io, the head can start this Io operation very quickly, such multiple Io operations are called continuous access. Therefore, although two adjacent Io operations are sent at the same time, if the slice addresses of their requests differ greatly, they can only be called random access instead of continuous access.

  Sequential Io mode (queue mode)/concurrent I/O mode (Burst Mode)

The disk controller may issue a series of Io commands to the disk group at a time. If the disk group can only execute one Io command at a time, it is called sequential Io. When the disk group can execute multiple Io commands at a time, it is called concurrent I/O. Concurrent Io can only occur on a disk group composed of multiple disks. A single disk can only process one Io command at a time.

  Size of a single io (IO chunk size)

People familiar with the database will have this concept, that is, the database storage has a basic block size (block size), whether it is SQL Server or Oracle, the default block size is 8 KB, that is, each read/write operation of the database is in the unit of 8 K. What if a database application sends a fixed 8 K read/write data to the disk? What is the size of the data for a single Io operation on the disk, is it also a fixed value?

The answer is uncertainty. First, the operating system introduces the file system cache to improve Io performance. The system puts multiple IO requests in the cache according to the request data, and then submit it to the disk at a time. That is to say, the read operations on multiple 8 K data blocks sent by the database may be processed in one disk read Io.

Some storage systems also provide cache. After receiving the OS I/O requests, they combine the I/O requests of multiple operating systems into one for processing. There is only one purpose, either at the operating system level or at the disk controller level, to improve data read/write efficiency. Therefore, the size of each independent Io operation varies depending on the system's judgment on the data read/write efficiency.

When an I/O operation is small, it becomes a small I/O operation, such as 1 K, 4 K, and 8 K; large Io operations, such as 32 K, 64 K, or even larger, compare the data volume of one Io operation.

When we talk about block size, we usually come into contact with multiple similar concepts, such as the smallest Data Management Unit in the database we mentioned above, oralce is called a block. Generally, the size is 8 K, and SQL Server is called a page. Generally, the size is 8 K.

In the file system, we can also encounter a file system block. In many Linux systems, the block size is 4 K (which can be seen through/usr/bin/time-V ), in fact, it serves the same purpose as the block/page in the database to facilitate data management. However, the size of a single Io is not directly related to the size of these blocks. In English, the size of a single Io is usually referred to as the size of an IO chunk, which is not the size of an IO block.

  Iops (IO per second)

Iops, the number of Io operations performed by the IO system per second, is an important parameter used to measure the system's Io capability. For an I/O system composed of a single disk, it is not difficult to calculate its iops, as long as we know the time required for the system to complete an IO operation, we can calculate the system iops.

Now let's calculate the iops of the disk. Assume that the rotation speed of the disk is 15 K rpm, and the average seek time is 5 ms, the maximum transmission rate is 40 MB/s (the read/write speed is considered the same here, the actual difference is relatively large ).

For a disk, a complete Io operation is like this: when the controller sends an IO operation command to the disk, the drive arm of the disk (Actuator arm) carries a read/write head (head) leave the landing zone, which is located in the region with no data in the inner ring, and move to the top of the track where the initial data block to be operated, this process is called addressing (seeking) and the time consumed is called addressing time (seek time). However, the corresponding track cannot be read immediately, at this time, the head must wait until the disk (platter) rotates to the sector (sector) where the initial data block is located on the top of the read/write head before it can start to read data, the time consumed in this process of waiting for the disk to rotate to an operable sector is called the rotational delay (
Delay); next, as the disk is rotated, the head constantly reads/writes the corresponding data blocks until all the data required for this Io operation is completed, this process is called data transmission, and the corresponding time is called transfer time ). After completing these three steps, I/O operations are completed.

When we look at hard drive manufacturers' leaflets, we often see three parameters: Average addressing time, disk rotation speed, and maximum transmission speed, these three parameters can be provided for us to calculate the time of the above three steps.

The first addressing time, considering that the read/write data may be in any disk track, it may be in the inner ring of the disk (with the shortest addressing time ), it may also be in the outermost ring of the disk (the longest addressing time). Therefore, in the calculation, we only consider the average addressing time, that is, the average addressing time indicated in the disk parameter, here, we use the most 10krmp hard drive for 5 ms.

The second rotation delay is the same as addressing. When the head is located on the track, it may be located on top of the read/write sector. In this case, data can be read and written immediately without extra delay, however, in the worst case, the disk must be rotated for a full circle before the head can read the data. Therefore, we also consider the average rotation latency, for a 10 krpm disk, It is (60 S/15 K) * (1/2) = 2 ms.

The third transfer time, the disk parameter provides our maximum transmission speed, of course, it is very difficult to achieve this speed, but this speed is the speed of the disk pure read/write disk, therefore, given the size of a single Io, we know how much time the disk will spend on data transmission. This time is the IO chunk size/MAX transfer rate.

  Iops Calculation Formula

Now we can come up with the formula for calculating a single Io time:

Io time = seek time + 60 sec/rotational speed/2 + IO chunk size/Transfer Rate

So we can calculate the iops.

Iops = 1/IO time = 1/(seek time + 60 sec/rotational speed/2 + IO chunk size/transfer rate)

Given different Io sizes, we can obtain the following series of data.

4 K (1/7. 1 MS = 140 iops)
5 MS + (60sec/15000 rpm/2) + 4 K/40 MB = 5 + 2 + 0.1 = 7.1
8 K (1/7. 2 MS = 139 iops)
5 MS + (60sec/15000 rpm/2) + 8 K/40 MB = 5 + 2 + 0.2 = 7.2
16 K (1/7. 4 MS = 135 iops)
5 MS + (60sec/15000 rpm/2) + 16 K/40 MB = 5 + 2 + 0.4 = 7.4
32 K (1/7. 8 MS = 128 iops)
5 MS + (60sec/15000 rpm/2) + 32 K/40 MB = 5 + 2 + 0.8 = 7.8
64 K (1/8. 6 MS = 116 iops)
5 MS + (60sec/15000 rpm/2) + 64 K/40 MB = 5 + 2 + 1.6 = 8.6

From the above data, we can see that when a single Io is smaller, the less time it takes for a single Io, the larger the corresponding iops.

The above data is produced under an ideal assumption. The ideal situation here is that the disk takes an average addressing time and an average rotation latency, this assumption is actually quite in line with our actual situation of random read/write. In random read/write, the addressing time and rotation latency of each Io operation cannot be ignored, the existence of these two times limits the iops size. Now we consider a relatively extreme sequential read/write operation. For example, when reading a large file that is continuously stored on the disk, because the distribution of the file storage is continuous, after a read Io operation is completed, the head does not need to start from the new addressing or rotate the delay. In this case, we can reach a large iops value, as shown below:

4 K (1/0. 1 MS = 10000 iops)
0 Ms + 0 Ms + 4 K/40 MB = 0.1
8 K (1/0. 2 MS = 5000 iops)
0 Ms + 0 Ms + 8 K/40 MB = 0.2
16 K (1/0. 4 MS = 2500 iops)
0 Ms + 0 Ms + 16 K/40 MB = 0.4
32 K (1/0. 8 MS = 1250 iops)
0 Ms + 0 Ms + 32 K/40 MB = 0.8
64 K (1/1. 6 MS = 625 iops)
0 Ms + 0 Ms + 64 K/40 MB = 1.6

The gap is very big compared to the first group of data. Therefore, when we use iops to measure the performance of an I/O system, we must make it clear what the iops is, that is to say, it is necessary to explain the read/write method and the size of a single Io. Of course, in practice, especially in OLTP systems, random small Io read/write is the most convincing.

  Transmission Rate (Transfer Rate)/throughput (throughput)

The transmission speed we want to talk about now (another common saying is the throughput) is not the maximum transmission speed or the ideal transmission speed shown on the disk, but the amount of data that the disk actually flows from the disk system bus. With iops data, we can easily calculate the corresponding transmission speed.

Transfer Rate = iops * IO Chunk Size

Or the first group of iops data above, we can get the corresponding transmission speed as follows:

4 K: 140*4 k = 560 K/40 m = 1.36%
8 K: 139*8 K = 1112 K/40 m = 2.71%
16 K: 135*16 k = 2160 K/40 m = 5.27%
32 K: 116*32 K = 3712 K/40 m = 9.06%

It can be seen that the actual transmission speed is very small, and the utilization of the bus is also very small.

Here, we must clarify the concept that although we use iops to calculate the transmission speed above, the transmission speed is not directly related to iops, in the absence of cache, their common deciding factors are the access method to the disk system and the size of a single Io. When Random Access to a disk, we can use iops to measure the performance of a disk system. At this time, the transmission speed is not too high. However, when the disk is continuously accessed, at this time, iops has no reference value. In this case, the actual transmission speed is the maximum transmission speed of the disk. Therefore, in actual applications, only iops is used to measure the random read/write performance of small Io, when we want to measure the performance of large Io continuous read/write, we need to adopt the transmission speed instead of iops.

  Io Response Time)

Finally, let's take a look at the IO response time that can directly describe the IO performance. Io response time is also known as IO latency ), the IO response time is the time from a read or write Io Command sent by the operating system kernel to the time when the operating system kernel receives the IO response. Be sure not to confuse it with a single Io time, A single Io time only refers to the time when I/O operations are processed inside the disk, and the IO response time also includes the waiting time of I/O operations in the IO wait queue.

The time consumed by computing I/O operations in the waiting queue is a queue model derived from Little's law. The M/1 model can follow, due to the complexity of queuing model algorithms, it has not yet been too clear (if anyone is familiar with the M/1 model, please give us some guidance ), here we will list the final results, or the iops data calculated above:

8 K Io chunk size (135 iops, 7.2 MS)
135 => 240.0 MS
105 => 29.5 MS
75 => 15.7 MS
45 => 10.6 MS
64 K Io chunk size (116 iops, 8.6 MS)
135 => no response ......
105 => 88.6 MS
75 => 24.6 MS
45 => 14.6 MS

From the above data, we can see that as the actual iops of the system approaches the maximum theoretical value, the IO response time will grow non-linear. The closer it is to the maximum value, the higher the response time, and it will be much higher than expected. In general, there is a guiding value of 70% in actual applications. That is to say, in Io read/write queues, when the queue size is smaller than 70% of the maximum iops, the IO response time increases slightly, relatively acceptable. If the response time exceeds 70%, the response time will surge dramatically, therefore, when the I/O pressure of a system exceeds 70% of the maximum load, you must consider adjusting or upgrading the system.

In addition, the 70% guiding value also applies to the CPU response time, which has been proved in practice. Once the CPU exceeds 70%, the system will become unable to cope with the slowdown. Something interesting.

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.