Monitor Disk Throughput and IOPS using Log Analytics

Collecting information on the throughput of your storage is an important aspect of understanding how you should be monitoring your storage throughput and IOPS. This is a relatively easy thing to do by using log analytics, which is a really powerful feature within Azure.

 

What is IO Throttling

Disks in the Azure are provisioned with a maximum IOPS and Throughput. The maximum depends on both type of disk, size of disk, and if it’s a managed or unmanaged disk. If you are using the old unmanaged disk method, then you need to create a storage account which also has an IOPS cap of 20,000 IOPS/second. For detailed information about IOPS and Throughput please visit Microsoft docs: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-types

 

There is also VM throttling on IOPS and throughput, so you will always have to take the VM type and size in consideration then provisioning a high performing VM. For detailed information about this visit: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes

 

So what is Throttling? This is how Microsoft describes it on Premium Storage:
azure disk throttling

How to setup the gathering of performance counter

If you haven’t already configured a Log Analytics workspace and connected your VMs to it, then this is the first step. This is quite straight forward so I won’t go into each step for this. Just follow this steps and you will be good to go: https://azure.microsoft.com/en-us/trial/log-analytics-get-started/

What we will do now is set it up so that we collect the correct performance counters from Windows Server. We need to make sure that we collect “LogicalDisk(*)\Disk Bytes/sec” which is used to find out the throughput on each disk and we also need to make sure that we collect “LogicalDisk(*)\Disk Transfers/sec”, this is the IOPS utilization on each disk.

 

Steps

1). Go to your Log Analytics workspace

2). Advanced Settings

3). Windows Performance Counters

4). Add “LogicalDisk(*)\Disk Bytes/sec” with a sample rate of 10 seconds

5). Add “LogicalDisk(*)\Disk Transfers/sec” with a sample rate of 10 seconds

6). Wait for data to be sent to log analytics (will start within a few minutes)

 

How do we query Log Analytics?

So next step is to query Log Analytics to see how our utilization looks like. We will create two queries one for analyzing the IOPS and one for the throughput.

 

Steps

1). Go to your Log Analytics workspace

2). Go to Log

3). Query 1 will give you the Average Throughput in MB/sec in the chunks of 5 minutes. If you want to change the size of each bin you could update the “5m” to match whatever size you need.

 

Perf
| where ObjectName == "LogicalDisk" 
| where CounterName == "Disk Bytes/sec" 
| summarize ThroughputInMBs = (avg(CounterValue)/1024/1024) by Computer, bin(TimeGenerated, 5m)
| render timechart

 

Also if you want to filter on specific VM name you would add another where statement.

| where Computer = "my-vm-name"

 

 

4). Query 2 will give you the average IOPS in chunks of 5 minutes

Perf
| where ObjectName == "LogicalDisk" 
| where CounterName == "Disk Transfers/sec" 
| summarize avg(CounterValue) by Computer, bin(TimeGenerated, 5m)
| render timechart

 

 

5). Query 3 Bonus query that will give you available disk space on all disks

Perf
| where TimeGenerated > ago(1d)
| where ObjectName == "LogicalDisk" and CounterName == "% Free Space"
| summarize (TimeGenerated, Free_Space_Percent)=arg_max(TimeGenerated, CounterValue) by Computer, InstanceName
| where strlen(InstanceName) ==2 and InstanceName contains ":"

 

Do you find our content useful? Like and Share our Posts!

Leave a Reply

Your email address will not be published. Required fields are marked *