Set Round Robin IOPS limit from default 1000 to 1 using PowerCLI


Recently while working with a customer, I had a request come in where in we had to change Round Robin IOPS limit from default 1000 to 1.

There are various reasons that you would change the default value from 1000 to 1, but it is mostly for performance improvements and most of the storage vendors do recommend changing the IOPS limit to 1.

There are posts available online on how you would apply this changes on an ESXi host. But most of them are using the esxcli namespace.

Below is an example from the VMware KB article which will change IOPS to 1 on every single LUN that the Path Selection Policy set to Round Robin.

for i in ‘esxcfg-scsidevs -c |awk ‘{print $1}’ | grep naa.xxxx’; do esxcli storage nmp psp roundrobin deviceconfig set --type=iops --iops=1 --device=$i; done

Where .xxxx matches the first few characters of your naa IDs.

This method will work fine if you have to perform this one single host. If you have to manually log into every single ESXi host using an SSH session, then this can be troublesome.

This is where PowerCLI comes into the picture. Using PowerCLI, we can set Round Robin IOPS limit from default 1000 to 1 on every single LUN in every single host connected to the vCenter Server.

If you search online, there are a few articles that talk about using PowerCLI, but they still reply on the Get-Esxcli cmdlet and honestly it is quite confusing.

If you are using PowerCLI 5.0 and above, then you can use the Set-ScsiLun cmdlet to change the IOPS limit value.

Now enough of the background, let us look at how can we set Round Robin IOPS limit from default 1000 to 1.

Connect-VIServer -Server “vCenterServerName” -User [email protected] -Password “Password”
$ESXiHosts = Get-Cluster “ClusterName” | Get-VMHost
foreach ($ESXi in $ESXiHosts)
Get-VMhost $ESXi | Get-ScsiLun -LunType Disk | Where-Object {$_.CanonicalName -like ‘t10.*’ -and $_.MultipathPolicy -like ‘RoundRobin’} | Set-ScsiLun -CommandsToSwitchPath 1

In the above script, we are first connecting to the vCenter Server using the Connect-VIServer cmdlet.

In the second line, we are assigning all the ESXi host in the cluster to the variable called $ESXiHosts.

In the foreach loop, every single LUN on the ESXi host has the path selection policy selected as RoundRobin and starting with naa.xxxx, we are setting the IOPS limit to 1 using the Set-ScsiLun cmdlet with the parameter CommandsToSwitchPath.

To check the output, you can the run below command.

Get-VMHost ESXi65-E.lab.local | Get-ScsiLun -LunType Disk | Where-Object {$_.MultiPathPolicy -like ‘RoundRobin’} | Select-Object CanonicalName, MultipathPolicy, CommandsToSwitchPath

Set Round Robin IOPS limit from default 1000 to 1 using PowerCLI

In my test lab, since I am using OpenFiler, you would see that the LUN ID start from t10, normally in a production environment it would either start with naa.* or eui.*

I hope this has been informative and thank you reading!


About Author

I am Adil Arif, working as a Senior Technical Support Engineer at Rubrik as well as an independent blogger and founder of Enterprise Daddy. In my current role, I am supporting infrastructure related to Windows and VMware datacenters.

1 Comment

  1. Hello Adil, pardon mi ignorance but… does it have to be 1000 or 1 at all? Can it be a value in the middle? If not, why? If you could even point me to a document that explains the answer I’m looking for it’d be great! Many thanks

Leave A Reply