In computer systems, IO operations are one of the most common and most time-consuming operations. For Linux users, IO performance optimization is very important. However, many people do not know how to optimize IO to achieve faster disk read and write speeds. This article will introduce some efficient IO optimization techniques to increase the disk speed of your Linux system several times!
fio is more convenient to use under Linux system, iometer is more convenient to use under window system, Orion is Oracle's IO testing software, which can simulate the reading and writing of Oracle database scenarios without installing Oracle database.
The following is an IO test on SAN storage using the fio tool on a Linux system.
1. Install fio
Method 1: Download the fio-2.1.10.tar file from the fio official website. After decompression, you can use fio after ./configure, make, and make install.
Method 2: Install through yum under Linux system, yum install -y fio
2. [neiqian]fio[/neiqian] parameter explanation
You can use fio -help to view each parameter. For specific parameters, you can view the how to document on the official website. The following is a description of several common parameters
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
3. Detailed explanation of fio test scenarios and report generation
testing scenarios:
100% random, 100% read, 4K
1 2 3 |
|
100% random, 100% written, 4K
1 2 3 |
|
100% sequence, 100% read, 4K
1 2 3 |
|
100% order, 100% writing, 4K
1 2 3 |
|
100% random, 70% read, 30% write 4K
1 2 3 4 5 6 |
|
Result report view:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
4. Extended IO queue depth
At a certain moment, there are N inflight IO requests, including IO requests in the queue and IO requests being processed by the disk. N is the queue depth.
Increasing the hard disk queue depth is to make the hard disk work continuously and reduce the idle time of the hard disk.
Increase the queue depth -> Improve utilization -> Obtain peak IOPS and MBPS -> Note that the response time is within an acceptable range,
There are many ways to increase the queue depth. Using asynchronous IO and initiating multiple IO requests at the same time is equivalent to having multiple IO requests in the queue. Multiple threads initiating synchronous IO requests is equivalent to having multiple IO requests in the queue.
Increase the application IO size. After reaching the bottom layer, it will become multiple IO requests, which is equivalent to multiple IO requests in the queue. The queue depth increases.
As the queue depth increases, the waiting time of IO in the queue will also increase, resulting in longer IO response time, which requires a trade-off.
Why do we need to parallelize disk I/O? The main purpose is to improve the performance of the application. This is particularly important for virtual disks (or LUNs) composed of multiple physical disks.
If I/O is submitted one at a time, although the response time is shorter, the system throughput is very small.
In comparison, submitting multiple I/Os at one time not only shortens the head movement distance (through the elevator algorithm), but also improves IOPS.
If an elevator can only take one person at a time, then once everyone takes the elevator, they can quickly reach their destination (response time), but it will take a longer waiting time (queue length).
Submitting multiple I/Os to the disk system at once balances throughput and overall response time.
Linux system to view the default queue depth:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
Use the dd command to set bs=2M for testing:
1 |
|
Recorded the read of 1000 0. Recorded the write of 1000 0. 2097152000 bytes (2.1 GB) copied, 10.6663 seconds, 197 MB/second
1 2 3 |
|
It can be seen that after 2MB IO reaches the bottom layer, it will become multiple 512KB IOs. The average queue length is 2.39. The utilization rate of this hard disk is 97%, and MBPS reaches 197MB/s.
(Why does it become 512KB IO? You can use Google to check the meaning and usage of the kernel parameter max_sectors_kb.) In other words, increasing the queue depth can test the peak value of the hard disk.
5. Detailed explanation of viewing IO command iostat in Linux system
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
Output parameter description:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
Through this article, we learned how to improve the disk read and write speed of Linux systems through some efficient IO optimization techniques. These techniques include using the IO scheduler, disabling unnecessary services, adjusting file system parameters, etc. In the process of optimizing IO performance, please be careful and choose the most suitable optimization solution according to your needs. The optimized system will bring a faster and smoother disk reading and writing experience, improve your work efficiency, and better meet your needs.
The above is the detailed content of Can Linux increase your disk speed several times? Here are top secret IO optimization tips!. For more information, please follow other related articles on the PHP Chinese website!