## 5 Dynamic Bandwidth Allocation
### Dynamic Bandwidth Allocation Adjustment
Eventually, this incurs bandwidth contention at the receiver side. Therefore, a congestion detector is introduced to detect the congestion on the destination VM in a timely manner. Meanwhile, the Congestion Controller component is responsible of regulating the sending rate of each source VM by using the rate limiters on every virtual interface of VM. These rate limiters are dynamically created to control the sending rate of each source VM since congestion is detected at the destination. If the VM-to-VM flows disappear, the corresponding rate limiters will be deleted. Observation in \(T_{track}\): The distributed bandwidth enforcer tracks the receiving rate at the endpoint periodically (in an epoch of 10 ms), and the enforcer can be further utilized to calculate the sending rate for every sender. In order to react to the congestion problem quickly, we try to achieve average rate guarantees [30] within a short time. The key of bandwidth guarantee enforcement depends on how to identify congestion at the receiver side and determine an appropriate traffic rate for each VM-to-VM flow at the sender side. Traffic congestion in the network can be determined according to the packet loss at receiver. Congestion can be prevented by allocating the received bandwidth among all active VM-to-VM flows in a timely and even way, and then, the allocated bandwidth guarantees can be enforced at the senders. In the mean time, these senders are marked as tagged so that the DBA module cannot change their allocated bandwidth guarantees arbitrarily at the sender sides, until the receiving rate at the receiver side has become significantly smaller than the allocated rate in several epochs. If the bandwidth at receiver has increased, the increased part will be allocated to the senders equally, which can reduce the frequency of congestion in short time. The DBA module allocates the redundant bandwidth (m) by distinguishing the senders (n) from one receiver, and the receiver can get the total bandwidth m whilethe senders obtain the bandwidth of m/n in average. However, the specific bandwidth demand of each VM-to-VM flow cannot be described accurately using this bandwidth allocation method. To address this problem, the demands of VM-to-VM flows are further estimated by measuring their throughput between epochs based on the principle of max-min fairness. The distributed control loop Algorithm 2 is designed to enforce per-tenant bandwidth guarantees, and its algorithm is as follows. ```
1 Let boundedcollection BC denote the flows with stable traffic rate smaller than the allocated bandwidth;
2 Let unboundedcollection UNBC denote the flows with unstable traffic rate smaller than or equal to the allocated bandwidth;
3\(ratelimiterstatus\Leftarrow untagged\);
4 if congestion takes placethen
5 set each source VM rate to average receive bandwidth;
6\(ratelimiterstatus\Leftarrow tagged\);
7 max-min-allocate() under the total network capacity of the receiver;
8 periodically(){
9 set BC and UNBC according to the continuous several rate measurement;
10 forflow\(f\) in BCdo
11\(f.ratelimiterstatus\Leftarrow\) tagged &&\(\frac{fallocated-f.rate}{f.allocated}>30\%\,f.ratelimiterstatus\Leftarrow\) untagged;
12 allocate the redundant bandwidth from BC to the flows in the UNBC evenly;
13}
```

**Algorithm 2**Distributed control loop. Flow bounded assertion: One tenant can lend its spare bandwidth to other tenants if and only if one or more of the flows are asserted as bounded. If the flow traversing on the link stays stable and does not request any extra bandwidth, it is called the bounded flow. Here, the key is how to determine whether the flow is bounded or not. We try to decide whether the flow is bounded by monitoring the flow rate in several epochs. However, there is another issue, and if the epoch is too short, the rate monitored in an epoch is not very accurate, in which case, a longer epoch is required. Thus, to maintain one set of data for each epoch, the moving average technique is employed to smooth the rate observed in an epoch.