{"id":18904,"date":"2020-11-19T07:11:38","date_gmt":"2020-11-19T07:11:38","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=18904"},"modified":"2023-10-14T07:15:50","modified_gmt":"2023-10-14T07:15:50","slug":"use-iotop-measure-speed-data-reads-writes-linux","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/use-iotop-measure-speed-data-reads-writes-linux\/","title":{"rendered":"How to Use \u2018iotop\u2019 to Measure the Speed of Data Reads\/Writes on Storage Devices in Linux"},"content":{"rendered":"<p><img decoding=\"async\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2022\/10\/How-to-Use-IOTOP-Utility-for-Storage-I_O-Performance-Tests-1024x768.jpg\" alt=\"How to Use IOTOP Utility for Storage I_O Performance Tests\" width=\"1024\" height=\"768\" class=\"alignnone size-large wp-image-18910 lazyload\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2022\/10\/How-to-Use-IOTOP-Utility-for-Storage-I_O-Performance-Tests-1024x768.jpg 1024w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2022\/10\/How-to-Use-IOTOP-Utility-for-Storage-I_O-Performance-Tests-300x225.jpg 300w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2022\/10\/How-to-Use-IOTOP-Utility-for-Storage-I_O-Performance-Tests-128x96.jpg 128w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2022\/10\/How-to-Use-IOTOP-Utility-for-Storage-I_O-Performance-Tests-420x315.jpg 420w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2022\/10\/How-to-Use-IOTOP-Utility-for-Storage-I_O-Performance-Tests-540x405.jpg 540w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2022\/10\/How-to-Use-IOTOP-Utility-for-Storage-I_O-Performance-Tests-720x540.jpg 720w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2022\/10\/How-to-Use-IOTOP-Utility-for-Storage-I_O-Performance-Tests-960x720.jpg 960w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2022\/10\/How-to-Use-IOTOP-Utility-for-Storage-I_O-Performance-Tests-1140x855.jpg 1140w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2022\/10\/How-to-Use-IOTOP-Utility-for-Storage-I_O-Performance-Tests-1320x990.jpg 1320w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2022\/10\/How-to-Use-IOTOP-Utility-for-Storage-I_O-Performance-Tests.jpg 1400w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/768;\" \/><\/p>\n<p>In the world of Linux administration, monitoring system performance is crucial. One of the key aspects of system performance is Input\/Output (I\/O) operations, especially when it comes to storage devices. Whether you&#8217;re running a <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-are-web-servers-and-why-are-they-needed\/\">web server<\/a>, a database, or any other application, the speed at which your system reads and writes data can significantly impact its overall performance.<\/p>\n<p>There are several tools available for Linux to monitor I\/O operations, but one of the most popular and comprehensive tools is iotop. This tool allows administrators to get a real-time view of disk I\/O activity on a system. Whether you&#8217;re on a <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-dedicated-server-hosting\/\">dedicated server<\/a>, a <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-vps-hosting\/\">VPS server<\/a>, or even <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-cloud-hosting\/\">cloud hosting<\/a>, monitoring storage I\/O is essential.<\/p>\n<p>In this tutorial, we will show how to use iotop to measure the speed of data reads\/writes on storage devices.<\/p>\n<p>Let&#8217;s get started.<\/p>\n<h2>Prerequisites<\/h2>\n<ul>\n<li>A Linux machine or server.<\/li>\n<li>Root or sudo access to the machine.<\/li>\n<li>`iotop` installed on the system. If not, we will cover the installation process.<\/li>\n<\/ul>\n<h2>Installing iotop<\/h2>\n<p>Before we can use iotop, we need to ensure it&#8217;s installed on our system.<\/p>\n<p>For Debian\/Ubuntu:<\/p>\n<pre>\r\nsudo apt update\r\nsudo apt install iotop\r\n<\/pre>\n<p>For CentOS\/Red Hat:<\/p>\n<pre>\r\nsudo yum install iotop\r\n<\/pre>\n<h2>Using iotop<\/h2>\n<p>Once installed, you can start iotop by simply typing:<\/p>\n<pre>\r\nsudo iotop\r\n<\/pre>\n<p>This command will display a real-time view of I\/O operations happening on your system. You&#8217;ll see columns for the process ID, user, disk read, disk write, swap, and command.<\/p>\n<p>For example:<\/p>\n<pre>\r\nTotal DISK READ: 0.00 B\/s | Total DISK WRITE: 15.67 K\/s\r\nTID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND\r\n1234 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % [kworker\/u8:2]\r\n5678 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % [kworker\/u8:0]\r\n9012 be\/4 root        0.00 B\/s    3.91 K\/s  0.00 %  0.00 % [jbd2\/sda1-8]\r\n3456 be\/4 www-data    0.00 B\/s   11.76 K\/s  0.00 %  0.00 % apache2 -k start\r\n7890 be\/4 mysql       0.00 B\/s    0.00 B\/s  0.00 %  0.00 % mysqld\r\n<\/pre>\n<p>Here&#8217;s a breakdown of the output:<\/p>\n<ul>\n<li><strong>Total DISK READ<\/strong>: This shows the total read speed from all processes.<\/li>\n<li><strong>Total DISK WRITE<\/strong>: This shows the total write speed from all processes.<\/li>\n<li><strong>TID<\/strong>: This is the thread ID.<\/li>\n<li><strong>PRIO<\/strong>: This is the I\/O priority of the process.<\/li>\n<li><strong>USER<\/strong>: This is the user running the process.<\/li>\n<li><strong>DISK READ<\/strong>: This shows the current read speed of the process.<\/li>\n<li><strong>DISK WRITE<\/strong>: This shows the current write speed of the process.<\/li>\n<li><strong>SWAPIN<\/strong>: This shows the percentage of time the thread spent while swapped out.<\/li>\n<li><strong>IO&gt;<\/strong>: This shows the percentage of time the thread spent while waiting on I\/O to complete.<\/li>\n<li><strong>COMMAND<\/strong>: This is the name of the command or process.<\/li>\n<\/ul>\n<h2>Interpreting the Output<\/h2>\n<p>The main columns to focus on are:<\/p>\n<ul>\n<li><span class=\"fw-bold\">DISK READ<\/span> \u2013 Shows the current read speed of a process.<\/li>\n<li><span class=\"fw-bold\">DISK WRITE<\/span> \u2013 Displays the current write speed of a process.<\/li>\n<\/ul>\n<pre>\r\nTotal DISK READ: 0.00 B\/s | Total DISK WRITE: 15.67 K\/s\r\nTID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND\r\n1234 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % [kworker\/u8:2]\r\n5678 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % [kworker\/u8:0]\r\n9012 be\/4 root        0.00 B\/s    3.91 K\/s  0.00 %  0.00 % [jbd2\/sda1-8]\r\n3456 be\/4 www-data    0.00 B\/s   11.76 K\/s  0.00 %  0.00 % apache2 -k start\r\n7890 be\/4 mysql       0.00 B\/s    0.00 B\/s  0.00 %  0.00 % mysqld\r\n<\/pre>\n<p><strong>Interpretation:<\/strong><\/p>\n<ol>\n<li><strong>Total DISK READ: 0.00 B\/s<\/strong>\n<ul>\n<li>The system is currently not reading any data from the storage devices. This means there&#8217;s no active data retrieval happening at this moment.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Total DISK WRITE: 15.67 K\/s<\/strong>\n<ul>\n<li>The system is writing data to the storage devices at a rate of 15.67 Kilobytes per second. This indicates there are active write operations occurring.<\/li>\n<\/ul>\n<\/li>\n<li><strong>TID 1234 &amp; 5678 ([kworker\/u8:2] &amp; [kworker\/u8:0])<\/strong>\n<ul>\n<li>These are kernel worker threads. They&#8217;re not reading or writing any data to the disk at this moment. Kernel worker threads handle background tasks within the Linux kernel.<\/li>\n<\/ul>\n<\/li>\n<li><strong>TID 9012 ([jbd2\/sda1-8])<\/strong>\n<ul>\n<li>This is a journaling block device thread for the <code>sda1<\/code> partition. It&#8217;s writing data at 3.91 Kilobytes per second. This process is responsible for journaling in the ext4 filesystem, ensuring data integrity.<\/li>\n<\/ul>\n<\/li>\n<li><strong>TID 3456 (apache2 -k start)<\/strong>\n<ul>\n<li>This is an Apache web server process. It&#8217;s writing data at a rate of 11.76 Kilobytes per second. This could be due to logging, caching, or other write operations related to web server activities.<\/li>\n<\/ul>\n<\/li>\n<li><strong>TID 7890 (mysqld)<\/strong>\n<ul>\n<li>This is a MySQL database server process. It&#8217;s currently not performing any read or write operations. This suggests that the database is either idle or processing tasks that don&#8217;t involve disk I\/O at this exact moment.<\/li>\n<\/ul>\n<\/li>\n<li><strong>SWAPIN &amp; IO&gt; Columns<\/strong>\n<ul>\n<li>All processes have a <code>0.00%<\/code> in the SWAPIN column, indicating that none of them are being swapped in from the swap space. This is a good sign as it means the system has enough RAM to handle the current tasks.<\/li>\n<li>Similarly, all processes have a <code>0.00%<\/code> in the IO&gt; column, meaning they&#8217;re not waiting on I\/O operations to complete. This suggests that the storage devices are responding promptly to requests.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><strong>Overall Impression:<\/strong> The system is in a relatively idle state regarding disk reads, but there are some write operations, primarily from the Apache web server and the ext4 filesystem&#8217;s journaling process. The system&#8217;s RAM is sufficient for the current workload, as no processes are being swapped in or out. The storage devices are also performing efficiently, with no processes waiting on I\/O operations.<\/p>\n<h2>Commands Mentioned<\/h2>\n<ul>\n<li><span class=\"fw-bold\">sudo apt update<\/span> \u2013 Updates the package list on Debian\/Ubuntu systems.<\/li>\n<li><span class=\"fw-bold\">sudo apt install iotop<\/span> \u2013 Installs iotop on Debian\/Ubuntu systems.<\/li>\n<li><span class=\"fw-bold\">sudo yum install iotop<\/span> \u2013 Installs iotop on CentOS\/Red Hat systems.<\/li>\n<li><span class=\"fw-bold\">sudo iotop<\/span> \u2013 Starts the iotop tool to monitor I\/O operations.<\/li>\n<\/ul>\n<h2>FAQ<\/h2>\n<ol itemscope itemtype=\"https:\/\/schema.org\/FAQPage\">\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is the main purpose of iotop?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n            <span itemprop=\"text\">The primary purpose of `iotop` is to provide a real-time view of disk I\/O activity on a Linux system. It allows administrators to monitor and identify processes that are reading or writing to the disk extensively, which can be useful for performance tuning and troubleshooting.<\/span>\n        <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">How is iotop different from top?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n            <span itemprop=\"text\">While both `iotop` and `top` are monitoring tools, `iotop` focuses specifically on disk I\/O operations, displaying processes that are reading or writing to the disk. In contrast, `top` provides a general overview of system performance, including CPU and memory usage.<\/span>\n        <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">Do I need root access to run iotop?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n            <span itemprop=\"text\">Yes, to get a comprehensive view of all processes and their I\/O operations, you need root or sudo privileges to run `iotop`.<\/span>\n        <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">Can I filter the output of iotop?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n            <span itemprop=\"text\">Yes, `iotop` comes with several command-line options that allow you to filter the output. For instance, using the `-o` or `&#8211;only` option will display only processes that are currently doing I\/O operations.<\/span>\n        <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">Is iotop available for all Linux distributions?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n            <span itemprop=\"text\">`iotop` is widely available for most major Linux distributions. However, it&#8217;s always a good idea to check your distribution&#8217;s package manager or repository to ensure its availability.<\/span>\n        <\/p>\n<\/li>\n<\/ol>\n<h2>Conclusion<\/h2>\n<p>Monitoring storage I\/O performance is crucial for ensuring optimal system performance, especially for applications that heavily rely on disk operations. iotop is an invaluable tool for Linux administrators and webmasters, offering a real-time view of disk I\/O activity. By understanding which processes are consuming the most I\/O resources, you can make informed decisions about system tuning, application optimization, and infrastructure upgrades.<\/p>\n<p>For those managing web servers, whether it&#8217;s <a href=\"https:\/\/webhostinggeeks.com\/blog\/apache-http-server-explained\/\">Apache<\/a>, <a href=\"https:\/\/webhostinggeeks.com\/blog\/nginx-server-explained\/\">Nginx<\/a>, or <a href=\"https:\/\/webhostinggeeks.com\/blog\/litespeed-web-server-explained\/\">LiteSpeed<\/a>, iotop becomes an essential tool in the toolkit. It helps ensure that your server, whether it&#8217;s on a <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-dedicated-server-hosting\/\">dedicated server<\/a>, a <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-vps-hosting\/\">VPS server<\/a>, <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-cloud-hosting\/\">cloud hosting<\/a>, or <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-shared-hosting\/\">shared hosting<\/a>, operates at peak performance.<\/p>\n<p>Furthermore, as data-driven applications continue to grow in complexity and size, the importance of monitoring tools like iotop cannot be overstated. From databases to content management systems, the speed and efficiency of data reads\/writes play a pivotal role in the overall user experience.<\/p>\n<p>In conclusion, iotop is more than just a monitoring tool; it&#8217;s a window into the intricate operations of your Linux system. By leveraging its capabilities, you can ensure that your applications run smoothly, your servers respond quickly, and your storage devices maintain their longevity. As with any tool, the key is to use it regularly, understand its output, and take proactive measures based on the insights it provides. Whether you&#8217;re a seasoned Linux administrator or just starting out, make iotop a part of your regular system checks, and you&#8217;ll be well-equipped to handle the challenges of modern web hosting and server management.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the world of Linux administration, monitoring system performance is crucial. One of the key aspects of system performance is Input\/Output (I\/O) operations, especially when it comes to storage devices&#8230;.<\/p>\n","protected":false},"author":6,"featured_media":18910,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2152],"tags":[2182,2153],"class_list":["post-18904","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-benchmarking","tag-iotop","tag-test"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/18904","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=18904"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/18904\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/18910"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=18904"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=18904"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=18904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}