Linux: Is there something similar to "top" for I/O?

568

Solution 1

Have you tried iotop ?

You may need to install it before. Also, it depends on a kernel feature that may or may not enabled in your specific distribution.

Solution 2

You might want to give atop a try. It seems to do a good job of letting you know what is going on.

Solution 3

iostat is still the king of detailed I/O information, the kind of info that can confirm if your SSD is living up to expectations, for example.

$ iostat -xht 5 nvme0n1
Linux 4.15.0-43-generic (myhost)    06/02/2021  _x86_64_    (8 CPU)

06/02/2021 08:59:20 AM
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           2.6%    0.1%    0.8%    0.1%    0.0%   96.4%

Device            r/s     w/s     rkB/s     wkB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
nvme0n1
                95.03   20.80      1.8M    300.1k     0.00    13.15   0.0%  38.7%    0.24    0.57   0.03    19.2k    14.4k   0.02   0.3%

Every five seconds, this will print detailed IO stats for the NVMe drive. The most important ones are usually not actually read/write bandwidth -- rKB/s and wKB/s -- but rather the reads and writes per second (r/s and w/s, aka IOPS) and, perhaps most important, the average time a process waited for each read and write -- r_await and w_await (in milliseconds).

All of these values feed into each other using the surprisingly useful Little's law formula, translated a bit to latency = queue_size / IOPS, or await = aqu_sz / (r/s + w/s).

Share:
568

Related videos on Youtube

Syed Raza
Author by

Syed Raza

Updated on September 17, 2022

Comments

  • Syed Raza
    Syed Raza over 1 year

    i wanna swap dropdown value on change event as if i select the value from '4' to '1' in dropdown then it will change the value of that drop down having value '1' my code is define as under,

     <?php
    
     $host="****"; // Host name 
     $username="***"; // Mysql username 
         $password="****"; // Mysql password 
             $db_name="****"; // Database name 
             $tbl_name="*****"; // Table name
    
    mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB");
    $arr = explode("?", $_SERVER['REQUEST_URI']);
    $arr1=explode("&",$arr[1]);
    $arr2=explode("=",$arr1[0]);
    
    $sql="SELECT * FROM $tbl_name where idTemplates=$arr2[1]";
    $result=mysql_query($sql);
    $count=0;
    //$templateName=mysql_result($result,$i,"TempName");
    //$tempID=mysql_result($result,$i,"idTemplates");
    $Section1=mysql_fetch_row($result);
    for($j=6;$j<=15;$j++)
    {
    if($Section1[$j]!="")
    {
    $count++;  
    }
    }
    for($j=6;$j<=15;$j++)
    {
    if($Section1[$j]!="")
    {
    echo("<tr>");
          echo("<td>");
          echo("$Section1[$j] <input type='hidden' value='$Section1[$j]' name='Sections[]' />");
               echo("</td>");
    echo("<td>");
    $counting=$j-5;
    echo("<select id='Numbering".$counting."' onchange='OnChangeSelection(Numbering".$counting.".options[Numbering".$counting.".selectedIndex].value);'>");
    for($k=1;$k<=$count;$k++)
    {
    if($k==($j-5))
    {
    echo("<option value='$k' selected='".$counting."'>$k</option>");
    }
    else
    {
    echo("<option value='$k'>$k</option>");
    }
    }
    echo("</select>");
    echo("</td>");
               echo("</tr>");
    }
    }
    ?>
    

    in the above code i am printing three column first section is section name and second column is section details and third is combo dropdown box having nuber value in it as shown in the fig,

    enter image description here

    and this is the js on change,

    function OnChangeSelection(selection)
    {
    alert(selection);
    }
    

    how to alter it so that as we change the drop down value it would change the other drop down having same value ??

    hopes for your suggestions thanks in advance

    • Angel
      Angel almost 12 years
      Drop-downs are the ones with 8, 9 and 10 selected in the image. Do you want when one is changed the other ones to have the same value?
    • outis
      outis almost 12 years
      Please pick and apply an indent style to make your code readable. Once working, you should make use of codereview.SE to get feedback on the many issues with the script (e.g. SQL injection, outdated mysql extension, or die).
    • outis
      outis almost 12 years
    • Syed Raza
      Syed Raza almost 12 years
      @angel yes i f i change from 8 to 9 then the drop down having value 9 would chang to 8
    • Huygens
      Huygens almost 12 years
      If I'm correct flush and jbd concerns the sync of the journal (FS metadata) to the disk. Which means you must have some processes either writing to the disk or reading a lot of data and you have the atime option on your mount. I don't recommend this because some software relies on it (mutt and I have heard one backup tool) but you can set your mount to relatime or even "better" noatime. The latter will completely stop updating the access time (which incures a disk write) each time a file is read.
    • Ciro Santilli Путлер Капут 六四事
      Ciro Santilli Путлер Капут 六四事 almost 8 years
    • qwr
      qwr almost 5 years
  • dmckee --- ex-moderator kitten
    dmckee --- ex-moderator kitten about 14 years
    Works on Mac OS X, too. Not sure that it is going to help with the problem at hand, though.
  • skarface
    skarface about 14 years
    wow. That's fantastic. 15+ years of admin work and I've never run into that. Thanks!
  • sorin
    sorin about 10 years
    Seems to be better than iotop because it also shows IO busy percent.
  • Rolf
    Rolf about 6 years
    Also no root or suid needed.