02 December 2013

Manage Windows Network Bandwidth with native QOS

By default Windows process will use as much of the network as it can to complete a task as fast as possible. This is great when there is only one thing happening at a time.  If however you have a server that is handling different workloads you might want to prevent once kind of traffic from hogging all of the bandwidth and starving the others.

As an example we have a single server that hosts a HTTP site and a File Share.  When files are not being copied form the file share the Web site is responsive and works well.  When someone copies content from the file share the Web site performance deteriorates.   I ideally we want to prevent this from happening.

Lets look at the transfer rate and therefore network usage of the file copy



On this network, the speed at which the file can be copied is around 40MB/s

If we want to slow down the file copy to consume less bandwidth we can make us of the native Windows QOS Packet Scheduler.  The Quality Of Service scheduler allows us to prioritize  and limit traffic to ensure that one process does not starve another.

QOS functionality is covered by policies.  these policies  mostly lives on the group policy.  You can make QOS policy change in the group policy directly or through PowerShell using the NetQosPolicy noun

Step 1 - Check for existing policies
First up check if there are any existing policies that could conflict or override your intended policy.

Get-NetQosPolicy


Step 2 - Create a new policy
Next up we are going to create a new Policy  that applies to SMB traffic and we are going the throttle or limit the throughput to 2MB/s.

New-NetQosPolicy -Name "FileCopy" -SMB -ThrottleRateActionBitsPerSecond 2MB

At this stage we can start a file copy and see that the network usage is much lower.  

Step 3 - Adjust an existing policy
Once nice ting about QOS policies are that they apply almost immediately without any need for restarting a process or rebooting.
You can now adjust the limit with.

Set-NetQosPolicy -Name "FileCopy" -ThrottleRateActionBitsPerSecond 10MB



I ran this with a few different values and you can tell form the "steps" when they started and stopped.  You can increase or decrease the values, there is not restriction on it from that perspective.



Step 4 - Removing rules (optional)
Ultimately if you are done you can simply remove the policy with

Remove-NetQosPolicy -Name "FileCopy"

You can confirm that there are no policies left by running

Get-NetQosPolicy


Summary 
The one limitation.to be aware of when starting out is that QOS only applies to OUTBOUND traffic.  Any file copy to the server would still consume the full network that is available.

Before you start looking for other tools to help shape your network traffic, look at what is possible with Windows QOS.  This barely scratches the surface but it shows just how easy and effective it can be.  For more information check out http://technet.microsoft.com/en-us/library/hh967469.aspx




No comments:

Post a Comment