Skip to main content
Pure Technical Services

iSCSI Best Practices for Windows Server and FlashArray

Currently viewing public documentation. Please login to access the full scope of documentation.

This article will cover some of the iSCSI best practice recommendations for Windows Server and the Pure Storage FlashArray. This article will be updated as new or revised configurations are introduces, tested, and validated.

iSCSI and Windows Server 2008R2, 2012, 2012R2, 2016, and 2019

These are some best practices that should be implemented for the versions of Windows Server that are mentioned above.

These are recommendations by Pure Storage and Microsoft and should be thoroughly tested before being implemented in a production environment.

Some of these changes require altering the Windows registry. It is highly recommended to create a backup of the registry before making changes to it.

 

Disabling Delayed ACK and Nagle

The Windows operating system incorporates a setting for TCPIP called the Delayed Acknowledgement feature. By changing the default settings, you could possibly reduce the amount of overall network latency when using iSCSI connections. Along with this setting, the registry entry that enables Nagle should also be set to disabled. These settings must be applied to all network interface instances that are used for iSCSI traffic. If the entries do not exist, they should be created.
This is a recommended practice, however, the setting changes should be tested in your environment before altering a critical production system. 

Registry Keys

Subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\<Interface GUID>
Entry: TcpAckFrequency
Value Type: REG_DWORD
Valid Range: 0-255
Default: 2
New Setting: 1

Subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\<Interface GUID>
Entry: TcpNoDelay
Value Type: REG_DWORD
Valid Range: 0-1
Default: 0
New Setting: 1

​This image illustrates the new settings.

tcp.png

PowerShell to Add or Change Registry Keys

<# Script to disable Nagle (TcpNoDelay) and TcpAckFrequency on a per adapter basis.
Example - PureiSCSITcpSettings.ps1 -AdapterName "NIC1"
You can determine your adapter names by executing a Get-NetAdapter
This script should be tested in a non-production environment before implementing in production.
#>
Param(
    [parameter(position = 0, mandatory = $true)]
	[string]$AdapterName
)

    $adapterGuid = (Get-NetAdapterAdvancedProperty -Name $adapterName -RegistryKeyword "NetCfgInstanceId" -AllProperties).RegistryValue
    $RegKeyPath = "HKLM:\system\currentcontrolset\services\tcpip\parameters\interfaces\$adapterGuid\"
    $TAFRegKey = "TcpAckFrequency"
    $TNDRegKey = "TcpNoDelay"

    ## TcpAckFrequency
        if (-not (Get-ItemProperty $RegkeyPath $TAFRegKey -ErrorAction SilentlyContinue)) {
            Write-Host "Registry key does not exist. Creating..."
            New-ItemProperty -Path $RegKeyPath -Name 'TcpAckFrequency' -Value '1' -PropertyType DWORD -Force
        }
        else {
            Write-host "Registry key exists. Making sure value is set to 1"
            Set-ItemProperty -Path $RegKeyPath -Name 'TcpAckFrequency' -Value '1' -Type DWORD -Force
        }

    ## TcpNoDelay
        if (-not (Get-ItemProperty $RegkeyPath $TNDRegKey -ErrorAction SilentlyContinue)) {
            Write-Host "Registry key does not exist. Creating..."
            New-ItemProperty -Path $RegKeyPath -Name 'TcpNoDelay' -Value '1' -PropertyType DWORD -Force
        }
        else {
            Write-host "Registry key exists. Making sure value is set to 1"
            Set-ItemProperty -Path $RegKeyPath -Name 'TcpNoDelay' -Value '1' -Type DWORD -Force
        }
### END

Setting Power Plan to High Performance

Use these commands to set the Power Plan to High Performance on Windows Server.

PS >$p = Get-CimInstance -Name root\cimv2\power -Class win32_PowerPlan -Filter "ElementName = 'High Performance'"
Caption        :
Description    : Favors performance, but may use more energy.
ElementName    : High performance
InstanceID     : Microsoft:PowerPlan\{8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c}
IsActive       : False
PSComputerName :

PS >powercfg /setactive ([string]$p.InstanceID).Replace("Microsoft:PowerPlan\{","").Replace("}","")
Caption        :
Description    : Favors performance, but may use more energy.
ElementName    : High performance
InstanceID     : Microsoft:PowerPlan\{8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c}
IsActive       : True
PSComputerName :

Disable Network Adapter Power Management

Warning - This command will cause a network adapter reset unless the -NoRestart switch is used. If -NoRestart is used, you must manually restart the network adapter via the Windows UI or script to reset the network adapter and activate the power management setting. For more information, refer to this Microsoft documentation.

Alter the -Name parameter to reflect the name of the adapter to be modified.

PS C:\> Disable-NetAdapterPowerManagement -Name "Ethernet1"

Disable DelayedAckFrequency in NetTCP Global Settings (Server 2016 and later only)

This setting allows for reducing the time to wait and can increase throughput on low latency networks by accelerating growth in the TCP window size. This should only be changed on low latency networks.

# DelayedAckFrequency for Global Network Group
     $daf = (Get-NetTcpSetting -SettingName "DatacenterCustom").TcpAckFrequency
      if ( $daf -eq "1" ) {
            Write-Host "DelayedAckFrequency already disabled for DatacenterCustom."
      }
      else {
            Set-NetTcpSetting -SettingName "DatacenterCustom" -DelayedAckFrequency "1"
            Write-Host "Network change for DelayedAckFrequency successful."
     }