This invention relates generally to networking, and more specifically, to an approach for managing the resources consumed by flow based traffic monitoring using adaptive random packet sampling.
The approaches described in this section are approaches that could be pursued, but not necessarily approaches that have been previously conceived or pursued. Therefore, unless otherwise indicated, the approaches described in this section may not be prior art to the claims in this application and are not admitted to be prior art by inclusion in this section.
There are several definitions of the term “flow” being used by the Internet community. Within the context of the IETF's Internet Protocol Information eXport (IPFIX) Working Group, a flow is defined as a set of IP packets passing an observation point in the network during a certain time interval. All packets belonging to a particular flow share a set of common properties. Each property is defined as the result of applying a function to the values of: (1) one or more packet header fields (e.g. destination IP address), transport header fields (e.g. destination port number), or application header fields (e.g. RTP header fields); (2) one or more characteristics of the packet itself (e.g. number of MPLS labels, etc.); or (3) one or more fields derived from packet treatment (e.g. next hop IP address, the output interface, etc.). A packet belongs to a flow if the packet completely satisfies all the defined properties of the flow. This definition covers the range from a flow containing all packets observed at a network interface to a flow consisting of just a single packet between two applications. It includes packets selected by a sampling mechanism.
A variety of flow monitoring tools currently exist to monitor the flow of packets in networks. Flow monitoring tools provide valuable information that can be used in a variety of ways. For example, flow monitoring tools may be used to perform network traffic engineering and to provide network security services, e.g., to detect and address denial of service attacks. As yet another example, flow monitoring tools can be used to support usage-based network billing services.
Flow monitoring tools are conventionally implemented as flow monitoring processes executing on a network element, such as a router. The flow monitoring processes are configured to examine and classify packets passing through a particular observation point in a network. The flow monitoring processes are also configured to generate flow statistical data that indicates, for example, the number of packets in each flow, the number of bytes in each flow and the protocol of each flow.
One of the issues with flow monitoring tools is how to manage the consumption of resources attributable to generating and maintaining flow statistical data. Generating flow statistical data consumes processing resources and storing flow statistical data consumes storage resources. The amount of resources consumed by flow statistical data can be considerable in networks with high traffic volume, which can adversely affect other processes. Furthermore, the amount of resources consumed by flow statistical data can fluctuate dramatically, as network traffic patterns change.
One solution to this problem has been to use sampling to collect flow statistical data for less than all of the packets that pass through an observation point. For example, a percentage of packets are sampled, e.g., every nth packet is sampled, and then the exported flow statistical data is later adjusted to account for the percentage of packets that was sampled. As another example, a fixed probability may be used to determine whether to sample packets. One problem with these approaches is that they do not take into consideration the characteristics of traffic flow. Because of this, it is difficult to select a sampling percentage or probability that works well for both large and small flows. For example, a small sampling probability may work well for large flows but may not be effective for small flows because there may be too few packets to be sampled.
A conventional scheme to control storage consumption is to place a limit on the amount of memory used for storing flow statistical data. The limits are typically expressed as percentages of available resources or as absolute amounts.
One problem with this solution is that it can have significant unintended consequences on processing resource consumption. For example, when new flows arrive at an extremely high rate, because of the memory usage limitation, the existing flow statistical records would have to be removed at a very high rate in order to free up memory space for the new flows. Because export consumes processing resources, this causes processing consumption to surge, which is undesirable. Therefore, this scheme does not address the trade-off between memory and processing resource consumption.
Based on the foregoing, there is a need for an approach for managing the consumption of resources that does not suffer from limitations of prior approaches.
In the figures of the accompanying drawings like reference numerals refer to similar elements.
In the following description, for the purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced without these specific details. In other instances, well-known structures and devices are shown in block diagram form in order to avoid unnecessarily obscuring the present invention. Various aspects of the invention are described hereinafter in the following sections:
I. OVERVIEW
II. ARCHITECTURE
III. ADAPTIVE RANDOM SAMPLING
IV. OPERATIONAL EXAMPLE
V. IMPLEMENTATION MECHANISMS
I. Overview
An approach for managing the consumption of resources uses adaptive sampling to decrease the collection of flow statistical data as the consumption of resources increases. According to the approach, when a packet is received from a network, a determination is made whether the packet belongs to an existing flow, for which flow statistical data is being collected, or to a new flow. If the packet belongs to an existing flow, then the packet is always sampled, and the statistical data for the existing flow is updated to reflect the packet. If the packet belongs to a new flow, then a sampling probability is used to determine whether the new flow is to be sampled, i.e., whether statistical data is to be collected for the new flow. The sampling probability is determined, at least in part, upon a current usage of resources. If, based upon the sampling probability, statistical data is to be collected for the new flow, then statistical data that reflects the packet is generated and stored. From then on, the statistical data for the new flow is updated to reflect all additional packets that are received for that flow. A key assumption for this approach is that updating an existing piece of statistical data consumes much less resources than creating a new piece of statistical data. This assumption is generally true in conventional computing environments.
The approach provides control over the amount of resources consumed by flow statistical data, while ensuring that the export of flow statistical data occurs in a deterministic manner. For purposes of explanation, embodiments of the invention are described hereinafter in the context of managing the consumption of memory resources. The approach is not limited to the memory resource context however, and is applicable to any type of resource. For example, the approach is applicable to managing the consumption of processing resources.
II. Architecture
Router 102 is configured with a flow monitor 108, a resource monitor 110 and a memory 112 with flow statistical data 114. Flow monitor 108 monitors packets passing through router 102 and generates flow statistical data 114. Flow monitor 108 is also configured to export flow statistical data 114 to other network elements (not depicted), such as a flow collector. Resource monitor 110 monitors the consumption of resources on router 102, such as memory 112, CPU resources, or bandwidth, and makes this information available to other elements and processes, such as flow monitor 108. Flow monitor 108 and resource monitor 110 are typically implemented as processes executing on router 102, but may be implemented by hardware or any combination of hardware and software processes. Memory 112 may be any type or combination of mechanisms and media, volatile or non-volatile, that provide for the storage of data. Examples of memory 112 include, without limitation, a random access memory (RAM), a cache, one or more disks, or any combination thereof.
Flow statistical data 114 may include flow statistical data for any number of flows passing through router 102. In practice, flow statistical data 114 may include flow statistical data spanning many orders of magnitude depending upon the amount of traffic router 102 can process. The particular statistical data included in flow statistical data 114 may vary widely, depending upon the requirements of a particular implementation, and the approach is not limited to any particular statistical data. The particular types of data included in flow statistical data 114 may be specific to router 102 and thus different from flow statistical data at other network elements and devices. Router 102 may be configured with other elements and processes, depending upon a particular implementation, that are not depicted in the figures and described herein for purposes of explanation.
III. Adaptive Random Sampling
As previously described herein, adaptive random sampling is used to manage the consumption of resources. According to this approach, when it is determined that a received packet does not belong to an existing flow, then the packet belongs to a new flow. In this situation, a sampling probability is determined for the new flow. The sampling probability indicates a probability that the new flow will be sampled, i.e., that collection of flow statistical data will be initiated for the new flow. The sampling probability is used to determine whether to generate flow statistical data for a given flow, and is an attribute assigned to and exported with each flow as described in more detail hereinafter.
According to one embodiment of the invention, the sampling probability is dynamically adjusted to prevent all available resources from being consumed.
According to one embodiment of the invention, the sampling probability for a new flow is determined based upon the current consumption of memory.
In this example, line 406 represents a step function where the sampling probability is reduced by 50% for each 50% reduction in available memory. Thus, the first 50% reduction in available memory (to ½ of the available memory) corresponds to a 50% reduction in sampling probability to P/2. The next 50% reduction in available memory (to ¼ of the available memory) corresponds to another 50% reduction in sampling probability to P/4, and so on. Starting with a full available memory and assuming a base probability of P=1 (the base probability may be any value between 0 and 1), a sampling probability of one is used to determine whether to initiate collection of flow statistical data for new flows. In this situation, flow statistical data collection is initiated for all new flows until the available memory is reduced by one half. At that point, the sampling probability used for new flows is reduced by 50%, making it less likely that flow statistical data collection will be initiated for new flows. This process continues with a 50% reduction being made in sampling probability for each 50% reduction in available memory.
Once the sampling probability has been determined for a packet that belongs to a new flow, then a determination is made, based upon the sampling probability, whether statistical data collection should be initiated for the new flow. For example, a random number generator may be used to determine whether the packet should be sampled and the collection of statistical data should be initiated for the new flow, given the sampling probability determined for the packet.
The result of using adaptive random sampling as described herein is that as the available memory decreases, the number of new flows for which collection of statistical data is initiated decreases. This behavior may be characterized by the memory consumption asymptotically approaching, but never reaching, the total available memory, as depicted in
At some point, flow statistical data is exported from the memory, which increases the amount of available memory. Assuming all of the flow statistical data is exported, then the base sampling probability is assigned to the next new flow, since all of the memory will be available.
IV. Operational Example
In step 606, if the packet belongs to an existing flow, then in step 608, the statistical data for the existing flow is updated to reflect the packet. For example, flow monitor 108 updates the flow attributes in table 200 for the existing flow to reflect the packet. This may include, for example, updating the end time, number of packets and the number of bytes to reflect the packet. Updating flow statistical data incurs no storage penalty since additional packets only affect the flow attribute values for a flow entry in table 200.
If, in step 606, the packet does not belong to an existing flow and instead belongs to a new flow, then in step 610, a sampling probability is determined for the packet based upon the current consumption of resources. In the present example, a sampling probability is determined for the packet based upon the current consumption of memory 112, as indicated by resource monitor 110.
In step 612, a determination is made whether, based upon the determined sampling probability, the packet is to be sampled, i.e., that collection of statistical data for the new flow is to be initiated. Suppose that in step 610, resource monitor 110 indicated that the amount of available memory 112 was between ¼ and ½ and the sampling probability was therefore determined to be ½ (for a base sampling probability of P=1). A random number generator may be used to generate a number between zero and ten. If the result is between zero and five, then the new flow is sampled. If the result is between five and ten, then the new flow is not sampled. Other ranges may be used, depending upon a particular implementation. Furthermore, other techniques may be used to determine whether a packet should be sampled, given a sampling probability for the packet.
In step 614, if the packet belonging to a new flow is to be sampled, then statistical data is generated for the new flow. For example, a new entry may be added to table 200 for the new flow and the corresponding flow attributes determined based upon the packet. From then on, all subsequent packets that belong to the flow will be sampled. According to one embodiment of the invention, the attributes include the sampling probability that will also be exported along with the statistical data for each flow. The per flow sampling probability allows external applications to normalize the flow statistical data in order to compare across flows that have different sampling probabilities attached.
If, in step 612, a determination is made that the packet is not to be sampled, then flow statistical data is not generated for the flow. When the next packet that belongs to the same flow is received, a new sampling probability is determined for this packet, based upon the then current consumption of resources. This sampling probability may be the same or different than the sampling probability for the first packet that was not sampled.
V. Implementation Mechanisms
As previously mentioned herein, the approach is applicable to any type of resources, such as memory resources and processing resources. The approach may also be based upon the amount of time left in a current fixed export window until the next export occurs. In this situation, the sampling probability for a new flow is determined based upon an amount of time remaining (percentage or absolute amount) until the next scheduled export of flow statistical data.
The approach described herein may be implemented in a variety of mechanisms/processes and contexts and the invention is not limited to any particular mechanism/process or context. The approach may be implemented in any environment where sampling is performed. For example, the approach may be implemented in flow monitor 108, or some other process executing on router 102. Furthermore, any portion of the approach may be implemented in hardware, computer software or any combination of hardware and computer software.
When implemented in a software process, such as flow monitor 108, the process may execute on any type of computing architecture or platform.
Computer system 700 may be coupled via bus 702 to a display 712, such as a cathode ray tube (CRT), for displaying information to a computer user. An input device 714, including alphanumeric and other keys, is coupled to bus 702 for communicating information and command selections to processor 704. Another type of user input device is cursor control 716, such as a mouse, a trackball, or cursor direction keys for communicating direction information and command selections to processor 704 and for controlling cursor movement on display 712. This input device typically has two degrees of freedom in two axes, a first axis (e.g., x) and a second axis (e.g., y), that allows the device to specify positions in a plane.
The invention is related to the use of computer system 700 for implementing the techniques described herein. According to one embodiment of the invention, those techniques are performed by computer system 700 in response to processor 704 executing one or more sequences of one or more instructions contained in main memory 706. Such instructions may be read into main memory 706 from another machine-readable medium, such as storage device 710. Execution of the sequences of instructions contained in main memory 706 causes processor 704 to perform the process steps described herein. In alternative embodiments, hard-wired circuitry may be used in place of or in combination with software instructions to implement the invention. Thus, embodiments of the invention are not limited to any specific combination of hardware circuitry and software.
The term “machine-readable medium” as used herein refers to any medium that participates in providing data that causes a machine to operation in a specific fashion. In an embodiment implemented using computer system 700, various machine-readable media are involved, for example, in providing instructions to processor 704 for execution. Such a medium may take many forms, including but not limited to, non-volatile media, volatile media, and transmission media. Non-volatile media includes, for example, optical or magnetic disks, such as storage device 710. Volatile media includes dynamic memory, such as main memory 706. Transmission media includes coaxial cables, copper wire and fiber optics, including the wires that comprise bus 702. Transmission media can also take the form of acoustic or light waves, such as those generated during radio-wave and infra-red data communications.
Common forms of machine-readable media include, for example, a floppy disk, a flexible disk, hard disk, magnetic tape, or any other magnetic medium, a CD-ROM, any other optical medium, punchcards, papertape, any other physical medium with patterns of holes, a RAM, a PROM, and EPROM, a FLASH-EPROM, any other memory chip or cartridge, a carrier wave as described hereinafter, or any other medium from which a computer can read.
Various forms of machine-readable media may be involved in carrying one or more sequences of one or more instructions to processor 704 for execution. For example, the instructions may initially be carried on a magnetic disk of a remote computer. The remote computer can load the instructions into its dynamic memory and send the instructions over a telephone line using a modem. A modem local to computer system 700 can receive the data on the telephone line and use an infra-red transmitter to convert the data to an infra-red signal. An infra-red detector can receive the data carried in the infra-red signal and appropriate circuitry can place the data on bus 702. Bus 702 carries the data to main memory 706, from which processor 704 retrieves and executes the instructions. The instructions received by main memory 706 may optionally be stored on storage device 710 either before or after execution by processor 704.
Computer system 700 also includes a communication interface 718 coupled to bus 702. Communication interface 718 provides a two-way data communication coupling to a network link 720 that is connected to a local network 722. For example, communication interface 718 may be an integrated services digital network (ISDN) card or a modem to provide a data communication connection to a corresponding type of telephone line. As another example, communication interface 718 may be a local area network (LAN) card to provide a data communication connection to a compatible LAN. Wireless links may also be implemented. In any such implementation, communication interface 718 sends and receives electrical, electromagnetic or optical signals that carry digital data streams representing various types of information.
Network link 720 typically provides data communication through one or more networks to other data devices. For example, network link 720 may provide a connection through local network 722 to a host computer 724 or to data equipment operated by an Internet Service Provider (ISP) 726. ISP 726 in turn provides data communication services through the world wide packet data communication network now commonly referred to as the “Internet” 728. Local network 722 and Internet 728 both use electrical, electromagnetic or optical signals that carry digital data streams. The signals through the various networks and the signals on network link 720 and through communication interface 718, which carry the digital data to and from computer system 700, are exemplary forms of carrier waves transporting the information.
Computer system 700 can send messages and receive data, including program code, through the network(s), network link 720 and communication interface 718. In the Internet example, a server 730 might transmit a requested code for an application program through Internet 728, ISP 726, local network 722 and communication interface 718. The received code may be executed by processor 704 as it is received, and/or stored in storage device 710, or other non-volatile storage for later execution. In this manner, computer system 700 may obtain application code in the form of a carrier wave.
In the foregoing specification, embodiments of the invention have been described with reference to numerous specific details that may vary from implementation to implementation. Thus, the sole and exclusive indicator of what is, and is intended by the applicants to be, the invention is the set of claims that issue from this application, in the specific form in which such claims issue, including any subsequent correction. Hence, no limitation, element, property, feature, advantage or attribute that is not expressly recited in a claim should limit the scope of such claim in any way. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.
Number | Name | Date | Kind |
---|---|---|---|
7185103 | Jain | Feb 2007 | B1 |
7193968 | Kapoor et al. | Mar 2007 | B1 |
7536455 | Duffield et al. | May 2009 | B2 |
20030046396 | Richter et al. | Mar 2003 | A1 |
20040199630 | Sarkissian et al. | Oct 2004 | A1 |
20090161570 | Duffield et al. | Jun 2009 | A1 |
Number | Date | Country | |
---|---|---|---|
20070041331 A1 | Feb 2007 | US |