Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Fio to evaluate the performance of hard disk in Linux

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use Fio to evaluate hard disk performance in Linux, which has a certain reference value, and interested friends can refer to it. I hope you will gain a lot after reading this article.

Fio (Flexible Flexible O Tester) is a free and open source software developed by Jens Axboe for testing and stress / hardware verification.

It supports 19 different types of iUnip O engines (sync, mmap, libaio, posixaio, SG v3, splice, null, network, syslet, guasi, solarisaio, and more), iUnip O priority (for newer Linux kernels), iUnip O speed, fork tasks or threading tasks, and so on. It works on block devices and files.

Fio accepts task descriptions in a very simple and easy-to-understand text format. The software contains several sample task files by default. Fio shows all types of Iamp O performance information, including full IO latency and percentage.

It is widely used in many places, including evaluation, QA, and verification purposes. It supports Linux, FreeBSD, NetBSD, OpenBSD, OS X, OpenSolaris, AIX, HP-UX, Android, and Windows.

In this tutorial, we will use Ubuntu 16. You need to have sudo or root permissions on this computer. We will complete the installation and use of Fio.

Install Fio using source code

We're going to clone the warehouse on GitHub. Install the required dependencies, and then we will build the application from the source code. First, make sure we have Git installed.

Sudo apt-get install git

CentOS users can execute the following commands:

Sudo yum install git

Now, let's change to the / opt directory and clone the repository from Github:

Cd / optgit clone https://github.com/axboe/fio

You should see output like this:

Cloning into 'fio'...remote: Counting objects: 24819, done.remote: Compressing objects: 100%, done.remote: Total 24819 (delta 39), reused 62 (delta 32), pack-reused 24743Receiving objects: 100% (24819 MiB), 16.07 MiB | 0 bytes/s, done.Resolving deltas: 100% (16251 delta), done.Checking connectivity... Done.

Now, let's change to the code directory of Fio by entering the following command under the / opt directory:

Cd fio

* We can use the following command to build software from source code using make:

#. / configure# make# make install install Fio on Ubuntu

For Ubuntu and Debian, Fio is already in the main warehouse. You can easily install Fio using standard package managers like yum and apt-get.

For Ubuntu and Debian, you simply execute the following command:

Sudo apt-get install fio

For CentOS/Redhat, you simply execute the following command.

In CentOS, you may need to install the EPEL repository into your system before you can install Fio. You can install it by executing the following command:

Sudo yum install epel-release-y

You can install Fio by executing the following command:

Sudo yum install fio-y uses Fio to test disk performance

Now Fio has been installed on your system. It's time to look at some examples of how to use Fio. We will conduct random write, read and write tests.

Perform a random write test

Execute the following command to begin. This command will execute two processes at the same time, writing to the total 4GB (4 tasks x 512MB = 2GB) file:

Sudo fio--name=randwrite-- ioengine=libaio-- iodepth=1-- rw=randwrite-- bs=4k-- direct=0-- size=512M-- numjobs=2-- runtime=240-- group_reporting...fio-2.2.10Starting 2 processes randwrite: (groupid=0, jobs=2): err= 0: pid=7271: Sat Aug 5 13:28:44 2017 write: io=1024.0MB, bw=2485.5MB/s, iops=636271, runt= 412msec slat (usec): min=1, max=268, avg= 1.79, stdev= 1.01 clat (usec): min=0, max=13, avg= 0.20, stdev= 0.40 lat (usec): min=1, min=1 Avg= 2.03, stdev= 1.01 clat percentiles (usec): | 1.00th= [0], 5.00th= [0], 10.00th= [0], 20.00th= [0], | 30.00th= [0], 40.00th= [0], 50.00th= [0], 60.00th= [0], 60.00th= [0], 80.00th= [1], 90.00th= [1], 95.00th= [1], 99.00th= [1], 99.50th= [1], 99.90th= [1], 99.95th= [1] | | 99.99th = [1] lat (usec): 2, 99.99%, 4: 0.01, 10: 0.01, 20: 0.01 cpu: usr=15.14%, sys=84.00%, ctx=8, majf=0, minf=26 IO depths: 1: 100.%, 2: 0. 0%, 4: 0. 0%, 8: 0. 0%, 16: 0. 0%, 32: 0. 0%, > = 64. 0. 0.%, 4. 0. 0. 0. 0.%, 16. 0. 0.%, 32. 0. 0.%, 64. 0. 0.% complete: 0. 0. 4 percent 100. 0%, 8 percent 0. 0%, 16 percent 0%, 32 percent 0. 0 percent, 64 percent 0. 0%, > = 64 percent 0. 0% issued: total=r=0/w=262144/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0 latency: target=0, window=0, percentile=100.00%, depth=1 Run status group 0 (all jobs): WRITE: io=1024.0MB, aggrb=2485.5MB/s, minb=2485.5MB/s, maxb=2485.5MB/s, mint=412msec, maxt=412msec Disk stats (read/write): sda: ios=0/0, merge=0/0, ticks=0/0, in_queue=0 Util=0.00% performs random read tests

We are going to perform a random read test and we will try to read a random 2GB file.

Sudo fio-name=randread-ioengine=libaio-iodepth=16-rw=randread-bs=4k-direct=0-size=512M-numjobs=4 runtime=240-group_reporting

You should see output like this:

Fio-2.2.10Starting 4 processesrandread: Laying out IO file (s) (1 file (s) / 512MB) randread: Laying out IO file (s) (1 file (s) / 512MB) randread: Laying out IO file (s) (1 file (s) / 512MB) randread: Laying out IO file (s) (1 file (s) / 512MB) Jobs: 4 (feng4): [r (4)] [100.0% done] [71800KB/0KB/0KB / s] [17.1K/0/0 iops] [eta 00m:00s] randread: (groupid=0 Jobs=4): err= 0: pid=7586: Sat Aug 5 13:30:52 2017 read: io=2048.0MB, bw=80719KB/s, iops=20179, runt= 25981msec slat (usec): min=72, max=10008, avg=195.79, stdev=94.72 clat (usec): min=2, max=28811, avg=2971.96, stdev=760.33 lat (usec): min=185, max=29080, avg=3167.96, stdev=798.91 clat percentiles (usec): | 1.00th = [2192], 5.00th = [2448,10.00th= [2576], 20.00th= [2736], 30.00th= [2800], 40.00th= [2832] 50.00th= [2928], 60.00th= [3024], | 70.00th= [3120], 80.00th= [3184], 90.00th= [3248], 95.00th= [3312], 99.00th= [3536], 99.50th= [6304], 99.90th= [15168], 99.95th= [18816], | 99.99th= [22912] bw (KB / s): min=17360, max=25144, per=25.05%, avg=20216.90, stdev=1605.65 lat (usec): 4 percent 0.01%, 10percent 0.01 percent, 250 percent 0.01 percent, 500 percent 0.01 percent 750 million 0.1% lat (usec): 1000 percent 0.01% lat (msec): 2 percent 0.01%, 4 percent 99.27%, 10 percent 0.44%, 20 percent 0.24%, 50 percent 0.4 cpu: usr=1.35%, sys=5.18%, ctx=524309, majf=0, minf=98 IO depths: 1 percent 0.1%, 2 percent 0.1%, 4 percent 0.1 percent, 8 percent 0.1 percent, 16 percent 100 percent, 32 percent 0.0 percent, > = 64 percent 0.0% submit: 0 percent, 40 percent, 8 percent, 16 percent, 32 percent, 64 percent > = 6400.0% complete: 00000.0%, 410.04%, 8400.0%, 1600.1%, 320.08%, 640.08%, > = 6400.0% issued: total=r=524288/w=0/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0 latency: target=0, window=0, percentile=100.00%, depth=16 Run status group 0 (all jobs): READ: io=2048.0MB, aggrb=80718KB/s, minb=80718KB/s, maxb=80718KB/s, mint=25981msec, maxt=25981msec Disk stats (read/write): sda: ios=521587/871, merge=0/1142, ticks=96664/612, in_queue=97284, util=99.85%

* We want to show a simple random read-write test to see the type of output returned by Fio.

Read and write performance test

The following command tests the random read and write performance of the USB Pen drive (/ dev/sdc1):

Sudo fio-randrepeat=1-ioengine=libaio-direct=1-gtod_reduce=1-name=test-filename=random_read_write.fio-bs=4k-iodepth=64-size=4G-readwrite=randrw-rwmixread=75

The following is the output we got from the above command:

Fio-2.2.10Starting 1 processJobs: 1 (fission 1): [m (1)] [100.0% done] [217.8MB/74452KB/0KB / s] [55.8K/18.7K/0 iops] [eta 00m:00s] test: (groupid=0, jobs=1): err= 0: Sat Aug 5 13:36:04 2017 read: io=3071.7MB, bw=219374KB/s, iops=54843, runt= 14338msec write: io=1024.4MB, bw=73156KB/s, iops=18289, runt= 14338msec cpu: usr=6.78%, sys=20.81%, ctx=1007218, majf=0 Minf=9 IO depths: 0. 1%, 2-0. 1%, 4-0. 1%, 8-0. 1%, 16-0. 1%, 32-0. 1%, > = 64-100. 0%, 8-0. 0%, 16-0. 0%, 32-0. 0%, 64-0. 0%, 16-4-0. 0%, 32-10. 0%, 4-4-0. 0%, 8-4-0. 0%, 16-4-0. 0%, 32-0. 0%, 64-0. 1%, > = 64-4-0. 0% issued: total=r=786347/w=262229/d=0, short=r=0/w=0/d=0 Drop=r=0/w=0/d=0 latency: target=0, window=0, percentile=100.00%, depth=64 Run status group 0 (all jobs): READ: io=3071.7MB, aggrb=219374KB/s, minb=219374KB/s, maxb=219374KB/s, mint=14338msec, maxt=14338msec WRITE: io=1024.4MB, aggrb=73156KB/s, minb=73156KB/s, maxb=73156KB/s, mint=14338msec, maxt=14338msec Disk stats (read/write): sda: ios=774141/258944, merge=1463/899, ticks=748800/150316, in_queue=900720, util=99.35% Thank you for reading this article carefully I hope the article "how to use Fio to evaluate hard disk performance in Linux" shared by the editor is helpful to everyone. At the same time, I also hope that you can support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report