Generalised flow: Identified by a function of the header field values, so that it is not constrained to 5-tuples.

Large flow: Those that send more than a given threshold during a given measurement interval.

Goal: Report the large flows with their flow ID and sizes at the end of measurement. Because, say, a network of bandwidth can have 10 flows at threshold , thus the theoretical minimum amount of memory required is inversely proportional to the threshold, i.e. .

To measure an algorithm, we have four metrics: (1) the memory consumption, (2) false positives, (3) false negatives, (4) error in traffic intensity estimates.

Chapter 3 (Solution): Assume the processor is fast enough to perform some processing (look up and modify counter) per packet arrival, but the memory is limited. If we record a new flow on memory by expelling the smallest flow (even with LRU policy), we may miss a large flow due to its small count at an instant. Random sampling can avoid this problem but the error is high (proportional to where is the amount of memory).

# Sample and Hold

Sample and hold algorithm is proposed in this paper, it claims the error proportional to . It sample every packet with a probability and create an entry in the counter. After an entry is created, *every* subsequent packet of the same flow is counted.

Analysis of the sample and hold is as follows: Assume we want to find the flows consumed more than a faction of capacity . Theoretically, there are at most such flows. Now we over-sample by a factor of , so we keep st counters. We take the sampling probability (per byte) to be .

For a flow sending more than bytes, the probability that such flow is never sampled has the probability less than . Using similar logic, we can also see that the flow is counted before a fraction of the total traffic sent is . Thus the probability of having a relative error of in underestimating the traffic load is given by .

# Multistage filter

Using parallel hash functions to hash the packets’ flow ID and count for the traffic intensities, it can reduce the false positives exponentially because a heavy flow is identified only if all the hash counters report heavy.

# Tuning of Algorithm

Given that heavy flows are identified at certain accuracy, the result can be refined by certain ‘tunes’.

Firstly, because heavy flows are likely to stay longer than small flows, we are easier to confirm them by comparing the identified flows across sampling cycles. We can preserve both heavy flow entries and newly added flow entries in a cycle to the next sampling cycle but reset the count. In other words, small flows in two consecutive cycles are confirmed as small.

Secondly, besides the preservation above, we can see it suitable to remove the extremely small flows before proceeding to the next cycle even they are added in the current cycle because they are very unlikely to be heavy. To do this, we may set another threshold that the flows smaller than this are removed.

Thirdly, if we count on the hashed flow ID, we can reduce the false positives by shielding the already-known heavy flows. Thus given that a heavy flow is known, it is not hashed and not counted (at the hash counter). Thus the counter can tell whether there is another flow of the same hashed value and whether it is heavy.

Fourthly, perform conservative update on counters of multistage filters. Instead of adding the byte count to all hashed values, the lowest counter is added the number of bytes whereas the other counters only add up to the new value of the lowest counter. If the other counter is already at a higher value than the new value, its count doesn’t change.

Finally, no change of counter in the multistage filter if it already found in the flow memory. This can avoid unnecessary increase in the counter.

Chapter 4 (Evaluation): Consider the sample and hold here. Assume the sampling probability is and a flow has size . The probability that the flow will not be sampled is . As discussed previously, if equals to the threshold , such probability is equal to where is the oversampling ratio. For a flow of certain size, it get sampled on byte has the probability , which and . So if the counter tells the flow is of size , the best real size estimate shall be .

There is also a calculation about the memory required for sample and hold. The total number of bytes sampled would be where p is the sampling probability, is the link capacity and is the sampling period. If there are flows, and the bytes are uniformly random to belong to any flow, the probability of a flow did not sampled is and the probability of flows being sampled is then , which is a binomial distribution. By approximating the binomial distribution with normal distribution, we can have an equation about the number of flow counters needed depending on the overflow probability.

So what if the ‘uniform randomness’ is not a valid assumption? Since we know, the flow size distribution is more like Zipf or Pareto.

## Bibliographic data

```
@techreport{
title = "New Directions in Traffic Measurement and Accounting",
author = "Cristian Estan and George Varghese",
institution = "UCSD",
howpublished = "SIGCOMM'02",
number = "CD TR 699",
year = "2002",
}
```