This is a summary of possible improvements on the OVS tunnel manager.

Please note: Enhancements are not listed in order of priority or importance. 

On the Cloudstack management server, we will need to make sure that XenServer-specific code, such as the one for creating or finding a network, is either adapted to be hypervisor-agnostic, or refactored with an hypervisor-agnostic interface and hypervisor-specific drivers.

While this clearly reduces the amount of broadcast traffic on the network, it increases the management burden for Cloudstack. It is vital that entries are added and invalidated into this cache in an appropriate way. While invalidation should always occur in cases such as VM stop, VM pause, and VM migration, there are several strategies for populating this cache, for instance:

In the current implementation the overall number of tunnels is quite a limit to the scalability of the overlay network; this because information about each tunnel needs to be stored in the management server DB. The number of tunnels per tenant is also a concern as we need update this part of the state every time a VM is started/migrated/resumed on a ‘new’ host or the last VM on a given host is stopped/paused/moved/terminated. We currently can do a lot of more in terms of managing state updates; there is large room for improvement over the way we do it today as we currently create tunnels serially and wait for a response from the host for each tunnel.

The actual number of tunnels is given by SUM[i=0...m, ni(ni-1)] where m is the number of networks and ni is the number of hosts where vms for the ith network are deployed. We could calculate the total number of tunnels as a statistical distribution, but this is going to be very complex. The worst case is when VMs for each network are spread across all hosts, in which case we’ll have, for instance, about 50M tunnels per network on 7K hosts. In the best case however, when each network is deployed on a distinct host, we’ll have no tunnels at all.
The numbers can look quite scary; the current database structure is, after all, very trivial. It is however useful as it allows us to not create a tunnel between two host if it is already in place.  The size of the state currently grows linearly with the number of networks (tenants), and in a quadratic way with the number of hosts where VMs in a given network are deployed. 

Here are some examples:

Hosts

Networks

Hosts/Network

Tunnels

Tunnels/host

500

1000

10

90,000

180

5000

10000

10

900,000

180

500

100

100

990,000

1980

5000

50

2000

199,900,000

9798.6

So things are obviously much worse as networks start to get spread over a large number hosts. This is typical of scenario with fewer, larger tenants. 
A tradeoff that it might be considered is whether we want to have a single mesh for all networks, and then distinguish each tenant’s traffic within the mesh, or have a distinct mesh for each tenant as we do today.


Anyway, a better way for storing mesh state is certainly required.  For instance we might have an entry for each host, and a field describing which tunnels departing from that host are not working or are not yet confirmed to be working. This alone would reduce the size of the state to manage by an order or magnitude.


The number of flow table rules might actually become another issue, but at this time we have no data points on their impact on throughput. With the current implementation, on each vswitch bridge, we will have 4 rules for each tunnel, and 2 rules for each VIF.

Here are some example numbers:

Hosts/Network

VMs/Host

Total Flow table entries

10

2

4*9 + 2*2 = 40

20

2

4*19 + 2*2 = 80

10

4

4*9 + 2*4 = 44

20

4

4*19 + 2*4 = 84


In order to mitigate this issue, Jumbo Frames can be enabled. However, this should be considered carefully due to possible interoperability issues. Ideally, a different technique for implementing overlays might be consider. The latest open vSwitch release supports STT (Stateless Transport Tunnelling - IETF proposal available here: http://tools.ietf.org/html/draft-davie-stt-01), which is a viable alternative to GRE. Among the other alternatives VxLAN (IETF proposal: http://tools.ietf.org/html/draft-mahalingam-dutt-dcops-vxlan-00) is definitely worth being considered. As of today VxLAN is not yet available for Open vSwitch. The adoption of this protocol is therefore subject to it being supported in OVS; however an alternative would be building overlays using Cisco N1kV, which apparently will be soon available for KVM (It's being currently demoed at CLUS running on KVM with Openstack Quantum) - and probably for XenServer as well. Even if OVS, being Open Source and multi-layer, remains our first choice, Cisco Nexus 1000v shoul be followed closely as well, as it might provide a easy way for building overlay networks across all the hypervisors supported by Apache Cloudstack.