It is the 21st century and everyone is in a hurry. No one today has the time or will power to sit waiting unnecessarily while an application or website loads on their computer. Now imagine this scenario from a business’s perspective. The person in question could have been a potential customer. So, it’s imperative for a business to quickly find the answers to questions like, why my website loads slow or how do I figure out why my website loads slow.
Why is my website slow?
When a user clicks to access any information, a request is shot to the web hosting server. Now, in the server, the data resides on files that are stored in Hard Disk Drives (HDDs) or more commonly, disks. To read the user requested data, the disk rotates to reach the required disk sector. This leads to waiting time, although of a few milliseconds, when processor waits for that file to be read. (Similar thing happens during the write operation).
This access time gradually adds up as the data-heavy servers process innumerable data requests and thus, retrieving the data from the storage device becomes a performance bottleneck.
Thus, to prevent application performance hiccups from disk latency, it is important to monitor disk usage and disk I/O for possible performance issues, so that you can see which application is using the disk as an important part of its core functionality. Keep reading for understanding disk I/O and how to check disk I/O performance in Linux and Windows.
What is Disk I/O?
Disk I/O includes read or write or input/output operations (defined in KB/s) involving a physical disk. In simple words, it is the speed with which the data transfer takes place between the hard disk drive and RAM, or basically it measures active disk I/O time.
It is a measure of performance and is thus used to characterize the storage devices like HDDs, SSDs and SAN.
It enables you to monitor the Read and Write operations of logical disk on your system and set thresholds. You get alerted if below-mentioned metrics reach the levels preset by you:
- Writes/sec – write operations rate.
- Reads/sec – read operations rate.
- Busy time – the % of the elapsed time when your particular disk drive was busy in servicing write or read requests.
- Queue length – the number of requests on the disk that are in the queue.
Monitor disk I/O utilization on servers with Linux and Windows OS
1. Monitoring Linux Disk I/O activity using IOTOP and IOSTAT commands
First of all, type top command in the terminal to check the load on your server. If the output is not satisfactory, then look into wa status to know the status of Read and Write IOPS on the hard disk. If it is high, then we need to check I/O activity in Linux box using the iotop or iostat commands. By using iotop command, you can monitor the disk utilization by individual processes.
- Let’s first start with iotop command
Type the command:
You will get the following output:
By typing the iotop command with o option, you will get the actual I/O activity.
• With iostat command
With the help of iostat command, you will get the individual hard disk I/O activity. The below screenshot shows 28 and 17 percent of utilization of disks.
2. Monitoring Windows Disk I/O utilization
With the help of Windows Performance Monitor tool which is available in all versions of Windows, you can easily monitor the Windows disk usage.
There are already many pre-loaded counters, select all and press the DEL key.
Tap +sign and select the “Physical Disk” from the various “Performance Objects”.
The list of available counters appears.
Note: You can select that instance which you want to monitor. By default, it will select _Total. (This graphical interface is different for the Windows Server 2003 and 2008 R2.)
Here, we select the below four counters. Don’t forget to click on Add after selecting each one.
- Avg. Disk Bytes/Transfer
- Avg. Disk sec/Transfer
- Disk Bytes/sec
- Disk Transfers/sec
If you want to know the current values only, you can change the “view” from Line to Report in the graph tab.
You get the actual values as below:
Here, the Avg. Disk Bytes/Transfer provides the IO Size, Avg. Disk sec/Transfer is related to Average Latency, Disk Bytes/sec is equal to Throughput and last Disk Transfers/sec is IOPS.
Some important points:
- Latency is expressed in milliseconds and this performance tool provides you the values in seconds, so change accordingly for e.g. 0.020 sec = 20 ms.
- IOPS is expressed in MB/sec, Windows 2003 displays values in Bytes/second. Convert them as 1Byte/sec = 1e-6 MB/sec.
After effectively monitoring the disk IOPS utilization, you can plan accordingly for system upgrades in advance. You can even early detect the potential causes of storage subsystem failures and can reduce the risk of unexpected downtime as well.
If you have any question regarding how to check disk io in Linux or how to check disk iops in Linux, please ask or add in the comment section below.
Jyotsana Gupta - the content and communication head, is an engineer by education and a writer at heart. In technical writing for 6 years, she makes complex topics interesting to general audience. She loves going on long drives in her spare time.