Network throttling rate parameter can be configured in:
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)
Throttling is being set on per VM's Nic depending on VM's type.
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)
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 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));
TBD - Edison Su, please put the details there
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);
TBD - Rajesh Battala, please put the details there