Introduction

Network throttling is the process of controlling the network access and bandwidth usage based on certain rules. CloudStack controls this behavior by setting network throttling parameter set on VM's nic(s). This parameter is defined as the default data transfer rate in Mbps (Megabits Per Second).

How to configure network throttling in CloudStack

Network throttling rate parameter can be configured in:

 

  • Service offering.
  • Network offering.
  • Global Config (network.throttling.rate, vm.network.throttling.rate)

0 means unlimited.

If the value is set to NULL in service/network offerings, it means that we should take the rate from the Global Configuration (network.throttling.rate - used by network offering, vm.network.throttling.rate - used by service offering)

 

Default throttling values:

  • For default Public/Storage/Control/Management network offerings throttling rate is set to 0 (Unlimited).
  • For default Guest network offerings throttling rate is set to NULL (and in this case it will be defaulted to Global config value)

Network throttling on different types of CS Virtual Machines

Throttling is being set on per VM's Nic depending on VM's type.

  • UserVm can have 1 Default network and 0-n additional networks (optional). For the default VM's nic, we take network throttling rate from the corresponding Service Offering, for all additional networks - from the corresponding Network Offerings.
  • For the VR Guest and Public networks we take network throttling from the corresponding Guest Virtual networkOffering. For the VR Control/Management network, we take it from the corresponding System Network Offering.
  • For all nics on SSVM/CPVM, throttling rate is Unlimited (not configurable)

 

Here is the picture explaining how throttling set on the VR's guest nic and VM's nic, affect traffic flows a) from User VM to User VM b) from User VM to internet (traffic goes through VR in this case)

How throttling is set on Hypervisor level

On the hypervisor side, network throttling is begin set on a VM's NIC level. Implementation depends on the hypervisor. For example, on Xen its set per VM's vif; on vmWare - port group is configured on vSwitch, and the group gets assigned to the vm.

Currently CloudStack network throttling is supported on the hypervisors below - implementation details are included.

XenServer

XenServer programs QOS on VIF object,

            vifr.qosAlgorithmType = "ratelimit";
            vifr.qosAlgorithmParams = new HashMap<String, String>();
            // convert mbs to kilobyte per second
            vifr.qosAlgorithmParams.put("kbps", Integer.toString(nic.getNetworkRateMbps() * 128));

KVM

TBD - Edison Su, please put the details there

VmWare

Under VMware, network throttling is implemented through traffic shaping control at portgroup level, all VMs (NICs) connected to the same portgroup share the same traffic shaping policy. Following gives an example on how traffic shaping policy is created and used when creating the portgroup.

HostNetworkTrafficShapingPolicy shapingPolicy = null;
if(networkRateMbps != null && networkRateMbps.intValue() > 0) {
    shapingPolicy = new HostNetworkTrafficShapingPolicy();
    shapingPolicy.setEnabled(true);
    shapingPolicy.setAverageBandwidth((long)networkRateMbps.intValue()*1024L*1024L);

    // give 50% premium to peek

    shapingPolicy.setPeakBandwidth((long)(shapingPolicy.getAverageBandwidth()*1.5));

   // allow 5 seconds of burst transfer
   shapingPolicy.setBurstSize(5*shapingPolicy.getAverageBandwidth()/8);
}

 

// creating a port group with specified shaping policy

hostMo.createPortGroup(vSwitch, networkName, vid, secPolicy, shapingPolicy);

HyperV

In Hyper-V, network throttling is implemented by applying the network rate value on the VM Nic Bandwidth Management property.

Bandwith Management Property allows to set Minimum and Maximum Bandwidth values.

when network rate is infinite, this Bandwidth property will be disabled (which means there is no limit)

when network rate value is set, then Minimum Bandwidth will be set to "0" Zero and Maximum Bandwidth will be set to the value provided in Mbps metric.

ROOT.virtualization.v2.Msvm_EthernetSwitchPortBandwidthSettingData.cs class  is used to manage the bandwidth settings of VM Nic

Method: SetBandWidthLimit(ulong limit, EthernetPortAllocationSettingData portPath) in Agent code will set the bandwidth/throttling rate on the Nic by reading the network.rate value received from the agent command.

 

  • No labels