Throttling Hyper-V Replica Traffic
Well I already did a lot of blog posts on one of my favorite Hyper-V features called Hyper-V Replica. With Hyper-V Replica, which was introduced in Windows Server 2012, it is possible to replicate Hyper-V Virtual Machines from a Hyper-V host to another Hyper-V host or cluster. The great thing about it is that the replication is virtual machine based and optimized for replication over WAN. This allows companies to replica Virtual Machines from a primary site to a secondary site, and in case of a disaster on the primary site, Virtual Machines can be failed over to the secondary site.
Here are some of the Blog posts I wrote about Hyper-V Replica:
- Hyper-V Replica – The Game Changer
- How to setup a Virtual Machine with Hyper-V Replica
- Capacity Planner for Hyper-V Replica
In Windows Server 2012 R2, Microsoft upgraded the Hyper-V Replica to not only replicated every 5 minutes, in Windows Server 2012 R2 Hyper-V Replica allows you to replicate Virtual Machines on three different values, 30 Seconds, 5 Minutes or 15 Minutes. And the other great enhancement is the possibility to extend the replication to a third site or a hoster site.
But one of the question I get ask often is; “How do I throttle the Hyper-V Replica Traffic”. Well Hyper-V Replica does not have a checkbox in Hyper-V Manager itself or anything like that to do this. But Aashish Ramdas (Microsoft Program Manager) helped my to find basically some ways to throttle the Hyper-V Replica traffic. In all scenarios we use the NetQoS Policy to throttle the traffic. You can use Windows PowerShell or of course via Group Policy.
The first scenario is throttle the traffic from a Windows Server 2012 R2 host in another subnet. This can be used if the Hyper-V hosts on your second site or your recovery site have a different subnet. First this case only works if you are having a different subnet on the other site, because in this case not only the Hyper-V Replica traffic gets throttled, all traffic going from the Hyper-V Host to this subnet gets throttled. (This does not throttle VM traffic).
New-NetQosPolicy “Replication Traffic to 10.0.0.0/8” –DestinationAddress 10.0.0.0/8 –MinBandwidthWeightAction 40
The other solution would be to limit traffic based on the destination port. In this case all traffic from the Hyper-V host to a specific destination port gets throttled.
New-NetQosPolicy “Replication Traffic to 8080” –DestinationPort 8080 –ThrottleRateActionBitsPerSecond 100000
Another option which you should include is to filter the traffic on application which would be vmms.exe so only Hyper-Vtraffic gets throttled. But remember that also Live Migration Traffic gets throttled as well, so you have to be careful with this. You can use parameters like -IPPortMatchCondition and -IPProtocolMatchCondition to help this settings.
New-NetQosPolicy “Replication Traffic from vmms.exe" -IPPortMatchCondition 80 -AppPathNameMatchCondition *vmms.exe -IPProtocolMatchCondition TCP –ThrottleRateActionBitsPerSecond 100000
In all cases you can use Bandwidth weight settings or limit the traffic by bits per second. Another thing you have to remember, if you are using a cluster you have to set this on all the cluster nodes. And if remember to set this settings on both sites (with appropriate changes for subnet and ports of the primary site) in case of a reverse replication the limits still apply.
I can see the next question coming up: “Which of this scenarios is the best solution”. Well as always this totally depends on your environment. If you have not just two sites for example, you may have multiple sites with different bandwidth between them. I this case you may want to use different policies depending on your site.
You can get more information o the New-NetQosPolicy cmdlet on TechNet.