Tuesday, March 17, 2015

Throttling Hyper-V Replication Traffic

We have a client with two physical locations and a 100 Mbps link between them. For disaster recovery purposes, we are using Hyper-V replication between the two sites.

Recently we made a disk change to one of the VMs that forced us to delete and recreate replication for one of the VMs. Unfortunately it was the VM with 650 GB of data. Because replicating that amount of data in the best case will take about 13 hours over the WAN link, we need to control the replication and prevent it from interfering with normal business.

Hyper-V does not have any built in functionality to control bandwidth for replication traffic. Fortunately Windows Server 2012 R2 has quality of service (QoS) functionality built into the operating system.

In my case, the receiving server is using port 443 to receive the data. On the source server, vmms.exe is replicating the data to the destination server. I created policy that limited traffic to 50 Mbps from vmms.exe to port 443 with the following command:
New-NetQosPolicy "VM Replication" -IPPortMatchCondition 443 -AppPathNameMatchCondition vmms.exe -ThrottleRateActionBitsPerSecond 50000000
Be aware that there are other options that you can use to refine the policy. For example, you can specify destination IP, source port, destination port, or protocol (TCP or UDP). There is lots of flexibility to be as precise as you need to be.

After creating a policy, you can manage it by using:
  • Set-NetQosPolicy
  • Remove-NetQosPolicy

Microsoft documentation for New-NetQosPolicy:

No comments:

Post a Comment