Patent Publication Number: US-11394640-B2

Title: Collecting and analyzing data regarding flows associated with DPI parameters

Description:
RELATED APPLICATIONS 
     Benefit is claimed under 35 U.S.C. 119(a)-(d) to Foreign Application Serial No. 201941051487 filed in India entitled “COLLECTING AND ANALYZING DATA REGARDING FLOWS ASSOCIATED WITH DPI PARAMETERS” on Dec. 12, 2019, by VMWARE, Inc., which is herein incorporated in its entirety by reference for all purposes. 
     In recent years, several companies have brought to market solutions for deploying software defined (SD) wide-area networks (WANs) for enterprises. Some such SD-WAN solutions use external third-party private or public cloud datacenters (clouds) to define different virtual WANs for different enterprises. These solutions typically have edge forwarding elements (called edge devices) at edge nodes of an enterprise that connect with one or more gateway forwarding elements (called gateway devices or gateways) that are deployed in the third-party clouds. 
     In such a deployment, an edge device connects through one or more secure connections with a gateway, with these connections traversing one or more network links that connect the edge device with an external network. Examples of such network links include MPLS links, 5G LTE links, commercial broadband Internet links (e.g., cable modem links or fiber optic links), etc. The edge nodes include branch offices (called branches) of the enterprise, and these offices are often spread across geographies with network links to the gateways of various different network connectivity types. These SD-WAN solutions employ deep packet inspection to inform some of the operations that they perform. 
     BRIEF SUMMARY 
     Some embodiments provide a method for performing deep packet inspection (DPI) for an SD-WAN (software defined, wide area network) established for an entity by a plurality of edge nodes and a set of one or more cloud gateways. At a particular edge node, the method uses local and remote deep packet inspectors to perform DPI for a packet flow. Specifically, the method initially uses the local deep packet inspector to perform a first DPI operation on a set of packets of a first packet flow to generate a set of DPI parameters for the first packet flow. 
     The method then forwards a copy of the set of packets to the remote deep packet inspector to perform a second DPI operation to generate a second set of DPI parameters. In some embodiments, the remote deep packet inspector is accessible by a controller cluster that configures the edge nodes and the gateways. In some such embodiments, the method forwards the copy of the set of packets to the controller cluster, which then uses the remote deep packet inspector to perform the remote DPI operation. The method receives the result of the second DPI operation, and when the generated first and second DPI parameters are different, generates a record regarding the difference. 
     In some embodiments, the method uses the generated record to improve the local deep packet inspector&#39;s operation. For instance, in some embodiments, the local deep packet inspector is a third-party inspector that is used by the particular edge node, and the generated record is used to identify different flows for which the third-party inspector has poor DPI performance. When the generated record specifies a discrepancy between the first and second sets of generated DPI parameters, the method in some embodiments sends data regarding the discrepancy to a remote machine to aggregate with other data regarding other discrepancies in the DPI operations performed for other packet flows through the WAN. 
     In some embodiments, the method specifies a generated first set of DPI parameters as the set of DPI parameters associated with the first packet flow, after the first DPI operation is completed. When the first and second DPI parameter sets are different, the method in some embodiments modifies the set of DPI parameters associated with the first packet flow based on the generated second set of DPI parameters. For instance, in some embodiments, the method modifies the set of DPI parameters by storing the second set of DPI parameters as the set of DPI parameters associated with the first packet flow. 
     In some embodiments, the method forwards each packet to its destination after the local deep packet inspector has processed the packet. In other embodiments, however, the method delays the forwarding of packets of the first flow to the destination of the flow while performing the first DPI operation. During this time, the method stores the delayed packets in a storage queue of the particular edge node. Once the first DPI operation has been completed, the method forwards the set of packets stored in the storage queue as well as subsequent packets of the first flow to the destination. It also then forwards a copy of the set of packets to the remote deep packet inspector. 
     In some embodiments, the method forwards the packets of the first packet flow based on the generated first set of DPI parameters. For example, in some embodiments, the method uses at least one parameter in the generated first set of DPI parameters to select a path through the WAN to forward the packets of the first packet flow. When the generated first and second sets of DPI parameters are different, the method in some embodiments modifies the forwarding of the packets of the first packet flow, by using the second set of DPI parameters to forward (e.g., to select a path for) the packets of the first packet flow. 
     In some embodiments, the method forwards, from the particular edge node, at least a subset of the generated DPI parameters to other edge nodes directly or indirectly through the controller set. Also, in some embodiments, the method forwards, from the particular edge node, at least a subset of the generated DPI parameters to at least one gateway, again directly or indirectly through the controller set. In some embodiments, a generated DPI parameter set includes an identifier that identifies a type of traffic carried in payloads of the packets. 
     In these or other embodiments, a generated DPI parameter set includes an identifier that identifies an application that is a source of the first packet flow and/or an identifier that identifies a class of application to which this source belongs. In some embodiments, the remote or local deep packet inspector does not generate an identifier for the source application or class. In these embodiments, the edge node or controller cluster generates one or both of these identifiers by mapping the traffic type identifier produced by the DPI operations to the application or class identifiers. 
     The particular edge node in some embodiments is an edge machine (e.g., virtual machine (VM), container, standalone appliance, a program executing on a computer, etc.) that operates at an office (e.g., branch office) or datacenter of an entity with several computers, and this edge node connects the computers to the WAN. In some of these embodiments, the local deep packet inspector operates (e.g., as a VM or container) on a first computing device along with the edge node machine, while the remote deep packet inspector operates on a separate, second computing device in a remote location (e.g., in a different building, neighborhood, city, state, etc. than the location at which the particular edge node operates). In some embodiments, the first and second computing devices are computers, while in other embodiments, they are standalone DPI appliances. Still in other embodiments, the first computing device is an appliance, while the second computing device is a computer on which the remote deep packet inspector executes. 
     Some embodiments provide a method that uses DPI-generated parameters to assess, and in some cases to modify, how flows associated with particular applications traverse an SD-WAN that is defined by several edge nodes and one or more cloud gateways. At a set of one or more servers, the method receives sets of DPI parameters collected for packet flows processed by a first set of two or more edge nodes for which DPI operations were performed. From these collected sets, the method identifies a subset of DPI parameters associated with a plurality of flows relating to a particular application identifier specified by the DPI operations. 
     The received DPI parameters sets in some embodiments include operational statistics and metrics (e.g., packet transmission time, payload size, current number of packets processed by the node, etc.) relating to the packet flows processed by the first-set edge nodes. The statistics in some embodiments are accompanied by other data such as the flow identifiers, application classification details and forwarding decisions (e.g., identifying selected paths), etc. In some embodiments, the operational statistics, metrics and other data are collected and provided by the edge nodes and/or the gateways. The method then analyzes the identified subset of parameters to determine whether any packet flow associated with one or more particular DPI parameters had an undesirable metric relating to its flow through the WAN. 
     When this analysis produces a decision that the edge nodes should use different paths for the flows associated with the particular application identifier, the method then distributes adjusted next-hop forwarding records to a second set of one or more edge nodes to modify the paths that the edge nodes use to forward flows associated with the particular application identifier. In some embodiments, the first and second set of edge nodes are identical, while in other embodiments the first set of edge nodes is a subset of the second set of edge nodes (e.g., the second set includes at least one node not in the first edge). 
     In some embodiments, the DPI operations for a flow are performed at the source edge node (also called ingress edge node) where the flow enters the WAN and from where it is passed to another edge node or to a cloud gateway. Conjunctively with the DPI operations, the source edge node collects operational metrics and statistics (e.g., packet transmission time, payload size, current number of packets processed by the node, etc.) for the packets of the flow that it passes to another edge node or a cloud gateway, and provides the DPI generated parameters along with the collected statistics to the server set for its analysis. 
     In some embodiments, the source edge node collects statistics for a flow based on a number of initial packets that it uses to perform its DPI operations. The source edge node in some of these embodiments provides to the server set the initial set of packets that it uses for its DPI operations for a flow, along with the operational metrics and statistics that it provides to the server set for a new flow. In some embodiments, the number of packets in the initial packet set that is analyzed by the source edge node&#39;s DPI operation is dependent on the application that is being identified as the source of the flow by the DPI operations. Accordingly, the DPI operations analyze different number of packets for different flows that are from different applications or different types of applications. 
     The destination edge nodes (also called egress edge nodes) in some embodiments also perform DPI operations and collect operational metrics/statistics for the flows at the start of flows that they received through the WAN (i.e., from cloud gateways or other edge nodes). In other embodiments, the destination edge nodes do not perform DPI operations, but collect operational metrics/statistics for the flows at the start of flows. In some embodiments, the destination edge nodes receive (e.g., in-band with the packets through tunnel headers, or out-of-band through other packets) one or more DPI parameters (e.g., application identifiers) generated by the source edge node&#39;s DPI operation. 
     Conjunctively or alternatively to performing DPI operations at the edge nodes, some embodiments perform DPI operations outside of the edge nodes (e.g., at physical locations that are remote form physical locations at which the edge nodes operate). In some embodiments, the method also collects statistics/metrics from the gateways regarding the processing of the flows. In some embodiments, the source edge nodes set flags in the tunnel encapsulation headers that they use to forward packets to the gateways, in order to direct the gateways to collect statistics for certain flows. 
     In some embodiments, the server set uses the flow identifiers (e.g., five tuple identifiers of the flows) to correlate the metrics/statistics that it collects from the different forwarding elements of the SD-WAN (e.g., from the source edge nodes, destination edge nodes and/or the gateways). Once the collected metrics/statistics are correlated for a particular flow, the server set then analyzes the collected metrics/statistics to derive additional operational data that quantifies whether the particular flow is getting the desired level of service. The correlated metric/statistic data in some embodiments are associated with specific DPI generated parameters (e.g., application identifier, etc.) so that the analysis can be done on the DPI-parameter basis. For instance, the derived data in some embodiments is used to ascertain whether a particular flow associated with a particular application identifier reaches its destination within desired duration of time, whether the particular flow was delayed too much at a particular gateway, etc. 
     When the derived data demonstrates that the particular flow is not getting the desired level of service (e.g., a flow associated with a particular application identifier is not reaching its destination fast enough), the server set then distributes to the edge nodes and/or gateways adjusted next hop forwarding records that direct the edge nodes and/or gateways to modify the forwarding of the particular flow, or similar future flows (e.g., flows from with the same DPI identified application and/or to the same destination). For instance, based on the distributed new hop forwarding record, the source edge node selects a different gateway to forward the packets of the particular flow and other similar subsequent flows in some embodiments. In other embodiments, the source edge node uses the adjusted next hop forwarding record to select the gateway(s) to use for forwarding subsequent flows that are similar to the particular flow (e.g., flows with the same DPI identified application and to the same destination). 
     The preceding Summary is intended to serve as a brief introduction to some embodiments of the invention. It is not meant to be an introduction or overview of all inventive subject matter disclosed in this document. The Detailed Description that follows and the Drawings that are referred to in the Detailed Description will further describe the embodiments described in the Summary as well as other embodiments. Accordingly, to understand all the embodiments described by this document, a full review of the Summary, the Detailed Description, the Drawings, and the Claims is needed. Moreover, the claimed subject matters are not to be limited by the illustrative details in the Summary, the Detailed Description, and the Drawings. 
    
    
     
       BRIEF DESCRIPTION OF FIGURES 
       The novel features of the invention are set forth in the appended claims. However, for purposes of explanation, several embodiments of the invention are set forth in the following figures. 
         FIG. 1  illustrates an example of an edge node of an SD-WAN network using local and remote deep packet inspectors to perform a robust set of DPI operations. 
         FIG. 2  conceptually illustrates a process that the edge node performs in some embodiments when it receives a packet for forwarding. 
         FIG. 3  conceptually illustrates a process that the edge node performs when it receives the results of the DPI operation of the remote deep packet inspector for a particular flow. 
         FIG. 4  illustrates an example modifying the path selected for a particular flow. 
         FIG. 5  illustrates the components of a controller cluster that perform the above-described operations. 
         FIG. 6  conceptually illustrates a process that the controller cluster performs periodically in some embodiments. 
         FIG. 7  conceptually illustrates a process that an assessor performs to identify flows with poor performance and congested gateways. 
         FIG. 8  illustrates a new cloud gateway being deployed for handling VOIP calls, after the controller set detects that the VOIP call load on two previously deployed cloud gateways has exceeded a certain level which prevents the VOIP calls from receiving their desired level of service. 
         FIG. 9  illustrates the controller set detecting that the VOIP call load one previously deployed cloud gateway has exceeded a certain level which prevents the VOIP calls from receiving their desired level of service. 
         FIG. 10  conceptually illustrates a computer system with which some embodiments of the invention are implemented. 
     
    
    
     DETAILED DESCRIPTION 
     In the following detailed description of the invention, numerous details, examples, and embodiments of the invention are set forth and described. However, it will be clear and apparent to one skilled in the art that the invention is not limited to the embodiments set forth and that the invention may be practiced without some of the specific details and examples discussed. 
     Some embodiments provide a method for performing deep packet inspection (DPI) for an SD-WAN (software defined, wide area network) established for an entity by a plurality of edge nodes and a set of one or more cloud gateways. At a particular edge node, the method uses local and remote deep packet inspectors to perform DPI for a packet flow. Specifically, the method initially uses the local deep packet inspector to perform a first DPI operation on a set of packets of a first packet flow to generate a set of DPI parameters for the first packet flow. 
     The method then forwards a copy of the set of packets to the remote deep packet inspector to perform a second DPI operation to generate a second set of DPI parameters. In some embodiments, the remote deep packet inspector is accessible by a controller cluster that configures the edge nodes and the gateways. In some such embodiments, the method forwards the copy of the set of packets to the controller cluster, which then uses the remote deep packet inspector to perform the remote DPI operation. The method receives the result of the second DPI operation, and when the generated first and second DPI parameters are different, generates a record regarding the difference. 
     In some embodiments, the method uses the generated record to improve the local deep packet inspector&#39;s operation. For instance, in some embodiments, the local deep packet inspector is a third-party inspector that is used by the particular edge node, and the generated record is used to identify different flows for which the third-party inspector has poor DPI performance. When the generated record specifies a discrepancy between the first and second sets of generated DPI parameters, the method in some embodiments sends data regarding the discrepancy to a remote machine to aggregate with other data regarding other discrepancies in the DPI operations performed for other packet flows through the WAN. 
     In some embodiments, the method specifies a generated first set of DPI parameters as the set of DPI parameters associated with the first packet flow, after the first DPI operation is completed. When the first and second DPI parameter sets are different, the method in some embodiments modifies the set of DPI parameters associated with the first packet flow based on the generated second set of DPI parameters. For instance, in some embodiments, the method modifies the set of DPI parameters by storing the second set of DPI parameters as the set of DPI parameters associated with the first packet flow. 
       FIG. 1  illustrates an example of an edge node of an SD-WAN network (also called a virtual network below) using local and remote deep packet inspectors to perform a robust set of DPI operations. In this example, the edge node  120  is the edge node that uses local and remote deep packet inspectors  190  and  192 , while the SD-WAN is an SD-WAN  100  that is created for a particular entity to connect two branch offices  150  and  152  of the entity to two of its datacenters  154  and  156 , as well as a datacenter  158  of a SaaS (Software as a Service) provider used by the entity. The SD-WAN  100  is established by a controller cluster  140 , two cloud gateways  105  and  107 , and four edge nodes  120 - 126 , one in each of the branch offices and the datacenters  154  and  156 . 
     The edge nodes in some embodiments are edge machines (e.g., virtual machines (VMs), containers, programs executing on computers, etc.) and/or standalone appliances that operate at multi-computer location of the particular entity (e.g., at an office or datacenter of the entity) to connect the computers at their respective locations to the cloud gateways and other edge nodes (if so configured). Also, in this example, the two gateways  105  and  107  are deployed as machines (e.g., VMs or containers) in two different public cloud datacenters  110  and  112  of two different public cloud providers. 
     An example of an entity for which such a virtual network can be established include a business entity (e.g., a corporation), a non-profit entity (e.g., a hospital, a research organization, etc.), and an educational entity (e.g., a university, a college, etc.), or any other type of entity. Examples of public cloud providers include Amazon Web Services (AWS), Google Cloud Platform (GCP), Microsoft Azure, etc., while examples of entities include a company (e.g., corporation, partnership, etc.), an organization (e.g., a school, a non-profit, a government entity, etc.), etc. In other embodiments, the gateways can also be deployed in private cloud datacenters of a virtual WAN provider that hosts gateways to establish SD-WANs for different entities. 
     In  FIG. 1 , the gateways are multi-tenant forwarding elements that can be used to establish secure connection links (e.g., tunnels) with edge nodes at the particular entity&#39;s multi-computer sites, such as branch offices, datacenters, etc. These multi-computer sites are often at different physical locations (e.g., different buildings, different cities, different states, etc.) and are also referred to below as multi-machine compute nodes. In  FIG. 1 , the edge nodes  120 - 126  comprise forwarding elements that exchange data messages with one or more gateways or other edge node forwarding elements through one or more secure connection links. In this example, only edge nodes  120  and  122  have a secure connection link between them. All other secure connection links of the edge nodes are with gateways. 
     In some embodiments, multiple secure connection links (e.g., multiple secure tunnels) can be established between an edge node and a gateway. When multiple such links are defined between an edge node and a gateway, each secure connection link in some embodiments is associated with a different physical network link between the edge node and an external network. For instance, to access external networks, an edge node in some embodiments has one or more commercial broadband Internet links (e.g., a cable modem, a fiber optic link) to access the Internet, a wireless cellular link (e.g., a 5G LTE network), etc. 
     Also, multiple paths can be defined between a pair of edge nodes.  FIG. 1  two examples of this. It illustrates two paths through gateways  105  and  107  between edge nodes  120  and  124 . It also illustrates two paths between edge nodes  120  and  126 , with one path traversing through the cloud gateway  107 , and the other path traversing the an MPLS (multiprotocol label switching) network  185  of an MPLS provider to which both edge nodes  120  and  126  connect.  FIG. 1  also illustrates that through the cloud gateways  105  and  107 , the SD-WAN  100  allows the edge nodes to connect to the datacenter  158  of the SaaS provider. 
     In some embodiments, each secure connection link between a gateway and an edge node is formed as a VPN (virtual private network) tunnel between the gateway and an edge node. The gateways also connect to the SaaS datacenter  158  through secure VPN tunnels in some embodiments. The collection of the edge nodes, gateways and the secure connections between the edge nodes, gateways and SaaS datacenters forms the SD-WAN  100  for the particular entity. In this example, the SD-WAN spans two public cloud datacenters  110  and  112  and an MPLS network to connect the branch offices  150  and  152  and datacenters  154 ,  156  and  158 . 
     In some embodiments, secure connection links are defined between gateways to allow paths through the virtual network to traverse from one public cloud datacenter to another, while no such links are defined in other embodiments. Also, as the gateways  105  and  107  are multi-tenant gateways, they are used in some embodiments to define other virtual networks for other entities (e.g., other companies, organizations, etc.). Some such embodiments store tenant identifiers in tunnel headers that encapsulate the packets that are to traverse the tunnels that are defined between a gateway and edge forwarding elements of a particular entity. The tunnel identifiers allow the gateway to differentiate packet flows that it receives from edge forwarding elements of one entity from packet flows that it receives along other tunnels of other entities. In other embodiments, the gateways are single tenant and are specifically deployed to be used by just one entity. 
       FIG. 1  illustrates a cluster of controllers  140  in the private datacenter  117 . The controller cluster  140  serves as a central point for managing (e.g., defining and modifying) configuration data that is provided to the edge nodes and/or gateways to configure some or all of the operations. In some embodiments, the controller cluster has a set of manager servers that define and modify the configure data, and a set of controller servers that distribute the configuration data to the edge forwarding elements and/or gateways in some embodiments. In other embodiments, the controller cluster only has one set of servers that define, modify and distribute the configuration data. In some embodiments, the controller cluster directs edge nodes to use certain gateways (i.e., assigns gateway to the edge nodes), and to establish direct connections with other edge nodes. 
     Although  FIG. 1  illustrates the controller cluster  140  residing in one private datacenter  117 , the controllers in some embodiments reside in one or more public cloud datacenters and/or private cloud datacenters. Also, some embodiments deploy one or more gateways in one or more private datacenters (e.g., datacenters of the entity that deploys the gateways and provides the controllers for configuring the gateways to implement virtual networks). 
     In the example illustrated in  FIG. 1 , the deep packet inspectors  190  and  192  that are used by the edge node  120  are in two different physical locations. The local deep packet inspector  190  is at the same physical location with the edge node  120  (i.e., is in the branch  150 ), while the remote deep packet inspector  192  is co-located with the controller set  140  in the datacenter  117 . In some embodiments, the local deep packet inspector operates (e.g., as a VM or container) on a first computing device along with the edge node machine. In other embodiments, the local deep packet inspector operates on separate device than the edge node machine or appliance. For instance, in these embodiments, the local deep packet inspector  190  is a standalone appliance or is a machine (e.g., VM or container) that executes on a separate computer. 
     The remote deep packet inspector  192  operates in a remote location (e.g., in a different building, neighborhood, city, state, etc. than the location at which the particular edge node operates) from the physical location of the edge node  120 . In some embodiments, the remote deep packet inspector  192  is part of the controller cluster (e.g., is a separate process or thread executed by the controller cluster). In other embodiments, the remote packet inspector  192  operates in in close proximity to controller cluster (e.g., is a VM executing in the same cluster of computers as the controller cluster and has a stable communication link with the controller cluster). Also, in some embodiments, the local and remote deep packet inspectors are executed by in specialized hardware accelerators that are part of CPUs, exist as one or more co-processors, exist as one or more add-on cards, and/or leverage specialized processing units (such as one or more GPUs). 
     For a particular packet flow, the edge node  120  initially uses the local deep packet inspector  190  to perform a first DPI operation on an initial set of packets of the particular packet flow. For the particular packet flow, the DPI operation generates a set of DPI parameters, which in different embodiments includes different DPI parameters or combination of such parameters, such as an identifier that specifies a type of traffic carried in payloads of the packets, an identifier that specifies an application that is a source of the flow, an identifier that specifies a class type associated with the flow, etc. In some embodiments, the local deep packet inspector does not generate an identifier for the source application or class. In these embodiments, the edge node generates one or both of these identifiers by mapping the traffic type identifier produced by the DPI operations to the application or class identifiers. 
     In some embodiments, the edge node  120  forwards the packets of the particular packet flow based on the generated first set of DPI parameters. For example, in some embodiments, the edge node  120  uses at least one parameter in the generated first set of DPI parameters to select a path through the WAN to forward the packets of the first packet flow. In some embodiments, the edge node  120  forwards a copy of the set of packets that it used for the first DPI operation of the local deep packet inspector  190 , to the remote deep packet inspector  192  to perform a second DPI operation to generate a second set of DPI parameters. The edge node  120  receives the result of the second DPI operation. When the generated first and second DPI parameters are different, the edge node  120  generates a record regarding the difference. 
     In some embodiments, the edge node  120  uses the generated record to improve the local deep packet inspector&#39;s operation. For instance, in some embodiments, the local deep packet inspector is a third-party inspector that is used by the particular edge node, and the generated record is used to identify different flows for which the third-party inspector has poor DPI performance. When the generated record specifies a discrepancy between the first and second sets of generated DPI parameters, the edge node  120  in some embodiments send data regarding the discrepancy to a remote machine to aggregate with other data regarding other discrepancies in the DPI operations performed for other packet flows through the WAN. 
     In some embodiments, the edge node  120  specifies a generated first set of DPI parameters as the set of DPI parameters associated with the first packet flow, after the first DPI operation is completed. When the first and second DPI parameter sets are different, the edge node  120  modifies the set of DPI parameters associated with the first packet flow based on the generated second set of DPI parameters. For instance, in some embodiments, the edge node  120  modifies the set of DPI parameters by storing the second set of DPI parameters as the set of DPI parameters associated with the first packet flow. 
     Also, in the embodiments where the edge node  120  forwards the packets of the particular packet flow based on the generated DPI parameters, the edge node  120  modifies the forwarding of the packets of the first packet flow, by using the second set of DPI parameters when the generated first and second sets of DPI parameters are different. In some embodiments, the edge node  120  forwards at least a subset of the generated first and/or second DPI parameters to other edge nodes (e.g., through in-band or out-of-band communication with the other edge nodes) directly, or indirectly through the controller cluster  140 . Also, in some embodiments, the edge node  120  forwards at least a subset of the generated first and/or second DPI parameters to at least one gateway (e.g., through in-band or out-of-band communication with the gateway) directly, or indirectly through the controller cluster  140 . 
       FIG. 2  conceptually illustrates a process  200  that the edge node  120  performs in some embodiments when it receives a packet for forwarding. In some embodiments, the edge node  120  performs this process for each egressing packet that it receives from inside the branch  150  for forwarding out of the branch  150 , or for each ingressing packet that it receives from outside of the branch  150  for forwarding to a machine within the branch  150 . In other embodiments, the edge node  120  only performs this process for each egressing packet. 
     As shown, the process  200  starts when the edge node receives (at  205 ) a packet for forwarding. Next, at  210 , the process determines whether the packet is part of an existing flow that the edge node is currently processing. In some embodiments, the existing flow are two opposing flows (i.e., is a bi-directional flow) in the same connection session between a machine in the branch  150  and a machine outside of the branch  150  (e.g., in branch  152  or in a datacenter  154 ,  156  or  158 ), as the DPI operations analyzing packets exchanged in both directions in a connection session. In other embodiments, the existing flow is a uni-directional flow between these two machines (e.g., from the internal machine to the external machine). 
     Also, at  210 , the process  200  in some embodiments treats the DPI operation that was performed for a first flow as the DPI operation for a later second flow when the first and second flows are part of a set of flows that have certain header values in common, e.g., source IP address, destination IP address and destination port. In other words, the flow determination at  210  in some embodiments decides whether a DPI operation has been performed for a set of flows that can be grouped together based on some criteria. 
     To determine whether the packet received at  205  is part of an existing flow, the process in some embodiments checks a connection tracking storage that stores a record of each flow that it is currently processing. In some embodiments, the connection tracking storage stores a record for each flow, with the flow&#39;s record storing the flow&#39;s identifier (e.g., the flow&#39;s five tuple identifier, which includes source and destination IP addresses, source and destination port addresses and protocol). Hence, in these embodiments, the process  200  determines (at  210 ) whether the received packet&#39;s flow identifier is stored in the connection tracking storage. In the embodiments where the process  200  performs a local DPI operation for a set of flows, the process  200  determines (at  210 ) whether the received packet&#39;s flow attributes match the flow attributes of the set of flows that is stored in the connection tracker. 
     If not, the process (at  215 ) creates a flow container to store copies of the initial packets of the flow in the flow container. At  215 , the process also creates a record in its connection tracker for the received packet&#39;s flow (e.g., stores the packet&#39;s five-tuple flow identifier in the connection tracker). From  215 , the process transitions to  220 . The process also transitions to  220 , when it determines (at  210 ) that the received packet is part of a flow that it is currently processing. 
     At  220 , the process determines whether it has already completed its DPI operation for the received packet&#39;s flow. To make this determination at  220 , the process in some embodiments checks another connection tracking storage that stores a record of each flow or set of flows for which it has previously completed the DPI operations. In some embodiments, each record in this connection tracking storage stores a flow identifier (e.g., five tuple identifier) of a flow or a set of flows for which the process has previously completed the DPI operations, and the DPI parameter set the process previously identified for this flow. Conjunctively, or alternatively to storing the DPI parameter set, each record stores a forwarding decision, or other forwarding operation (such as egress queue selection), that the edge node previously made based on the DPI parameter set that it previously identified for the flow. 
     When the process determines (at  220 ) that it has previously completed the DPI operations for the received packet&#39;s flow or flow set, it transitions to  250 , where it will forward the packet based on the forwarding operation(s) that it previously decided based on the previously identified DPI parameters for the flow or flow set. These forwarding operations in some embodiments include any combination of the following: selecting the path along which the packet should be sent, selecting the egress queue in which the packet should be stored before forwarding, specifying QoS parameters for the packet for other gateways or edge nodes to use, etc. 
     When the process determines (at  220 ) that it has not previously completed the DPI operations for the received packet&#39;s flow or flow set, the process stores (at  225 ) stores a copy of the received packet in the flow container defined at  215  or defined previously for an earlier packet in the same flow. Next, at  230 , the process provides the received packet to the local deep packet inspector  190  to perform its DPI operation. 
     At  235 , the process determines whether the local deep packet inspector  190  was able to complete its operation based on the received packet. In some embodiments, the process makes this determination based on a response that it receives from the local deep packet inspector  190 . The local inspector  190  in some embodiments returns a set of one or more DPI parameters for the received packet&#39;s flow when it has completed its operation, while it returns a reply that indicates that it has not yet completed its operations when it needs to analyze more packets of this flow. 
     When the process determines (at  235 ) that the local inspector  190  needs more packets to analyze, the process performs (at  245 ) a forwarding classification operation without reference to any DPI parameter values, forwards (at  250 ) the received packet based on this forwarding classification operations, and then ends. In some embodiments, the forwarding classification operation involves matching the received packet&#39;s attributes (e.g., its flow identifier or the attribute set of its flow set) with one or more match-action rules that specify the next hop interface for the packet and the tunnel attributes that should be used to encapsulate and forward the packet to the next hop. 
     In the above-described approach, neither the edge node nor the local deep packet inspector perform a soft termination for the connection session associated with the received packet, while the local DPI inspector can perform its DPI operation. Under this approach, the packets are forwarded (at  250 ) after their classification (at  245 ). In other embodiments, the edge node or the local deep packet inspector perform a soft termination for the connection session associated with the received packet, so that the local DPI operation can perform its DPI operation. In some of these embodiments, the edge node  120  does not forward any of the initial packets in this flow out of the branch  150 , and instead stores these packets in the container until the local DPI operation has been completed so that it can perform an action (e.g., a forwarding decision) based on the DPI operation. 
     When the process  230  determines (at  235 ) that the local deep packet inspector  190  was able to complete its operation based on the received packet, it determines (at  240 ) whether it has to perform a DPI based action on the packet. As mentioned above, the returned set of DPI parameters include different DPI parameters in some different embodiments. Examples of these parameters include traffic-type identifiers, source application type identifiers, class identifiers, etc. In some embodiments, the local deep packet inspector does not generate an identifier for the source application or class. In these embodiments, the controller cluster generates one or both of these identifiers by mapping the traffic type identifier produced to the local DPI operations with the application or class identifiers. 
     Based on the returned DPI parameter set, the edge node  120  in some embodiments performs its forwarding operation on packet flows associated with some of the DPI parameters. For example, in some embodiments, the edge node  120  selects a faster path (i.e., a path with a low latency) or a more resilient path (i.e., a path with a very low failure rate) for packets associated with VOIP calls, which have to use the best available paths. Conjunctively, or alternatively, the edge node  120  in some embodiments associates these packets with a higher priority queue so that these packets can enjoy a higher quality of service (QoS). 
     In some of these embodiments, the edge node does not perform any special action on a packet flow unless the flow is associated with one or more particular DPI parameters by the DPI inspectors  190  or  192 . Accordingly, when the process determines (at  240 ) that DPI parameter set for the received packet&#39;s flow is not associated with any special type of action, the process performs (at  245 ) its forwarding operations without reference to any DPI parameter values, and forwards (at  250 ) the received packet and any packet it previously stored for this flow based on these forwarding operations. 
     In some embodiments, the process performs these forwarding operations by matching the flow&#39;s identifier with one or more match-action forwarding rules that identify tunneling parameters (e.g., tunnel identifier, etc.) and forwarding parameters (e.g., next hop forwarding interface, destination network addresses (IP, port, MAC, etc.), etc.), and then encapsulating and forwarding the flow&#39;s packet(s) based on the tunneling and forwarding parameters, as mentioned above. At  245 , the process in some embodiments also stores an indication that the local DPI inspector  190  did not provide DPI parameters requiring any special treatment of the flow, while in other embodiments it does not store any such indication at  245 . 
     Also, in  FIG. 2 , the process  200  does not request the remote deep packet inspector  192  to analyze the received packet&#39;s flow when it determines (at  240 ) that it does not have to perform any special operation on the flow based on the DPI parameter(s) returned by the local inspector  190 . In other embodiments, however, the process directs the remote inspector  192  to analyze the received packet&#39;s flow even when it determines (at  240 ) that it should not perform any special operation on the flow based on the parameters returned by the local inspector. 
     The process transitions from  240  to  255  when it determines that it should perform special operations on the received packet&#39;s flow based on the parameters returned by the local inspector  190 . For the received packet&#39;s flow, the process stores (at  255 ) the locally generated set of DPI parameters (i.e., generated by the local DPI inspector  190 ) in a storage (e.g., a database) that associates flows with DPI parameter sets. The process stores this DPI parameter set for subsequent reporting operations and/or for comparison with remotely generated DPI parameters. 
     It also sends (at  255 ) the copies of the initial set of packets that the local deep packet inspector  190  examined to the remote deep packet inspector  192 . This initial set of packets includes any packet stored in the flow container that was created for the initial flow&#39;s packet at  215  and in which one or more packets were stored at  225  in each iteration of the process  200  for the flow. To the remote deep packet inspector  192 , the process in some embodiments sends (at  255 ) the locally generated set of DPI parameters (i.e., the DPI parameter set generated by the local inspector  190 ) along with the initial set of packets. 
     At  260 , the process uses one or more of the DPI parameters identified by the local deep packet inspector  190  to perform its forwarding classification operations. In some embodiments, the process performs these forwarding operations by matching the flow&#39;s identifier and one or more DPI parameters with one or more match-action forwarding rules that identify tunneling parameters (e.g., tunnel identifier, etc.) and forwarding parameters (e.g., next hop forwarding interface, etc.). Based on the tunneling and forwarding parameters identified at  260 , the process then encapsulates and forwards (at  250 ) the received packet, and then ends. 
     In some embodiments, DPI-based forwarding classification operation at  260  might change the path through the WAN that was selected for earlier packets of the flow by the DPI-independent forwarding classification operation at  245 . For instance, after selecting a slow path through the WAN for a particular flow before the completion of the local DPI operation, the edge node in some embodiments can select a faster path once the local DPI operation has been completed and this DPI operation specifies that the flow is associated with an application that requires the use of best available paths. 
     Instead of modifying the path of the flow for which the local DPI operation was performed, the process  200  in other embodiments stores the identified DPI parameter for the associated flow set, and then uses the stored DPI parameter to select the fast path for a subsequent flow in the same flow set as the current flow. Also, for the current flow or a subsequent flow in the same flow set, the process  200  performs (at  250  or  260 ) other forwarding operations based on the DPI parameter set identified by the local DPI operation for the current flow. For instance, in some embodiments, the process  200  specifies a higher priority egress queue to provide a higher QoS for the current flow or the subsequent flow in the flow set, based on the identified DPI parameter set. In some embodiments, the process  200  also includes in the tunnel header of the current flow or subsequent flow a QoS parameter that informs the gateway(s) or destination edge node of the higher priority of the current flow or subsequent flow. 
     In some embodiments, the edge node  120  forwards each packet to its destination after the local deep packet inspector has processed the packet. In other embodiments, however, the edge node  120  delays the forwarding of packets to the destination of the flow while performing the local DPI operation. During this time, the edge node stores the delayed packets in the specified flow container for the packet flow (i.e., a storage queue that the edge node defines for the packet flow). Once the first DPI operation has been completed, the edge node then forwards the set of packets stored in the storage queue as well as subsequent packets of the first flow to the destination. For certain locally identified DPI parameters, this forwarding is based on the DPI parameters (e.g., for certain DPI parameters, the next-hop/path selection is based on the DPI parameters). The edge node  120  in these embodiments also forwards a copy of the set of packets stored in the storage queue to the remote deep packet inspector. 
     In some embodiments, the number of packets stored in a flow container for a particular packet flow depends on the number of packets that the local deep packet inspector  190  needs to complete its DPI operation. Specifically, in some embodiments, the local deep packet inspector needs to examine different number of packets for flows from different types of source applications in order to assess the traffic type, source application type, the class type, etc. However, typically, the number of packets is in the range of 10-20 packets for many applications. 
       FIG. 3  conceptually illustrates a process  300  that the edge node  120  performs when it receives the results of the DPI operation of the remote deep packet inspector  192  for a particular flow. For certain packet flows (e.g., packet flows for which the local packet inspector  190  generates a particular DPI parameter), the edge node  120  in some embodiments forwards to the remote deep packet inspector  192  a copy of an initial set of packets that the local deep packet inspector  190  used to perform its DPI operations. In other embodiments, the edge node  120  forwards to the remote deep packet inspector  192  more packets of a flow to analyze than the number of packets that it provides to the local deep packet inspector  190 . 
     As shown in  FIG. 3 , the process starts (at  305 ) when the edge node  120  receives the result of the second DPI operation from the remote deep packet inspector  192 . It then determines (at  310 ) whether the second DPI operation produced a different second set of DPI parameters than the first set of DPI parameters produces by the local deep packet inspector  190 . When the two sets of DPI parameters match, the remote deep packet inspector  192  in some embodiments just returns an indication of the match. Alternatively, when the second DPI-parameter set does not match the first DPI-parameter set, the remote deep packet inspector  192  returns the second DPI parameter set in an encoded or unencoded format. 
     When the process determines (at  310 ) that the second DPI parameter set produced by the remote DPI operation matched the first DPI parameter set produced by the local DPI operation, the process creates (at  315 ) a record for the particular flow to indicate that there was no discrepancy between the two sets of DPI parameters, and then ends. This record in some embodiments is just another field in the record that the process  200  created (at  255 ) in the edge node&#39;s DPI parameter storage to store the DPI parameter set for the particular flow. 
     Alternatively, when the process determines (at  310 ) that the first and second DPI parameter sets do not match, the process creates (at  320 ) a record of this discrepancy. For instance, the process in some embodiments identifies (at  320 ) the second DPI parameter set as the DPI parameter set associated with the particular flow. The process does this in some embodiments by storing the second DPI parameter set in the record that was created in the edge node&#39;s DPI parameter storage for the particular flow. In some embodiments, the process also sets (at  320 ) a value of a field in this record to designate the discrepancy between the local and remote DPI operations. 
     The process  300  also stores (at  320 ) in this record or another record the first DPI parameter set that was produced by the local deep packet inspector  190 , and that has been replaced by the second DPI parameter set. In some embodiments, the process  300  maintains the first DPI parameter set because this record is used to improve the local deep packet inspector&#39;s operation. For instance, in some embodiments, the local deep packet inspector is a third-party inspector that is used by the particular edge node, and the generated record is used to identify different flows for which the third-party inspector has poor DPI performance. When the generated record specifies a discrepancy between the first and second sets of generated DPI parameters, the edge node  120  in some embodiments sends data regarding the discrepancy to a remote machine to aggregate with other data regarding other discrepancies in the DPI operations performed for other packet flows through the WAN. This data is then analyzed in some embodiments to modify the operation of the local deep packet inspector. 
     In the embodiments where the edge node  120  forwards the packets of the particular packet flow based on the generated DPI parameters, the process  300  determines (at  325 ) whether it needs to modify its forwarding of the packets of the particular flow based on the second DPI parameter set received from the remote deep packet inspector  192 . If so, the edge node  120  modifies this forwarding. 
       FIG. 4  illustrates an example modifying the path selected for a particular flow. Specifically, for the example illustrated in  FIG. 1 ,  FIG. 4  illustrates the edge node  120  initially forwarding the particular flow to the gateway  105 , which is along a first path to the edge node  124 . This selection of the gateway  105  as the next hop is based on the first set of DPI parameters generated by the local deep packet inspector  190 . The edge node  190  uses one or more parameters in this set to select the gateway  105  instead of selecting the gateway  107 , which is on a second path to the edge node  124 . The second path in this example has lower latency and is used for higher priority packets. However, the edge node  120  initially does not select the gateway  107  and its associated second path because the first set of DPI parameters do not include any parameter that is associated with a high priority flow. 
       FIG. 4  also illustrates the edge node receiving the second set of DPI parameters from the remote deep packet inspector  192 . Based on the second DPI parameter set, the edge node  120  starts to forward the particular flow through the gateway  107  and the second path. In this example, the second set of DPI parameters has one DPI parameter that is associated with a high priority flow (e.g., has a traffic-type identifier that specifies the flow&#39;s payload contains VOIP data). The edge node  120  matches the second DPI parameter set and the flow identifier of the particular flow with a match-action rule that specifies the gateway  107  as the next hop of the path to select. 
     Some embodiments provide a method that uses DPI-generated parameters to assess and in some case modify how flows associated with particular applications traverse an SD-WAN. At a set of one or more servers, the method receives sets of DPI parameters collected for packet flows processed by a first set of edge nodes for which DPI operations were performed. From these collected sets, the method identifies a subset of DPI parameters associated with a plurality of flows relating to a particular application identifier specified by the DPI operations. 
     The received DPI parameters sets in some embodiments include operational statistics and metrics (e.g., packet transmission time, payload size, current number of packets processed by the node, etc.) relating to the packet flows processed by the first-set edge nodes. The statistics in some embodiments are accompanied by other data such as the flow identifiers, application classification details and forwarding decisions (e.g., identifying selected paths), etc. In some embodiments, the operational statistics, metrics and other data are collected and provided by the edge nodes and/or the gateways. 
     The method then analyzes the identified subset of parameters to determine whether any packet flow associated with one or more particular DPI parameters had an undesirable metric relating to its flow through the WAN. When this analysis produces a decision that the edge nodes should use different paths for the flows associated with the particular application identifier, the method then distributes adjusted next-hop forwarding records to a second set of one or more edge nodes to modify the paths that the edge nodes use to forward flows associated with the particular application identifier. In some embodiments, the first and second set of edge nodes are identical, while in other embodiments the first set of edge nodes is a subset of the second set of edge nodes (e.g., the second set includes at least one node not in the first edge). 
     The above-described method is implemented by the controller cluster  140  of  FIG. 1  in some embodiments.  FIG. 5  illustrates the components of the controller cluster that perform the above-described operations. As shown, the controller cluster  140  in some embodiments includes a data collector  505 , a data correlator  510 , a data aggregator  515 , a data assessor  517 , a gateway deployment manager  520 , and a path generator  525 . In some embodiments, these components operate on one computer, while in other embodiments they operate on multiple computers. For scalability, each component can be implemented by a cluster of similar processes in some embodiments. 
     The operation of the components of the controller cluster  140  in  FIG. 5  will be described by reference to  FIG. 6 , which conceptually illustrates a process  600  that the controller cluster  140  performs periodically in some embodiments. From the edge nodes and/or gateways, this process collects data for flows associated with certain DPI parameters. It correlates the collected data to associated data regarding the same flows, and then analyzes the collected data to derive additional statistics/metrics regarding each flow. The process then compares the collected and derived data for a flow with desired service level metrics/statistics for DPI parameters associated with the flow to identify when flow is not getting the desired level of service (e.g., a flow associated with a particular application identifier is not reaching its destination fast enough). 
     When it identifies one or more flows that are not getting the desired level of service, the process  600  distributes to the edge nodes and/or gateways adjusted next hop forwarding records that direct the edge nodes and/or gateways to modify the forwarding of the particular flow, or similar future flows (e.g., flows from with the same DPI identified application and/or to the same destination). For instance, based on the distributed path adjustment values, the source edge node selects a different gateway to forward the packets of the particular flow and other similar subsequent flows in some embodiments. In other embodiments, the source edge node uses the distributed adjusted next hop forwarding records to select the gateway(s) to use for forwarding subsequent flows that are similar to the particular flow (e.g., flows with the same DPI identified application and to the same destination). 
     As shown in  FIG. 6 , the data collector  505  in some embodiments collects (at  605 ) data from a first set of SD-WAN forwarding nodes regarding the nodes&#39; processing of flows associated with a set of one or more DPI parameters. For instance, in some embodiments, the data collector gathers data regarding processing of flows associated with one or more traffic-type identifiers (e.g., VOIP calls, video conferences, etc.). In other embodiments, the data collector gathers data regarding the processing of all flows passing through the first-set forwarding nodes. 
     In some embodiments, the first-set forwarding nodes are only a subset of the SD-WAN forwarding nodes, and the collected set of data pertains to the flows of a subset of tenants (e.g., one tenant) of the SD-WAN. As further described below, the process  600  collects data from only a subset of the forwarding nodes, but shares the results of the analysis of this data with a larger set of SD-WAN forwarding nodes. Similarly, while collecting data for only a subset of the tenants, the process uses the results of the analysis of this data with a larger set of tenants (e.g., all tenants or all tenants that use a certain SaaS application). The first-set forwarding nodes in some embodiments are just the SD-WAN edge nodes that serve as the sources and destinations of flows through the network. In other embodiments, the first-set forwarding nodes include the SD-WAN cloud gateways (e.g., gateways  105  and  107 ) as well. 
     The collected data in some embodiments includes operational statistics and metrics of the flows (e.g., average packet transmission time, average packet delay, average payload size, etc.). These operational statistics and metrics are collected by the first-set forwarding nodes for the packet flows processed by these nodes. In some embodiments, the collected data also includes operational statistics and metrics of the forwarding nodes. Examples of such statistics and metrics include queue depth, queue delay, number of packets processed by the node per some duration of time, etc. 
     As mentioned above, the collected records identify flow identifiers, application classification details and forwarding decisions (e.g., identifying selected paths), etc. The collected record include flow and/or forwarding node statistics/metrics that are associated with one or more DPI parameters, which were specified by DPI operations that were performed while processing these flows at the forwarding nodes in some embodiments. In some embodiments, the DPI operations for a flow are performed at the source edge node (also called ingress edge node) where the flow enters the WAN and from where it is passed to another edge node or to a cloud gateway. Conjunctively with the DPI operations, the source edge node collects operational metrics and statistics (e.g., packet transmission time, payload size, current number of packets processed by the node, etc.) for the packets of the flow that it passes to another edge node or a cloud gateway, and provides the DPI generated parameters along with the collected statistics to the server set for its analysis. 
     In some embodiments, the SD-WAN forwarding nodes continuously collect statistics/metrics for flows while processing flows. In other embodiments, these forwarding nodes collect the statistics/metrics for flows just at the start of the flows, in order to reduce the amount of resources consumed (e.g., CPU resources, memory resources) by the data collection. For instance, in some embodiments, the source edge node collects statistics for a flow based on a number of initial packets that it uses to perform its DPI operations. The source edge node in some of these embodiments provides to the controller set the initial set of packets that it uses for its DPI operations for a flow, along with the operational metrics and statistics that it provides to the server set for a new flow. In some embodiments, the number of packets in the initial packet set that is analyzed by the source edge node&#39;s DPI operation is dependent on the application that is being identified as the source of the flow by the DPI operations. Accordingly, the DPI operations analyze different number of packets for different flows that are from different applications or different types of applications. 
     The destination edge nodes (also called egress edge nodes) in some embodiments also perform DPI operations and collect operational metrics/statistics for the flows at the start of flows that they received through the WAN (i.e., from cloud gateways or other edge nodes). In other embodiments, the destination edge nodes do not perform DPI operations, but collect operational metrics/statistics for the flows (e.g., continuously or just at the start of flows). In some embodiments, the destination edge nodes receive (e.g., in-band with the packets through tunnel headers, or out-of-band through other packets) one or more DPI parameters (e.g., application identifiers) generated by the source edge node&#39;s DPI operation. 
     The destination edge nodes in some embodiments receive instructions from source edge nodes that directs the destination edge nodes to collect statistics/metrics regarding certain flows. For instance, in some embodiments, the source edge nodes set flags in the tunnel encapsulation headers that these edge nodes use to forward packets to the gateways, in order to direct the destination edge nodes to collect statistics for certain flows. The gateways in these embodiments forward these flags when they forward encapsulated packets to the destination edge nodes. 
     In some embodiments, the data collector  505  also collects statistics/metrics from the gateways regarding the processing of the flows. In some embodiments, the source edge nodes set flags in the tunnel encapsulation headers that these edge nodes use to forward packets to the gateways, in order to direct the gateways to collect statistics for certain flows. Also, conjunctively or alternatively to performing DPI operations at the edge nodes, some embodiments perform DPI operations outside of the edge nodes (e.g., at physical locations that are remote form physical locations at which the edge nodes operate). 
     The data collector  505  stores the data received at  605  in a raw data storage  530  of the controller cluster  140 . In some embodiments, the correlator  510  then correlates (at  610 ) the different records stored in the raw data storage  530  that were collected from the different edge nodes and/or gateways for the same flow. To correlate these records, the correlator  510  uses the flow identifiers (e.g., five tuple identifiers of the flows) to identify records that were collected from the different forwarding elements of the SD-WAN (e.g., from the source edge nodes, destination edge nodes and/or the gateways) that relate to the same flow. 
     In different embodiments, the correlator  510  correlates the related, collected flow records differently. In some embodiments, it creates an association (e.g., a reference in each record to a data structure that stores are related records) between the related records of a flow. In other embodiments, it merges a set of related records for a flow into one record. Still other embodiments correlated the related flow records differently. Also, in some embodiments, each correlated set of related records are associated with a set of DPI generated parameters (e.g., with a particular application identifier or traffic-type identifier). 
     The correlator  510  stores the correlated records for each flow in the correlated data storage  535 . The aggregator  515  retrieves the correlated records from this storage  535 , derives additional statistics/metrics from these records, stores the provided and derived statistics/metrics for flows that it has not previously identified, and blends the provided and derived statistics/metrics with statistics/metrics that it previously stored for flows that it has previously identified. 
     Specifically, once the collected metrics/statistics are correlated for a particular flow, the aggregator  515  analyzes the collected metrics/statistics to derive additional operational data that quantifies whether the particular flow is getting the desired level of service. The correlated metric/statistic data in some embodiments are associated with specific DPI generated parameters (e.g., application identifier, etc.) so that the analysis in some embodiments is done on the DPI-parameter basis. For instance, the derived data in some embodiments is used to ascertain whether a particular flow associated with a particular application identifier reaches its destination within desired duration of time, whether the particular flow was delayed too much at a particular gateway, etc. 
     The following is one example of how the aggregator derives statistics/metrics for a flow from the flow&#39;s collected, correlated records. In some embodiments, the collected records for a flow specify on a per packet basis the time that the packet left a source edge node, arrived at a gateway node, left the gateway node and arrived at a destination edge node. After these records are correlated, the aggregator  515  computes an average transit time that the flow&#39;s packets took to traverse from the source edge node to the destination edge node. 
     If the aggregator has not processed statistics/metrics for this flow before, the aggregator creates a record in an aggregated data storage  519  for this flow, and stores in this record, the collected and correlated statistics/metrics for this flow along with any statistics/metrics (e.g., the computed average transit time for the flow) that the aggregator derived for this flow. For some flows, this storage already has previously stored records as the aggregator previously processed statistics/metrics for these flows. Hence, for each such flow, the aggregator  515  in some embodiments aggregates the newly collected and derived statistics/metrics with previously collected and derived statistics/metrics for the flow. This aggregation operation in some embodiments uses a weighted sum to blend new statistics/metrics with the previously stored statistics/metrics. The weighted sum in some embodiments ensures that a flow&#39;s associated statistics/metrics do not fluctuate dramatically each time a new set of statistics/metrics are received. 
     In some embodiments, the aggregator also processes the statistics/metrics stored in the correlated data storage  535  for the gateways, in order to blend new statistics/metrics that are stored for the gateways in this storage with statistics/metrics that it previously stored for the gateways in the aggregated data storage  519 . To blends these statistics/metrics, the aggregator  515  in some embodiments uses weighted sum to ensure that a gateway&#39;s associated statistics/metrics do not fluctuate dramatically each time a new set of statistics/metrics are received. 
     The data assessor  517  analyzes the statistics/metrics stored in the aggregated data storage  519  to identify any flow associated with a particular set of DPI parameters that is not getting the desired level of service from the SD-WAN. The data assessor  517  also analyzes the stored statistics/metrics to identify any congested gateways.  FIG. 7  conceptually illustrates a process  700  that the assessor  517  performs to identify such flows and gateways. In some embodiments, the data assessor periodically performs the process  700 . 
     As shown, the process selects (at  705 ) a flow&#39;s record in the aggregated data storage  519  and identifies (at  710 ) the subset of DPI parameters (e.g., application identifier, traffic-type identifiers, etc.) associated with this flow. In some embodiments, the identified DPI parameter subset is stored with the selected flow&#39;s record, while in other embodiments, it is referenced by this record. From a service level storage  522 , the process  700  then retrieves (at  715 ) a desired set of service performance statistics/metrics from a service level storage  531  for the identified subset of DPI parameters. 
     The process next determines (at  720 ) whether the statistics/metrics stored in the retrieved flow&#39;s record fail to meet any of the desired service performance statistics/metrics for the identified subset of DPI parameters (e.g., are above desired service performance thresholds). Some embodiments have different service level guarantees for flows associated with different DPI parameters. For instance, in some embodiments, flows associated with a first traffic-type identifier cannot have a delay of more than a first temporal duration at a cloud gateway, while flows associated with a second traffic-type identifier cannot have a delay of more than a second temporal duration at a cloud gateway. Conjunctively or alternatively, in some embodiments, flows associated with a first traffic-type identifier have to reach their destination edge node within one temporal duration, while flows associated with a second traffic-type identifier have to reach their destination edge node within another temporal duration. 
     When the process determines that the statistics/metrics stored in the retrieved flow&#39;s record fail to meet any of the desired service performance statistics/metrics for the identified subset of DPI parameters, the process stores (at  725 ) a record for the flow in the path-analysis storage  523  so that this flow&#39;s path through the SD-WAN can be further analyzed, and then transitions to  730 . The process also transitions to  730  when it determines (at  720 ) that the flow&#39;s stored statistics/metrics meet the desired service performance statistics/metrics. At  730 , the process determines whether it has examined all the flow records. If not, it returns to  705  to select another flow record and repeats its operations for this record. Otherwise, it transitions to  735 . 
     At  735 , the process steps through the records for the cloud gateways in the aggregated data storage  519  to identify any cloud gateways that are too congested. In some embodiments, the process generally determines whether a cloud gateway is too congested in general for all flows. In other embodiments, the process makes this determination for flows associated with a particular set of one or more DPI parameters. For instance, in some such embodiments, the process determines whether a cloud gateway is too congested to process flows associated with a particular traffic-type identifier. The process  700  stores (at  740 ) in the gateway analysis storage  529  a record for each cloud gateway that it identifies as being too congested, and then ends. 
     After the data assessor  517  identifies the congested gateways and poorly performing flows, the gateway deployment manager  520  assesses (at  625 ) the gateway data, determines when and where additional cloud gateways should be deployed, and deploys these cloud gateways. In some embodiments, the cloud gateways are machines (e.g., VMs) that execute on host computers in cloud datacenters and that perform forwarding operations. 
     In some of these embodiments, the gateway deployment manager  520  instantiates and configures new machines to serve as new gateways in the same cloud datacenters as one or more other gateways, or in new cloud datacenters without any other gateways. In other embodiments, the gateways are previously instantiated, and the deployment manager  520  simply assigns the previously instantiated gateways to perform the desired cloud gateway service for the SD-WAN of the entity at issue. 
     The gateway deployment manager  520  in some embodiments deploys a new gateway to alleviate load on an existing congested gateway when the existing gateway has too much load for a certain duration of time. For instance, in some embodiments, the gateway deployment manager maintains a count of number of time periods during which an existing gateway had too much load, and only deploys a new gateway to alleviate the load on this existing gateway when the count that it maintains for this gateway reaches a particular value before being reset. In some of these embodiments, the deployment manager  520  reduces or resets when newly aggregated data does not identify as congested a gateway that was previously identified as being congested. 
     The gateway deployment manager  520  in some embodiments deploys a new gateway for use by all the flows. In other embodiments, the gateway deployment manager  520  deploys a new gateway for use by flows that are associated with certain DPI parameters. For instance, when the process  600  determines that the gateways that are used for VOIP calls are too congested, the deployment manager  520  in some embodiments deploys another cloud gateway to process flows that are associated with the VOIP traffic identifier. 
       FIG. 8  illustrates an example of this. Specifically, this figure illustrates a new cloud gateway  815  being deployed for handling VOIP calls, after the controller set detects that the VOIP call load on two previously deployed cloud gateways  805  and  810  has exceeded a certain level which prevents the VOIP calls from receiving their desired level of service. In this example, the new gateway is added in a new datacenter  830  that is different than the datacenters  820  and  825  that host cloud gateways  805  and  810 . In some embodiments, the controller cluster alleviates the load on one or more cloud gateways by deploying one or more gateways in the same datacenters as the previously deployed gateways that are overloaded. 
     Once the deployment manager  520  deploys a new gateway, it directs (at  625 ) the path generator  525  to identify new paths for flows to use the newly deployed gateway, and to generate next-hop forwarding records for one or more edge nodes and gateways to use these newly identified paths. The path generator  525  stores the generated next-hop forwarding records in the record storage  538 , from where the record distributor  540  retrieves and distributes the forwarding records to the specified edge nodes and/or gateways 
     The path generator also specifies (at  630 ) adjusted next-hop forwarding records for a second set of edge nodes to use for one or more flows that are identified in the path-analysis storage  523  as flows that need better paths through the SD-WAN, or for future flows that have similar attributes to these identified flows. Specifically, as mentioned above, the data assessor  517  (1) analyzes the statistics/metrics stored in the retrieved flow&#39;s record to identify any flow that fails to meet a desired service performance metric for the flow&#39;s associated subset of DPI parameters, and (2) stores (at  720 ) a record for the flow in the path-analysis storage  523  so that this flow&#39;s path through the SD-WAN can be further analyzed. At  630 , the path generator  525  explores alternative paths for each flow identified in the path-analysis storage to try to identify better paths for these flows or future similar flows in order to make it possible for these flows to meet the service level guarantees of the DPI parameters associated with the flows. 
     This exploration can result in the path generator identifying new gateways to deploy. When the path generator identifies such gateways, it directs the gateway deployment manager  520  to deploy the new gateways. The path generator  525  (1) generates next-hop forwarding records for one or more edge nodes and gateways to use these newly deployed gateways in order to implement the new path that it identifies, and (2) stores these next-hop forwarding records in the record storage  538 , from where the record distributor retrieves and distributes the forwarding records to the specified edge nodes and/or gateways. The above-described  FIG. 8  is one example of adding a gateway to improve the performance of SD-WAN paths used by flows associated with certain DPI parameters, which in this figure are flows associated with the VOIP traffic type. 
     In some embodiments, the path generator&#39;s exploration of alternative paths can also move one subset of flows away from a gateway while maintaining another subset of flows with a gateway.  FIG. 9  illustrates an example of this. Specifically, in this figure, the controller set detecting that the VOIP call load on one previously deployed cloud gateway  805  has exceeded a certain level which prevents the VOIP calls from receiving their desired level of service. Hence, the controller set reconfigures branch edge node  924  to use previously deployed cloud gateway  910  in datacenter  920  for its VOIP calls, in order to reduce the load on the cloud gateway  805 . 
     At  630 , the path generator  525  in some embodiments provides its new next-hop forwarding records to just forwarding nodes that are members of the first set of forwarding nodes from which the statistics/metrics were collected. In other embodiments, however, the path generator  525  provides its new next-hop forwarding records to even the SD-WAN forwarding nodes from which the controller cluster did not collect statistics/metrics at  605 . In other words, the first and second set of forwarding nodes are identical in some embodiments, while in other embodiments the first set of edge nodes is a subset of the second set of edge nodes (e.g., the second set includes at least one node not in the first edge). 
     For instance, in some embodiments, the controller cluster analyzes the metrics associated with the flows of one entity that relate to a SaaS provider&#39;s application (e.g., Office365). After assessing that certain gateways are not meeting desired service level performance for the monitored flows of one entity, the controller cluster not only configures the edge nodes of that entity from reducing their usage, or altogether avoiding, the problematic gateways, but also configures the edge nodes of other entities in the same manner for the same SaaS provider application. 
     In some embodiments, the controller cluster collects statistics/metrics from only a subset of branches and datacenters of an entity, in order to conserve resources. However, in these embodiments, the controller cluster uses the knowledge that it derives by analyzing the collected data for configuring edge nodes and gateways for all the branches and datacenters of the entity that are part of the SD-WAN. 
     One of ordinary skill will realize that the above-described processes are performed differently in other embodiments. For instance, while  FIG. 6  illustrates one set of operations that are performed periodically by the controller cluster, this cluster performs these operations at different frequencies in some embodiments. Also, instead of just adjusting next-hop forwarding records to adjust the paths for certain flows, the controller cluster distributes path-adjustment values to adjust how the edge nodes select among multiple viable paths to the same destinations, in order to reduce the load on particular gateways and/or to direct more of the flows through better performing gateways. 
     In different embodiments, the server set distributes different types of path adjustment values. In some embodiments, the distributed path adjustment values include path selection weight values for the edge nodes to use to select among different paths to the same destination (e.g., for flows associated with a particular application to the same destination edge node). In other embodiments, the distributed path adjustment values include packet processing statistics and/or other congestion metric associated with different gateways and/or different edge nodes. The source edge nodes in some embodiments use such statistics to select among different candidate gateways that are used by different candidate paths to the same destination, and/or to select among different candidate destination edge nodes when multiple different such nodes or destinations exist (e.g., when multiple candidate datacenters exist). In other embodiments, the server set uses still other types of path adjustment values. 
     Many of the above-described features and applications are implemented as software processes that are specified as a set of instructions recorded on a computer readable storage medium (also referred to as computer readable medium). When these instructions are executed by one or more processing unit(s) (e.g., one or more processors, cores of processors, or other processing units), they cause the processing unit(s) to perform the actions indicated in the instructions. Examples of computer readable media include, but are not limited to, CD-ROMs, flash drives, RAM chips, hard drives, EPROMs, etc. The computer readable media does not include carrier waves and electronic signals passing wirelessly or over wired connections. 
     In this specification, the term “software” is meant to include firmware residing in read-only memory or applications stored in magnetic storage, which can be read into memory for processing by a processor. Also, in some embodiments, multiple software inventions can be implemented as sub-parts of a larger program while remaining distinct software inventions. In some embodiments, multiple software inventions can also be implemented as separate programs. Finally, any combination of separate programs that together implement a software invention described here is within the scope of the invention. In some embodiments, the software programs, when installed to operate on one or more electronic systems, define one or more specific machine implementations that execute and perform the operations of the software programs. 
       FIG. 10  conceptually illustrates a computer system  1000  with which some embodiments of the invention are implemented. The computer system  1000  can be used to implement any of the above-described hosts, controllers, gateway and edge forwarding elements. As such, it can be used to execute any of the above described processes. This computer system includes various types of non-transitory machine readable media and interfaces for various other types of machine readable media. Computer system  1000  includes a bus  1005 , processing unit(s)  1010 , a system memory  1025 , a read-only memory  1030 , a permanent storage device  1035 , input devices  1040 , and output devices  1045 . 
     The bus  1005  collectively represents all system, peripheral, and chipset buses that communicatively connect the numerous internal devices of the computer system  1000 . For instance, the bus  1005  communicatively connects the processing unit(s)  1010  with the read-only memory  1030 , the system memory  1025 , and the permanent storage device  1035 . 
     From these various memory units, the processing unit(s)  1010  retrieve instructions to execute and data to process in order to execute the processes of the invention. The processing unit(s) may be a single processor or a multi-core processor in different embodiments. The read-only-memory (ROM)  1030  stores static data and instructions that are needed by the processing unit(s)  1010  and other modules of the computer system. The permanent storage device  1035 , on the other hand, is a read-and-write memory device. This device is a non-volatile memory unit that stores instructions and data even when the computer system  1000  is off. Some embodiments of the invention use a mass-storage device (such as a magnetic or optical disk and its corresponding disk drive) as the permanent storage device  1035 . 
     Other embodiments use a removable storage device (such as a floppy disk, flash drive, etc.) as the permanent storage device. Like the permanent storage device  1035 , the system memory  1025  is a read-and-write memory device. However, unlike storage device  1035 , the system memory is a volatile read-and-write memory, such as random access memory. The system memory stores some of the instructions and data that the processor needs at runtime. In some embodiments, the invention&#39;s processes are stored in the system memory  1025 , the permanent storage device  1035 , and/or the read-only memory  1030 . From these various memory units, the processing unit(s)  1010  retrieve instructions to execute and data to process in order to execute the processes of some embodiments. 
     The bus  1005  also connects to the input and output devices  1040  and  1045 . The input devices enable the user to communicate information and select commands to the computer system. The input devices  1040  include alphanumeric keyboards and pointing devices (also called “cursor control devices”). The output devices  1045  display images generated by the computer system. The output devices include printers and display devices, such as cathode ray tubes (CRT) or liquid crystal displays (LCD). Some embodiments include devices such as touchscreens that function as both input and output devices. 
     Finally, as shown in  FIG. 10 , bus  1005  also couples computer system  1000  to a network  1065  through a network adapter (not shown). In this manner, the computer can be a part of a network of computers (such as a local area network (“LAN”), a wide area network (“WAN”), or an Intranet), or a network of networks (such as the Internet). Any or all components of computer system  1000  may be used in conjunction with the invention. 
     Some embodiments include electronic components, such as microprocessors, storage and memory that store computer program instructions in a machine-readable or computer-readable medium (alternatively referred to as computer-readable storage media, machine-readable media, or machine-readable storage media). Some examples of such computer-readable media include RAM, ROM, read-only compact discs (CD-ROM), recordable compact discs (CD-R), rewritable compact discs (CD-RW), read-only digital versatile discs (e.g., DVD-ROM, dual-layer DVD-ROM), a variety of recordable/rewritable DVDs (e.g., DVD-RAM, DVD-RW, DVD+RW, etc.), flash memory (e.g., SD cards, mini-SD cards, micro-SD cards, etc.), magnetic and/or solid state hard drives, read-only and recordable Blu-Ray® discs, ultra-density optical discs, any other optical or magnetic media, and floppy disks. The computer-readable media may store a computer program that is executable by at least one processing unit and includes sets of instructions for performing various operations. Examples of computer programs or computer code include machine code, such as is produced by a compiler, and files including higher-level code that are executed by a computer, an electronic component, or a microprocessor using an interpreter. 
     While the above discussion primarily refers to microprocessor or multi-core processors that execute software, some embodiments are performed by one or more integrated circuits, such as application specific integrated circuits (ASICs) or field programmable gate arrays (FPGAs). In some embodiments, such integrated circuits execute instructions that are stored on the circuit itself. 
     As used in this specification, the terms “computer”, “server”, “processor”, and “memory” all refer to electronic or other technological devices. These terms exclude people or groups of people. For the purposes of the specification, the terms “display” or “displaying” mean displaying on an electronic device. As used in this specification, the terms “computer readable medium,” “computer readable media,” and “machine readable medium” are entirely restricted to tangible, physical objects that store information in a form that is readable by a computer. These terms exclude any wireless signals, wired download signals, and any other ephemeral or transitory signals. 
     While the invention has been described with reference to numerous specific details, one of ordinary skill in the art will recognize that the invention can be embodied in other specific forms without departing from the spirit of the invention. For instance, several of the above-described embodiments deploy gateways in public cloud datacenters. However, in other embodiments, the gateways are deployed in a third party&#39;s private cloud datacenters (e.g., datacenters that the third party uses to deploy cloud gateways for different entities in order to deploy virtual networks for these entities). Thus, one of ordinary skill in the art would understand that the invention is not to be limited by the foregoing illustrative details, but rather is to be defined by the appended claims.