# Patent

## Title
System and method for catching top hosts

## Abstract

Disclosed are a system and a method for catching top users. The system may comprise: a filter (10) configured to sample flows from the hosts and remove the flows not satisfying a constraint; an tracker (20) configured to record a first estimated flow count for each host and to determine a first set of hosts from the plurality of hosts in term of the estimated flow count; and an estimator (30) configured to determine a second estimated flow count for each of the determined hosts and select a second set of hosts from the determined hosts based on the second estimated flow count.

## Background
CROSS REFERENCE TO RELATED APPLICATIONS
This application is a United States National Phase application of PCT/CN2010/070553 filed Feb. 5, 2010 that claims the benefit of U.S. Provisional Application No. 61/150,698 filed on Feb. 6, 2009, of which the contents are incorporated herein by reference in its entirety.


TECHNICAL FIELD
The present application relates to a system and a method for catching top hosts in the network.
BACKGROUND
Efficiently and accurately identifying hosts that are spreading the largest amount of flows during an interval of time is very important for managing a network and studying host behaviors on application level, ranging from detecting DDoS attack, worm propagation, peer-to-peer hot spots and flash crowds. No previous work has been able to efficiently and accurately identify the top spreaders at very high link speed, for example, 10 to 40 Gbps.
Considering the case of finding hosts who are spreading a large amount of flows, FIG. 1 shows a scenario: hosts in a local ISP network communicate with other hosts in the global Internet through a high speed link. As shown, host3 is communicating with a lot of hosts, and may be a very popular web server, or may be initiating or under DDoS attack. It is required to quickly and efficiently identify such kind of hosts in a network, and know how severe the situation is.
There has been a lot of works on measurement of traffic statistics for network management, security, and its evolvement. The size distribution and matrices of flows from the hosts may help a network to provide and engineer traffic thereof. Finding flows that have a large number of packets is useful in billing and accounting. It has also been shown that flow level communication patterns may further reveal application level behaviors of each host.
Typically, flows of small sizes are more interesting to security related problems. For example, a host scanning a port or address typically sends only a very small number of packets to each victim, to keep the overhead small and lower the chance to be detected. A SYN flood DDoS attack typically contains only one SYN packet in each attack flow, and the acknowledged ACK packets are ignored. A newly exposed TCP attack uses many low rate TCP sessions to exhaust resources of the victim, and during a small interval, these TCP flows can also be viewed as small flows. P2P applications tend to contact some servers or other peers to exchange control information in a periodical fashion, and such control messages typically contain a small number of packets.
Currently, there are some problems of detecting super hosts with small flows in the field.
SUMMARY
In one aspect, a system for catching top hosts from a plurality of hosts may comprise:
a filter configured to sample flows from the hosts and remove the flows that not satisfying a first constraint;
a tracker configured with a data structure for recording a first estimated flow count for each host and configured to determine a first set of hosts from the plurality of hosts in term of the estimated flow count; and
an estimator configured to determine a second estimated flow count for each of the determined hosts and select a second set of hosts from the determined hosts based on the second estimated flow count.
In the other aspect, a method for catching top hosts from a plurality of hosts may comprise:
sampling a plurality of packets from the hosts during a determined interval of time;
determining a difference between a count and a count error for each of the hosts based on the sampled packets;
ranking the hosts based on the determined difference to identify a first set of hosts in the ranked hosts;
estimating a flow count for each of the first set of hosts; and
selecting a second set of hosts from the first set of hosts as the top hosts based on the estimating.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a diagram illustrating a communication scenario for hosts in the prior art;
FIG. 2 is a block diagram schematically illustrating the system architecture according to one embodiment of the application;
FIG. 3 is a block diagram schematically illustrating the filter of FIG. 2 according to one embodiment of the application;
FIG. 4 is a block diagram schematically illustrating the tracker of FIG. 2 according to one embodiment of the application;
FIG. 5 schematically illustrates a data structure of system of FIG. 2 according to one embodiment of the application;
FIG. 6 is a diagram illustrating a typical scenario for the using of the filter of FIG. 2;
FIG. 7 is a block diagram schematically illustrating the estimator of FIG. 2 according to one embodiment of the application;
FIG. 8 is a block diagram schematically illustrating the flowchart of updating the estimator of FIG. 2 according to one embodiment of the application;
FIG. 9 is a block diagram schematically illustrating the flowchart of the singleton flow count estimation algorithm according to one embodiment of the application.
FIG. 10 is another diagram illustrating a typical scenario for the using of the filter of FIG. 2;
FIG. 11 illustrates a mapping of the counters in the filter according to one embodiment of the application; and
FIG. 12 illustrates a permutation of the counters in the estimator as shown in FIG. 5.



DETAILED DESCRIPTION
Hereinafter, a detailed description of implementations will be given with reference to the appended drawings and embodiments.
For the purpose of description, the following definitions are given first.
A scanner is defined as a host or a port on a host, acting as a “user” that is communicating with other hosts or ports. In the application, there is almost no difference when handling the two situations, except whether the user ID comes from the IP address or the IP address together with the port number. Hereinafter, the former case is used to discuss the embodiment of the application.
A flow is defined as a combination of fields in a packet, for example, IP address, port, TCP flags, or even packet content. Different applications may have interests in different fields, and the unique combination of these fields forms a flow ID. In the application, the flows of size i are considered, where i is a small integer. Such flows are referred as small flows. For ease of discussion, the flows of size 1, as referred as singleton flows, are used to describe the embodiments of the application.
A scanner or user is super in terms of the number of its singleton flows. A scanner or user is top if and only if its singleton flow count is above a threshold. Although finding all users with singleton flow counts above a threshold can be useful, in practice, it is hard to find an appropriate threshold to classify the users. For example, given a threshold, there are often either too many or too few users. Only considering ranking based top users may suffer that, from another point, no meaningful results exist at all if all users only have a small number of singleton flows. So, in the application, these two conditions are combined together, and the exact value of a threshold is less important.
FIG. 2 schematically illustrates a system 1000 for determining top hosts according to an embodiment of the application. As shown, the system 1000 comprises a filter 10, a tracker 20 and an estimator 30. The filter 10 is configured to sample flows from a plurality of hosts and remove the flows not satisfying a first constraint during a determined interval of time, which will be discussed hereinafter. The tracker 20 is configured with a data structure for recording a first estimated flow count for each of the hosts and configured to determine a first set of hosts (for example, the top-2k hosts) from the plurality of hosts in term of the estimated flow count. The estimator 30 is configured to determine a second estimated flow count for each of the determined hosts and select a second set of hosts (for example, the top-k hosts) from the determined hosts based on the determined second flow counts. k is a small number, e.g. 10 or 20, which is most useful for network management and security.
1. Filter 10
As shown in FIG. 3, the filter 10 is configured with a sampling unit 101, a determining unit 102 and an accounting unit 103. The sampling unit 101 operates to sample the arrival packets and to calculate a value of Vf based on the flow ID f of the packets by the following equation:

Vf=h(f)  1)

Where h( ) is a uniform hash function that may calculate, for example, a hash result of 32 bits.
A plurality of counters are arranged in the accounting unit 103 and are represented mathematically as an array c[1 . . . m], where each counter has two bits. The determining unit 102 operates to determine whether the calculated Vf is less than a predetermined sampling threshold T1. If yes, this packet is sampled and then the accounting unit 103 checks whether the array c[1 . . . m] should be updated, which will be discussed in detailed as below. If no, this packet is discarded. If the intended sampling rate is r and the output range of h( ) is from 1 to H, then T1 should be set to rH, such that one out of 1/r flows is sampled. The sampling rate r should be inversely proportional to the link speed. For example, on high speed links such as OC768, r can be set to 1/16, while on links with speed of or less than OC48, r can be set to 1.
At beginning of the sampling, all counters of c[1 . . . m] are set to be zero, so that each counter in array c[1 . . . m] may record up to three. Packets of the same flow f are mapped to the same position l=hm(f), where hm( ) can calculate a hash result in the range from 1 to m, and can be a prefix of h( ) in implementation. The element e[l] is used to record the number of packets already mapped to this position. In particular, we use ct to represent the counters in the filter 10 when seeing the t-th sampled packet and assuming the packet is from host s. If ct[l]≦1, then the accounting unit 103 sets ct+1[l]=ct[l]+1.
When considering small flows of no more than q packets, the accounting unit 103 sets ct+1[l]=ct[l]+1 when ct[l]≦q, and each counter needs at least ┌ log2(q+2)┐ bits where ┌x┐ means the smallest integer no smaller than x.
2. Tracker 20
Referring to FIG. 4, the tracker 20 maintains a hash table 201 and a min-heap 202. The key of a node in the hash table 201 is host ID (i.e. parameter s), and the value of a node in the hash table 201 is the corresponding position of the node in the min-heap 202. As shown in FIG. 5, a node in the min-heap 202 has three fields, its host ID, its count (not necessary to be an integer), and its possible error of count err. The count and err of s in the min-heap 202 act as a coarse estimation for the flow count of s. In the min-heap 202, at most z nodes are kept for z different hosts. The count's and err's in the min-heap 202 may also be represented as two arrays count[1 . . . z] and err[1 . . . z] for efficient implementation.
The counter number z should be set to




  
    z
    =
    
      min
      ⁡
      
        (
        
          
            
            A
            
          
          ,
          
            ⌈
            
              n
              T
            
            ⌉
          
        
        )
      
    
  
  ,




where |A| is the number of hosts and n is the total number of flows, and T is the threshold such that hosts with more than T singleton flows are considered to be “super”. For each update, the worst case processing time is O(log z). Since z is very small, the hash table 201 can be stored in a TCAM with O(1) performance. For strict time requirement, sampling in the filtering 10 may reduce processing overhead.

As shown in FIG. 4, the tracker 20 is also provided with a detecting unit 203 for detecting the change of the counter values in the accounting unit 103. Specifically, when c[l] (where l=hm(f)) in the accounting unit 103 is changed, the field of count in the min-heap 202 may be updated accordingly. In particular, for each update for host s triggered by the filter 10, ifs is not kept in the ID field of the table 201 and the min-heap 202, the ID with the minimal count (let min be this value) in the min-heap 202 and table 201 is replaced by s, the corresponding count in the min-heap 202 is updated as below, and the corresponding err is set as errs=min. However, if s is already kept in the ID field of the table 201 and the min-heap 202, only the count of s (that is counts) is updated as below.
When the t-th packet with host ID s and flow ID f arrives, and ct[hm(f)] in the accounting unit 103 is changed,




  
    
      
        
          
            
              If
              ⁢
              
                
              
              ⁢
              
                
                  c
                  t
                
                ⁡
                
                  [
                  
                    
                      h
                      m
                    
                    ⁡
                    
                      (
                      f
                      )
                    
                  
                  ]
                
              
            
            =
            0
          
          ,
          
            
              count
              s
            
            =
            
              
                count
                s
              
              +
              
                
                  m
                  
                    
                      y
                      0
                    
                    ⁡
                    
                      (
                      t
                      )
                    
                  
                
                ×
                
                  (
                  
                    
                      
                        
                          y
                          1
                        
                        ⁡
                        
                          (
                          t
                          )
                        
                      
                      
                        
                          y
                          0
                        
                        ⁡
                        
                          (
                          t
                          )
                        
                      
                    
                    +
                    1
                  
                  )
                
              
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            
              If
              ⁢
              
                
              
              ⁢
              
                
                  c
                  t
                
                ⁡
                
                  [
                  
                    
                      h
                      m
                    
                    ⁡
                    
                      (
                      f
                      )
                    
                  
                  ]
                
              
            
            =
            1
          
          ,
          
            
              count
              s
            
            =
            
              
                count
                s
              
              -
              
                m
                
                  
                    y
                    0
                  
                  ⁡
                  
                    (
                    t
                    )
                  
                
              
            
          
        
      
    
    
      
        2
        )
      
    
  




where m represents the number of counters in the filter 10, and y0(t) and y1(t) are the number of counters in ct with value 0 and 1 respectively. Herein the value of counts is the flow count of host s.
Taking FIG. 6 as an example, for the 2-bits counter values, since only 0 and 1 are useful for estimating singleton flow count, the application uses 2 to mean any value large than 1, while 3 is not used. Gray squares represent packets that have arrived, and squares with characters represent forthcoming packets. Different gray levels or characters represent different flows. Although each is the first packet of a flow, A1 and E1 see a value of 0, but B1 and D1 see a value of 1, and C1 sees a value of 2. As the second packet of a flow, B2 will see a value of 2, but E2 will see a value of 1.
When considering small flows that have no more than q packets, equation 2) should be changed accordingly to:

If ct[hm(f)]=i and i≦q, counts=counts+Ui,q(t)  3)

where Ui,q(t) is determined by i, q, y0(t), . . . , yq(t), m. The counter in the filter 10 should be at least ┌ log2(q+2)┐ bits where ┌r┐ means the smallest integer no smaller than x. The exact formulas for computing Ui,q(t) are provided as equation 8) in the mathematical proof.
As shown in FIG. 4, the tracker 20 also comprises a selecting unit 204. The selecting unit 204 is configured to rank all of the hosts based on the estimated flow counts, namely counts's, in a descending or ascending order. The top-2k hosts in the ranked hosts are identified by the selecting unit 204 as potential top spreaders, where k is an integer. Although theoretically, k can be selected from 1 to the total number of hosts, here it only considers the situation where k is a small constant number, e.g. 10 or 20, when the network management and security is concerned.
The detailed architecture with data structures for the filter 10 and tracker 20 are shown in FIG. 5, wherein some units therein are omitted for the purpose of clarity.
3. Estimator 30
The estimator 30 is used to select, for example, top-k hosts from, for example, the top-2k potential top spreader identified by the tracker 20. As shown in FIG. 7, the estimator 30 includes a counter 301 configured with w×d counting units (d columns, each column has w counting units), with each counting unit represented by 2 bits. All of the counting units are initialized to zero. Besides the counter 301, the estimator 30 also includes a detecting unit 302, a selecting unit 303 and an updating unit 304.
The detecting unit 302, the selecting unit 303 and the updating unit 304 cooperate to update the counting units in the first counter 301. FIG. 8 illustrates the updating of the first counter 301 according to one embodiment of the application. In step S801, when a packet from host s arrives (notice that different from the filter 10, packets are used with sampling), the detecting unit 302 operates to detect whether s is tracked in the tracker 20 and the coarse flow count of s, that is counts−errs in the min-heap 202 of the tracker 20, is above an estimating threshold T2. When the detecting unit 302 detects counts−errs in the min-heap 202 of the tracker 20 is above T2, in step S802, it uses for example, 3 hash functions h1(s), h2(s), h3(s) to select 3 columns of counting units from d columns by a rule of

columnss=hi(s) for i=1 to 3  4)

where columnss represents the selected columns of the counting units where an input parameter is the host ID s. In the embodiment, for the purpose of illustration, the three columns are denoted as Mh1(s), Mh2(s) and Mh3(s).
In step S803, the selecting unit 303 operates to select a row of counting units from the selected three columns (Mh1(s), Mh2(s). Mh3(s)) in the same level. In particular, f=hw(f) is used to represent the location of row for the selected counting units, where hw( ) can calculate a hash result in the range from 1 to w, and can be a prefix of h( ) in implementation. Now the three counting units Mh1(s)[l], Mh2(s)[l], Mh3(s)[l] are selected.
In step S804, for a new packet from s with flow ID f, the updating unit 304 operates to set the three selected counting units as below.
For i=1 to 3

If Mhi(s)[l]<=1, Mhi(s)[l]=Mhi(s)[l]+1  5)

When considering small flows of no more than q packets, equation 5) should be changed accordingly to

If Mhi(s)[l]<=q, Mhi(s)[l]=Mhi(s)[l]+1  6)

Each counting unit in the estimator 30 should be at least ┌ log2(q+2)┐ bits where ┌x┐ means the smallest integer no smaller than x.
Referring to FIG. 7 again, the estimator 30 may further comprise an estimating unit 305. The estimating unit 305 is configured to estimate flow counts of the selected 2k hosts.
FIG. 9 illustrates the estimating processing for the estimating unit 305. In this exemplified example, consider the three columns (Mhi(s), Mh2(s), Mh3(s)) that host s is mapped to and denote them by M1, M2 and M3 (S901). Then, in step S902, M12, M13, M23 and M123 are calculated, where M12[l]=M1[l]+M2[l], M13[l]=M1[l]+M3[l], M23[l]=M2[l]+M3[l], and M123[l]=M1[l]+M2[l]+M3[l], for 1≦l≦w. In step S903, determine whether any one of M12, M13, M23 and M123 overflows (it overflows if there is no counting unit with value 0). If yes, we can not use them for estimating, and then in step S904, use (counts−errs)/r from the tracker 20 as the flow count of host s. Otherwise, in step S905, a temporarily estimated flow count St is calculated by a rule of

St=(|M1|+|M2|+|M3|−|M12|−|M13|−|M23|+|M123|)/3,  7)

where |MA|=w×(#counters in MA with value 1)/(#counters in MA with value 0) and r is the sampling rate for the sampling unit 101.
In step S906, T2/r is added to St, and the result is used as an estimated flow count for the host s.
When considering small flows with no more than q packets, equation 7) should be changed accordingly. The exact formulas for computing |MA| and St are provided as equations 9) ̃15) in the mathematical proof.
Referring to FIG. 7 again, the estimator 30 may further comprise an outputting unit 306. The estimating unit 306 is configured to sort the host IDs in a descending or ascending order based on the estimated flow counts for the hosts and selecting top-k hosts from the top-2k hosts.
As mentioned in the above, the counter number z in the tracker 20 should be set to




  
    z
    =
    
      min
      ⁡
      
        (
        
          
            
            A
            
          
          ,
          
            ⌈
            
              n
              T
            
            ⌉
          
        
        )
      
    
  
  ,




where |A| is the number of hosts and n is the total number of flows, By neglecting time for hash computations and update on y0 and y1, it can be seen that for each sampled flow (1 out of 1/r), where r is the rate of sampling, at most two packets can cause update on the filter 10 and the tracker 20, where each update needs at most one read and one write on the filter 10, and 1+log(z) r/w on the tracker 20. And for a small number of hosts, each packet of them needs one read on the tracker 20 and 3 r/w on the estimator 30. The total memory is 2m+240z+2dw bits (for small flows with no more than q packets, the memory required is ┌ log2(q+2)┐m+240z+┌ log2(q+2)┐dw bits).

For a practical situation such as n=220 and |A|=20K, we set r= 1/16, m=222, c=2000, w=4096 and d=1024, the memory needed is 1148 KB, which can be affordable in SRAM, and the update speed can keep up with 40 Gbps. The identified top-20 scanners are almost always correct, and the flow count estimation at an average relative error of 3%. Using more memory can lead to better performance.
More importantly, the system and the algorithms used therein can perform on very high speed links, with a large number of hosts and flows, e.g. 10 Gbps=40 Gbps, 1M flows and 200K hosts, which is the real situation happening on ISP backbones.
In case that a host has a very large number of flows (e.g. more than wln(w)), then the estimator 30 may be filled up, and we just use the counter provided by the tracker 20.
Hereinabove, the systems 1000 and the cooperation for the components in the systems have been discussed. Now, some mathematical supports for some of the above equations are given as below.
1. Mathematical Support for Equation 2) and 3)
We consider an array of in counters, and use yk(t) and cj(t) to explicitly denote the number of counters with value k and the value of the j-th counter right before the t-th packet arrival, respectively. As shown in FIG. 10, B1, the t-th packet, sees a counter value of two. Gray squares represent packets that have arrived before B1, squares with characters represent forthcoming packets, and different patterns or characters represent different flows. For clarity we have omitted the uniform hash function that maps flows to counters.
First we note that, the counter value that any packet sees is independent of the arriving order of its preceding packets. We denote the set of flows by , and denote the x-th packet of flow f by fx. We also denote the t-th packet among all packets by et which sees value vt, so the event “∃f∈, et=fx” (abbreviated to “et=fx”) means “the t-th packet is the x-th packet of some flow f, and vt=chm(f)(t). Now we have some theorems about the probability of this event.
Theorem 1.
The conditional probability that the t-th packet et sees a counter value of z, given that et is the x-th packet of some flow, is:




  
    Pr
    ⁡
    
      (
      
        
          v
          t
        
        =
        
          
            z
            ❘
            
              e
              t
            
          
          =
          
            f
            x
          
        
      
      )
    
  
  =
  
    {
    
      
        
          
            0
            ,
          
        
        
          
            
              
                if
                ⁢
                
                  
                
                ⁢
                z
              
              <
              
                x
                -
                1
              
            
            ;
          
        
      
      
        
          
            
              y
              /
              m
            
            ,
          
        
        
          
            
              
                
                  if
                  ⁢
                  
                    
                  
                  ⁢
                  z
                
                ≥
                
                  x
                  -
                  
                    1
                    ⁢
                    
                      
                    
                    ⁢
                    and
                    ⁢
                    
                      
                    
                    ⁢
                    x
                  
                
              
              =
              1
            
            ;
          
        
      
      
        
          
            p
            ,
          
        
        
          
            
              
                if
                ⁢
                
                  
                
                ⁢
                z
              
              ≥
              
                x
                -
                
                  1
                  ⁢
                  
                    
                  
                  ⁢
                  and
                  ⁢
                  
                    
                  
                  ⁢
                  x
                
              
              >
              1
            
            ;
          
        
      
    
  




where y=yz−x+1(t) is the number of counters with value z−x+1 right before this packet arrives, (y−1)/m≦p≦(y+1)/m and with high probability, p=y/m. Particularly, for x=1, that is for the first packet of each flow, we have Pr(vt=z|et=f1)=yz(t)/m.

Proof of Theorem 1:
(1) Since the preceding x−1 packets belonging to the same flow as et map into the same position, z is at least x−1, so the probability is always zero when z<x−1.
(2) For x=1, which means et is the first packet of some flow, since the position mapping is uniform and is independent of any proceeding packets, the probability that it sees value z is just the percentage of counters with value z at that time, that is, yz(t)=m.
(3) For x>1, however, the mapping of Bx is dependent on B1 and the probability is not simply yz(t)/m. Let us focus on the counter which B1, B2, . . . are mapped to, as shown in FIG. 11. Due to collisions, there may be some other flows (gray squares) mapped to that counter.
In the first row, the t-th packet Bx is the x-th packet of flow B, and it sees a counter value of z′. We can always reorder its preceding packets without changing the counter values. So we can look for a particular ordering to help the calculation of the probability of z′=z. Specifically, we put all the preceding x−1 packets of the same flow right before this packet, as shown in the second row of FIG. 11. Then B1, the first packet of flow B, would have seen a counter value of z′−x+1, as shown in the third row. For this particular reordering, we have Pr(vt=z|et=fx)=Pr(ch(f)(t−x+1)=z−x+1|et=fx), that is, the probability that Bx sees value z equals the probability that B1 sees value z−x+1. It should be noted that all the other counters remain unchanged after this reordering. So if in the first and second row there are y=yz−x+1(t) counters having value z−x+1 right before Bx (the t-th packet) arrives, then in the third row there must be at lease y−1 and at most y+1 counters having a value of z−x+1 right before B1 arrives, since no other counter except the one B1 (or Bx) is mapped to may change its value. That is to say, (y−1)/m≦Pr(cj(t−x+1)=z−x+1|et=fx)≦(y+1)/m, and hence (y−1)/m≦p≦(y+1)/m. And with high probability, p=y/m.▪
Then we can rewrite the probability that the t-th packet is the q-th packet of some flow:
Theorem 2.
Pr(et=fq) can be decomposed as Pr(et=fq)≈Σi=0q−1Pr(vt=i)×Yi,q(t), where Yi,q(t) is a fixed polynomial expression of m/y0(t), y1(t)/y0(t), y2(t)/y0(t), . . . , yq−i−1(t)/y0(t).
Proof of Theorem 2:
We prove by induction.
(1) For q=1, since Pr(vt=0, et=f1)=Pr(vt=0), we have




  
    
      Pr
      ⁡
      
        (
        
          
            e
            t
          
          =
          
            f
            1
          
        
        )
      
    
    =
    
      
        
          Pr
          ⁡
          
            (
            
              
                
                  v
                  t
                
                =
                0
              
              ,
              
                
                  e
                  t
                
                =
                
                  f
                  1
                
              
            
            )
          
        
        
          Pr
          ⁡
          
            (
            
              
                v
                t
              
              =
              
                
                  0
                  ❘
                  
                    e
                    t
                  
                
                =
                
                  f
                  1
                
              
            
            )
          
        
      
      =
      
        
          Pr
          ⁡
          
            (
            
              
                v
                t
              
              =
              0
            
            )
          
        
        ×
        
          m
          
            
              y
              0
            
            ⁡
            
              (
              t
              )
            
          
        
      
    
  
  ,




so the theorem holds for q=1.
(2) For q>1, we have,




  
    
      
        
          Pr
          ⁡
          
            (
            
              
                e
                t
              
              =
              
                f
                q
              
            
            )
          
        
        =
        
        ⁢
        
          
            Pr
            ⁡
            
              (
              
                
                  
                    v
                    t
                  
                  =
                  
                    q
                    -
                    1
                  
                
                ,
                
                  
                    e
                    t
                  
                  =
                  
                    f
                    q
                  
                
              
              )
            
          
          
            Pr
            ⁡
            
              (
              
                
                  v
                  t
                
                =
                
                  
                    
                      q
                      -
                      1
                    
                    ❘
                    
                      e
                      t
                    
                  
                  =
                  
                    f
                    q
                  
                
              
              )
            
          
        
      
    
  
  
    
      
        ≈
        
        ⁢
        
          
            
              Pr
              ⁡
              
                (
                
                  
                    v
                    t
                  
                  =
                  
                    q
                    -
                    1
                  
                
                )
              
            
            -
            
              
                ∑
                
                  x
                  =
                  1
                
                
                  q
                  -
                  1
                
              
              ⁢
              
                Pr
                ⁡
                
                  (
                  
                    
                      
                        v
                        t
                      
                      =
                      
                        q
                        -
                        1
                      
                    
                    ,
                    
                      
                        e
                        t
                      
                      =
                      
                        f
                        x
                      
                    
                  
                  )
                
              
            
          
          
            
              
                y
                0
              
              ⁡
              
                (
                t
                )
              
            
            /
            m
          
        
      
    
  
  
    
      
        =
        
        ⁢
        
          
            
              Pr
              ⁡
              
                (
                
                  
                    v
                    t
                  
                  =
                  
                    q
                    -
                    1
                  
                
                )
              
            
            -
            
              
                ∑
                
                  x
                  =
                  1
                
                
                  q
                  -
                  1
                
              
              ⁢
              
                
                  Pr
                  ⁡
                  
                    (
                    
                      
                        v
                        t
                      
                      =
                      
                        
                          
                            q
                            -
                            1
                          
                          ❘
                          
                            c
                            t
                          
                        
                        =
                        
                          f
                          x
                        
                      
                    
                    )
                  
                
                ×
                
                  Pr
                  ⁡
                  
                    (
                    
                      
                        c
                        t
                      
                      =
                      
                        f
                        x
                      
                    
                    )
                  
                
              
            
          
          
            
              
                y
                0
              
              ⁡
              
                (
                t
                )
              
            
            /
            m
          
        
      
    
  
  
    
      
        
          ≈
          
          ⁢
          
            
              
                Pr
                ⁡
                
                  (
                  
                    
                      v
                      t
                    
                    =
                    
                      q
                      -
                      1
                    
                  
                  )
                
              
              ×
              
                m
                
                  
                    y
                    0
                  
                  ⁡
                  
                    (
                    t
                    )
                  
                
              
            
            -
            
              
                ∑
                
                  x
                  =
                  1
                
                
                  q
                  -
                  1
                
              
              ⁢
              
                
                  Pr
                  ⁡
                  
                    (
                    
                      
                        c
                        t
                      
                      =
                      
                        ∫
                        x
                      
                    
                    )
                  
                
                ×
                
                  
                    
                      y
                      
                        q
                        -
                        x
                      
                    
                    ⁡
                    
                      (
                      t
                      )
                    
                  
                  
                    
                      y
                      0
                    
                    ⁡
                    
                      (
                      t
                      )
                    
                  
                
              
            
          
        
        ,
      
    
  




where we approximate Pr(vt=z|et=fx) by yz−x+1(t)/m. By induction, our theorem holds for any q.▪
By applying an expectation to theorem 2, we have
Corollary 1.
E(I(et=fq))≈Σi=0q−1E(I(vt=i)×Yi,q(t).
The exact expressions of Yi,q(t)'s are fixed and can be pre-computed. Particularly, for q=1 and 2, we have




  
    
      E
      ⁡
      
        (
        
          I
          ⁡
          
            (
            
              
                e
                t
              
              =
              
                f
                1
              
            
            )
          
        
        )
      
    
    =
    
      
        E
        ⁡
        
          (
          
            I
            ⁡
            
              (
              
                
                  v
                  t
                
                =
                0
              
              )
            
          
          )
        
      
      ×
      
        m
        /
        
          
            y
            0
          
          ⁡
          
            (
            t
            )
          
        
      
    
  
  ,
  
    

  
  ⁢
  
    
      e
      ⁡
      
        (
        
          I
          ⁡
          
            (
            
              
                e
                t
              
              =
              
                f
                2
              
            
            )
          
        
        )
      
    
    ≈
    
      
        
          E
          ⁡
          
            (
            
              I
              ⁡
              
                (
                
                  
                    v
                    t
                  
                  =
                  1
                
                )
              
            
            )
          
        
        
          
            
              y
              0
            
            ⁡
            
              (
              t
              )
            
          
          /
          m
        
      
      -
      
        
          
            E
            ⁡
            
              (
              
                I
                ⁡
                
                  (
                  
                    
                      v
                      t
                    
                    =
                    0
                  
                  )
                
              
              )
            
          
          
            
              
                y
                0
              
              ⁡
              
                (
                t
                )
              
            
            /
            m
          
        
        ×
        
          
            
              
                y
                1
              
              ⁡
              
                (
                t
                )
              
            
            
              
                y
                0
              
              ⁡
              
                (
                t
                )
              
            
          
          .
        
      
    
  




Now let us use this information to count specific flows. The number of flows with only one packet is:




  
    
      
        
          n
          1
        
        =
        
        ⁢
        
          E
          ⁡
          
            (
            
              n
              1
            
            )
          
        
      
    
  
  
    
      
        =
        
        ⁢
        
          E
          (
          
            
              
                ∑
                t
              
              ⁢
              
                I
                ⁡
                
                  (
                  
                    
                      e
                      t
                    
                    =
                    
                      f
                      1
                    
                  
                  )
                
              
            
            -
            
              
                ∑
                t
              
              ⁢
              
                I
                ⁡
                
                  (
                  
                    
                      e
                      t
                    
                    =
                    
                      f
                      2
                    
                  
                  )
                
              
            
          
          )
        
      
    
  
  
    
      
        =
        
        ⁢
        
          
            
              ∑
              t
            
            ⁢
            
              E
              ⁡
              
                (
                
                  I
                  ⁡
                  
                    (
                    
                      
                        e
                        t
                      
                      =
                      
                        f
                        1
                      
                    
                    )
                  
                
                )
              
            
          
          -
          
            
              ∑
              t
            
            ⁢
            
              E
              ⁡
              
                (
                
                  I
                  ⁡
                  
                    (
                    
                      
                        e
                        t
                      
                      =
                      
                        f
                        2
                      
                    
                    )
                  
                
                )
              
            
          
        
      
    
  
  
    
      
        ≈
        
        ⁢
        
          
            
              ∑
              t
            
            ⁢
            
              (
              
                
                  (
                  
                    
                      
                        
                          y
                          1
                        
                        ⁡
                        
                          (
                          t
                          )
                        
                      
                      
                        
                          y
                          0
                        
                        ⁡
                        
                          (
                          t
                          )
                        
                      
                    
                    +
                    1
                  
                  )
                
                ×
                
                  
                    E
                    ⁡
                    
                      (
                      
                        I
                        ⁡
                        
                          (
                          
                            
                              v
                              t
                            
                            =
                            0
                          
                          )
                        
                      
                      )
                    
                  
                  
                    
                      
                        y
                        0
                      
                      ⁡
                      
                        (
                        t
                        )
                      
                    
                    /
                    m
                  
                
              
              )
            
          
          -
        
      
    
  
  
    
      
        
        ⁢
        
          
            ∑
            t
          
          ⁢
          
            
              E
              ⁡
              
                (
                
                  I
                  ⁡
                  
                    (
                    
                      
                        v
                        t
                      
                      =
                      1
                    
                    )
                  
                
                )
              
            
            
              
                y
                0
              
              ⁢
              
                
              
              ⁢
              
                
                  (
                  t
                  )
                
                /
                m
              
            
          
        
      
    
  
  
    
      
        
          =
          
          ⁢
          
            E
            [
            
              
                
                  ∑
                  
                    
                      t
                      :
                      
                        v
                        t
                      
                    
                    =
                    0
                  
                
                ⁢
                
                  (
                  
                    
                      (
                      
                        
                          
                            
                              y
                              1
                            
                            ⁡
                            
                              (
                              t
                              )
                            
                          
                          
                            
                              y
                              0
                            
                            ⁡
                            
                              (
                              t
                              )
                            
                          
                        
                        +
                        1
                      
                      )
                    
                    ×
                    
                      m
                      
                        
                          y
                          0
                        
                        ⁡
                        
                          (
                          t
                          )
                        
                      
                    
                  
                  )
                
              
              -
              
                
                  ∑
                  
                    
                      t
                      :
                      
                        v
                        t
                      
                    
                    =
                    1
                  
                
                ⁢
                
                  m
                  
                    
                      y
                      0
                    
                    ⁡
                    
                      (
                      t
                      )
                    
                  
                
              
            
            ]
          
        
        ,
      
    
  




Now we have decomposed n1 into the expression of y0(t), y1(t) and v(t), which are all observable: the number of counters with value zero and one, and the value that packet et sees. Due to the unbiasedness of expectation, we have
Conclusion 1.
If the t-th packet sees a counter value of zero, add




  
    (
    
      
        
          
            y
            1
          
          ⁡
          
            (
            t
            )
          
        
        
          
            y
            0
          
          ⁡
          
            (
            t
            )
          
        
      
      +
      1
    
    )
  
  ×
  
    m
    
      
        y
        0
      
      ⁡
      
        (
        t
        )
      
    
  




to the singleton flow count. If it sees a counter value of one, deduct





  m
  
    
      y
      0
    
    ⁡
    
      (
      t
      )
    
  




form the singleton flow count. This procedure gives us an asymptotically unbiased estimator for singleton flow count,





  
    
      n
      ^
    
    1
  
  =
  
    
      
        ∑
        
          
            t
            :
            
              v
              t
            
          
          =
          0
        
      
      ⁢
      
        (
        
          
            (
            
              
                
                  
                    y
                    1
                  
                  ⁡
                  
                    (
                    t
                    )
                  
                
                
                  
                    y
                    0
                  
                  ⁡
                  
                    (
                    t
                    )
                  
                
              
              +
              1
            
            )
          
          ×
          
            m
            
              
                y
                0
              
              ⁡
              
                (
                t
                )
              
            
          
        
        )
      
    
    -
    
      
        ∑
        
          
            t
            :
            
              v
              t
            
          
          =
          1
        
      
      ⁢
      
        
          m
          
            
              y
              0
            
            ⁡
            
              (
              t
              )
            
          
        
        .
      
    
  




And this is exactly the formulas we used in equation 2).

Now for flows with at most q packets, we have




  
    
      
        
          
            ∑
            
              k
              =
              1
            
            q
          
          ⁢
          
            n
            k
          
        
        =
        
        ⁢
        
          E
          (
          
            
              ∑
              
                k
                =
                1
              
              q
            
            ⁢
            
              n
              k
            
          
          )
        
      
    
  
  
    
      
        =
        
        ⁢
        
          E
          (
          
            
              
                ∑
                t
              
              ⁢
              
                I
                ⁡
                
                  (
                  
                    
                      e
                      t
                    
                    =
                    
                      f
                      1
                    
                  
                  )
                
              
            
            -
            
              
                ∑
                t
              
              ⁢
              
                I
                (
                
                  
                    e
                    t
                  
                  =
                  
                    f
                    
                      q
                      +
                      1
                    
                  
                
                ⁢
                
                  
                
                )
              
            
          
          )
        
      
    
  
  
    
      
        =
        
        ⁢
        
          
            
              ∑
              t
            
            ⁢
            
              E
              ⁡
              
                (
                
                  I
                  ⁡
                  
                    (
                    
                      
                        e
                        t
                      
                      =
                      
                        f
                        1
                      
                    
                    )
                  
                
                )
              
            
          
          -
          
            
              ∑
              t
            
            ⁢
            
              
                E
                ⁡
                
                  (
                  
                    I
                    ⁡
                    
                      (
                      
                        
                          e
                          t
                        
                        =
                        
                          f
                          
                            q
                            +
                            1
                          
                        
                      
                      )
                    
                  
                  )
                
              
              .
            
          
        
      
    
  




Using corollary 1, we further get




  
    
      
        
          
            ∑
            
              k
              =
              1
            
            q
          
          ⁢
          
            n
            k
          
        
        =
        
        ⁢
        
          
            ∑
            t
          
          ⁢
          
            
              ∑
              
                i
                =
                0
              
              q
            
            ⁢
            
              (
              
                
                  E
                  ⁡
                  
                    (
                    
                      I
                      ⁡
                      
                        (
                        
                          
                            v
                            t
                          
                          =
                          i
                        
                        )
                      
                    
                    )
                  
                
                ×
                
                  
                    U
                    
                      i
                      ,
                      q
                    
                  
                  ⁡
                  
                    (
                    t
                    )
                  
                
              
              )
            
          
        
      
    
  
  
    
      
        
          =
          
          ⁢
          
            E
            (
            
              
                ∑
                
                  i
                  =
                  0
                
                q
              
              ⁢
              
                
                  ∑
                  
                    
                      t
                      :
                      
                        v
                        t
                      
                    
                    =
                    i
                  
                
                ⁢
                
                  
                    U
                    
                      
                        i
                        ,
                        q
                      
                      ⁢
                      
                        
                      
                    
                  
                  ⁡
                  
                    (
                    t
                    )
                  
                
              
            
            )
          
        
        ,
      
    
  




where Ui,q(t) is also a fixed polynomial expression of m/y0(t), y1(t)/y0(t), y2(t)/y0(t), . . . , yq−i−1(t)/y0(t). Again, we can draw a conclusion on counting small flows:
Conclusion 2.
Asymptotically, n1 ̃q, the number of small flows that having no more than q packets, can be unbiasedly estimated by summing up Ui,q(t)'s for those packets that see a counter value of i(i≦q). That is, {circumflex over (n)}1 ̃q=Σi=0qΣt:vt=iUi,q(t). And this is the formular we used in equation 3).
We note here that, the variance is also a polynomial of m/y0(t) and yi(t)/y0(t)'s. Particularly, when counting singleton flows, the variance is




  
    
      ∑
      
        
          t
          :
          
            e
            t
          
        
        =
        
          f
          1
        
      
    
    ⁢
    
      [
      
        
          
            (
            
              
                
                  (
                  
                    
                      
                        
                          y
                          1
                        
                        ⁡
                        
                          (
                          t
                          )
                        
                      
                      
                        
                          y
                          0
                        
                        ⁡
                        
                          (
                          t
                          )
                        
                      
                    
                    +
                    1
                  
                  )
                
                2
              
              +
              
                
                  
                    y
                    1
                  
                  ⁡
                  
                    (
                    t
                    )
                  
                
                
                  
                    y
                    0
                  
                  ⁡
                  
                    (
                    t
                    )
                  
                
              
            
            )
          
          ×
          
            m
            
              
                y
                0
              
              ⁡
              
                (
                t
                )
              
            
          
        
        -
        1
      
      ]
    
  
  +
  
    
      ∑
      
        
          t
          :
          
            e
            t
          
        
        =
        
          f
          2
        
      
    
    ⁢
    
      
        (
        
          
            m
            
              
                y
                0
              
              ⁡
              
                (
                t
                )
              
            
          
          -
          1
        
        )
      
      .
    
  




So if at least half of the counters are empty, that is y0(t)≧m/2≧yi(t), ∀i≧1, we can derive a loose (but already good enough) bound on the variance. Only ┌ log(q+2)┐ bits are needed for each counter, since we only need to record up to q+1.
The formulas of Yi,q(t) and Ui,q(t) can be deducted from Theorem 2, and are:




  
    
      
        
          
            
              Y
              
                
                  q
                  -
                  1
                
                ,
                q
              
            
            =
            
              m
              
                y
                0
              
            
          
          ,
          
            

          
          ⁢
          
            
              Y
              
                
                  q
                  -
                  2
                
                ,
                q
              
            
            =
            
              
                -
                1
              
              ×
              
                [
                
                  
                    Y
                    
                      
                        q
                        -
                        1
                      
                      ,
                      q
                    
                  
                  ×
                  
                    
                      y
                      1
                    
                    
                      y
                      0
                    
                  
                
                ]
              
            
          
          ,
          
            

          
          ⁢
          
            
              Y
              
                
                  q
                  -
                  3
                
                ,
                q
              
            
            =
            
              
                -
                1
              
              ×
              
                [
                
                  
                    
                      Y
                      
                        
                          q
                          -
                          2
                        
                        ,
                        q
                      
                    
                    ×
                    
                      
                        y
                        1
                      
                      
                        y
                        0
                      
                    
                  
                  +
                  
                    
                      Y
                      
                        
                          q
                          -
                          1
                        
                        ,
                        q
                      
                    
                    ×
                    
                      
                        y
                        2
                      
                      
                        y
                        
                          0
                          ⁢
                          
                            
                          
                        
                      
                    
                  
                
                ]
              
            
          
          ,
          
            

          
          ⁢
          ...
        
        ⁢
        
          

        
        ⁢
        
          
            
              Y
              
                
                  q
                  -
                  i
                
                ,
                q
              
            
            =
            
              
                -
                1
              
              ×
              
                [
                
                  
                    ∑
                    
                      j
                      =
                      1
                    
                    
                      i
                      -
                      1
                    
                  
                  ⁢
                  
                    
                      Y
                      
                        
                          q
                          -
                          
                            (
                            
                              i
                              -
                              j
                            
                            )
                          
                        
                        ,
                        q
                      
                    
                    ×
                    
                      
                        y
                        j
                      
                      
                        y
                        
                          0
                          ⁢
                          
                            
                          
                        
                      
                    
                  
                
                ]
              
            
          
          ,
          
            

          
          ⁢
          ...
        
        ⁢
        
          

        
        ⁢
        
          
            
              Y
              
                0
                ,
                q
              
            
            =
            
              
                
                  -
                  1
                
                ×
                
                  
                    [
                    
                      
                        ∑
                        
                          j
                          =
                          1
                        
                        
                          q
                          -
                          1
                        
                      
                      ⁢
                      
                        
                          Y
                          
                            j
                            ,
                            q
                          
                        
                        ×
                        
                          
                            y
                            j
                          
                          
                            y
                            0
                          
                        
                      
                    
                    ]
                  
                  .
                  
                    

                  
                  ⁢
                  
                    U
                    
                      0
                      ,
                      q
                    
                  
                
              
              =
              
                
                  m
                  /
                  
                    y
                    0
                  
                
                -
                
                  Y
                  
                    0
                    ,
                    
                      q
                      +
                      1
                    
                  
                
              
            
          
          ,
          
            

          
          ⁢
          
            
              U
              
                i
                ,
                q
              
            
            =
            
              -
              
                Y
                
                  i
                  ,
                  
                    q
                    +
                    1
                  
                
              
            
          
          ,
          
            1
            ≤
            i
            ≤
            
              q
              .
            
          
        
      
    
    
      
        8
        )
      
    
  




These will be used in equation 3) in the detecting unit 203.
2. Mathematical Support for Equation 7)
We first analyze a column of counters in the counting units 301. For this mathematical analysis, we still use m to denote the number of counters, while in the specification of the system modules, we use w to denote this number. After this, we will analyze combining three columns of counters.
2.1 A Single Column of Counters
After updating the column of counters with all packets, we use c1, . . . , cm to denote the counter values (while in the specification of the system modules, we use Mx[i] to denote the counter values). We use yk to denote the number of counters with value k. In addition, we use n to represent the total flow count, and use nk to represent the number of flows with exactly k packets.
Now consider a counter c[l] whose value is zero, which means no flow maps into position l. This probability is expected to be




  
    
      (
      
        1
        -
        
          1
          m
        
      
      ⁢
      
        
      
      )
    
    n
  
  ≈
  
    
      e
      
        -
        
          n
          m
        
      
    
    .
  




While the probability of a counter has a value of one is





  
    
      (
      
        
          
            
              n
              1
            
          
        
        
          
            1
          
        
      
      )
    
    ⁢
    
      1
      m
    
    ⁢
    
      
        (
        
          1
          -
          
            1
            m
          
        
        )
      
      
        
          n
          1
        
        -
        1
      
    
    ⁢
    
      (
      
        1
        -
        
          1
          m
        
      
      )
    
    ⁢
    
      ∑
      
        i
        ≥
        
          2
          
            n
            i
          
        
      
    
  
  ≈
  
    
      
        n
        1
      
      m
    
    ⁢
    
      
        e
        
          
            -
            n
          
          /
          m
        
      
      .
    
  




Formally, we have

Lemma 1.
When n and in simultaneously approach infinity (limm→∞n2/m), we have limm→∞E(y0)=me−α, limm→∞E(y1)=n1e−α.
where =limm→∞n/m. Furthermore, y0 and y1 are the MLEs (Maximum Likelihood Estimator) of E(y0) and E(y1) respectively.
Proof of Lemma 1:
We consider the limit distributions of y0 and y1 in two propositions.
Proposition 1.
When n, n1 and m simultaneously tend to infinity, the limit distributions of y0 and y1 both converge to Poisson, with expectations converging to




  
    λ
    0
  
  =
  
    m
    ⁢
    
      
    
    ⁢
    
      e
      
        -
        
          n
          m
        
      
    
  




and





  
    λ
    1
  
  =
  
    
      n
      1
    
    ⁢
    
      e
      
        -
        
          n
          m
        
      
    
  




respectively, if λ0 and λ1 remain bounded, as proved as follows:

It has been proved in the literature that, with n balls, m urns, let pn,m(t) be the probability that exactly t urns are empty, then pn,m(t) converges to Poisson distribution with parameter




  
    λ
    =
    
      m
      ⁢
      
        
      
      ⁢
      
        e
        
          -
          
            n
            m
          
        
      
    
  
  ,




if n and m tend to infinity so that





  λ
  =
  
    m
    ⁢
    
      
    
    ⁢
    
      e
      
        -
        
          n
          m
        
      
    
  




remains bounded. If we have n flows and m counters, the empty counters after seeing all packets will be exactly the same as the empty urns in the urn model, so y0 also converges to Poisson distribution.

We give a proof sketch for the case of y1. Let qn,m(t) be the probability that there are t counters with value 1 after seeing all packets, then the corresponding packets can only be from the n1 singleton flows, and




  
    
      q
      
        n
        ,
        m
      
    
    ⁡
    
      (
      t
      )
    
  
  =
  
    
      
        
          t
          !
        
        ⁢
        
          (
          
            
              
                
                  n
                  1
                
              
            
            
              
                t
              
            
          
          )
        
        ⁢
        
          (
          
            
              
                m
              
            
            
              
                t
              
            
          
          )
        
        ⁢
        
          
            (
            
              m
              -
              t
            
            )
          
          
            n
            -
            t
          
        
        ×
        
          
            q
            
              
                n
                -
                t
              
              ,
              
                m
                -
                t
              
            
          
          ⁡
          
            (
            0
            )
          
        
      
      
        m
        n
      
    
    .
  




Take for abbreviation




  
    
      
        R
        
          n
          ,
          m
        
      
      ⁡
      
        (
        v
        )
      
    
    =
    
      
        
          v
          !
        
        ⁢
        
          (
          
            
              
                
                  n
                  1
                
              
            
            
              
                v
              
            
          
          )
        
        ⁢
        
          (
          
            
              
                m
              
            
            
              
                v
              
            
          
          )
        
        ×
        
          
            (
            
              m
              -
              v
            
            )
          
          
            n
            -
            v
          
        
      
      
        m
        n
      
    
  
  ,




and using the rule of inclusion and exclusion, we can get





  
    
      q
      
        n
        ,
        m
      
    
    ⁡
    
      (
      0
      )
    
  
  =
  
    
      ∑
      
        v
        =
        0
      
      m
    
    ⁢
    
      
        
          (
          
            -
            1
          
          )
        
        v
      
      ⁢
      
        
          
            R
            
              n
              ,
              m
            
          
          ⁡
          
            (
            v
            )
          
        
        .
      
    
  




Since




  
    
      
        
          (
          
            m
            -
            v
          
          )
        
        v
      
      ⁢
      
        
          (
          
            1
            -
            
              v
              m
            
          
          )
        
        n
      
    
    <
    
      
        v
        !
      
      ⁢
      
        (
        
          
            
              m
            
          
          
            
              v
            
          
        
        )
      
      ⁢
      
        
          (
          
            1
            -
            
              v
              m
            
          
          )
        
        n
      
    
    <
    
      
        
          m
          v
        
        ⁡
        
          (
          
            1
            -
            
              v
              m
            
          
          )
        
      
      n
    
  
  ,




and





  
    
      
        (
        
          
            
              n
              1
            
            -
            v
          
          
            m
            -
            v
          
        
        )
      
      v
    
    <
    
      
        
          v
          !
        
        ⁢
        
          (
          
            
              
                
                  n
                  1
                
              
            
            
              
                v
              
            
          
          )
        
      
      
        
          (
          
            m
            -
            v
          
          )
        
        v
      
    
    <
    
      
        (
        
          
            n
            1
          
          
            m
            -
            v
          
        
        )
      
      v
    
  
  ,




multiply these two inequalities, we can get





  
    
      (
      
        
          
            n
            1
          
          -
          v
        
        
          m
          -
          v
        
      
      )
    
    ⁢
    
      
        
          m
          
          v
          
            
            v
        
        ⁡
        
          (
          
            1
            -
            
              v
              m
            
          
          )
        
      
      
        n
        +
        v
      
    
  
  <
  
    
      v
      !
    
    ⁢
    
      
        R
        
          n
          ,
          m
        
      
      ⁡
      
        (
        v
        )
      
    
  
  <
  
    
      (
      
        
          n
          1
        
        
          m
          -
          v
        
      
      )
    
    ⁢
    
      
        
          
            m
            
            v
            
              
              
                v
                ⁢
                
                  
                
              
          
          ⁡
          
            (
            
              1
              -
              
                v
                m
              
            
            )
          
        
        n
      
      .
    
  




And since




  
    t
    <
    
      -
      
        log
        ⁡
        
          (
          
            1
            -
            t
          
          )
        
      
    
    <
    
      t
      
        1
        -
        t
      
    
  
  ,




we have





  
    
      e
      
        -
        
          t
          
            1
            -
            t
          
        
      
    
    <
    
      1
      -
      t
    
    <
    
      e
      
        -
        t
      
    
  
  ,




so





  
    
      (
      
        m
        ⁢
        
          
            
              
            
            ⁢
            
              
                n
                1
              
              -
              v
            
          
          
            m
            -
            v
          
        
        ⁢
        
          e
          
            -
            
              
                n
                +
                v
              
              
                m
                -
                v
              
            
          
        
      
      )
    
    v
  
  =
  
    
      
        
          (
          
            
              
                n
                1
              
              -
              v
            
            
              m
              -
              v
            
          
          )
        
        ⁢
        
          
            
              m
              
              v
              
                
                v
            
            (
            
              e
              
                -
                
                  
                    v
                    /
                    m
                  
                  
                    1
                    -
                    
                      v
                      /
                      m
                    
                  
                
              
            
            )
          
          
            n
            +
            v
          
        
      
      <
      
        

      
      ⁢
      
        
          v
          !
        
        ⁢
        
          
            R
            
              n
              ,
              m
            
          
          ⁡
          
            (
            v
            )
          
        
      
      <
      
        
          (
          
            
              n
              1
            
            
              m
              -
              v
            
          
          )
        
        ⁢
        
          
            
              m
              
              v
              
                
                v
            
            (
            
              e
              
                -
                
                  v
                  m
                
              
            
            )
          
          n
        
      
    
    =
    
      
        
          (
          
            m
            ⁢
            
              
            
            ⁢
            
              
                n
                1
              
              
                m
                -
                v
              
            
            ⁢
            
              e
              
                -
                
                  n
                  m
                
              
            
          
          )
        
        v
      
      .
    
  




For each fixed v, the extreme ratio of the left side and the right side tends to 1, so we have




  
    
      0
      <
      
        
          
            λ
            v
          
          
            v
            !
          
        
        -
        
          
            R
            
              n
              ,
              m
            
          
          ⁡
          
            (
            v
            )
          
        
      
    
    ->
    0
  
  ,




if n and m increase and





  λ
  =
  
    
      n
      1
    
    ⁢
    
      e
      
        -
        
          n
          m
        
      
    
  




is constrained to a finite interval 0<a<λ<b. If λ tends to 0,





  
    0
    ≤
    
      
        
          λ
          v
        
        
          v
          !
        
      
      -
      
        
          R
          
            n
            ,
            m
          
        
        ⁡
        
          (
          v
          )
        
      
    
  
  ->
  0




also holds. So we can get





  
    
      
        R
        
          n
          ,
          m
        
      
      ⁡
      
        (
        v
        )
      
    
    ~
    
      
        λ
        v
      
      
        v
        !
      
    
  
  .




Now





  
    
      e
      
        -
        λ
      
    
    -
    
      
        q
        
          n
          ,
          m
        
      
      ⁡
      
        (
        0
        )
      
    
  
  =
  
    
      ∑
      
        v
        =
        0
      
      ∞
    
    ⁢
    
      
        
          (
          
            -
            1
          
          )
        
        v
      
      ⁢
      
        {
        
          
            
              λ
              v
            
            
              v
              !
            
          
          -
          
            
              R
              
                
                  n
                  ,
                  m
                
                ⁢
                
                  
                
              
            
            ⁡
            
              (
              v
              )
            
          
        
        }
      
    
  




tends to 0, so we have qn,m(0) ̃e−λ, which also implies qn−t,m−t(0) ̃e−λ, and





  
    
      q
      
        n
        ,
        m
      
    
    ⁡
    
      (
      t
      )
    
  
  =
  
    
      
        R
        
          n
          ,
          m
        
      
      ⁡
      
        (
        t
        )
      
    
    ×
    
      
        
          q
          
            
              n
              -
              t
            
            ,
            
              m
              -
              t
            
          
        
        ⁡
        
          (
          0
          )
        
      
      ~
      
        
          λ
          t
        
        
          t
          !
        
      
    
    ⁢
    
      
        e
        
          -
          λ
        
      
      .
    
  




Proposition 2.
When n, n1 and m simultaneously tend to infinity, if




  m
  ⁢
  
    
  
  ⁢
  
    e
    
      -
      
        n
        m
      
    
  
  ⁢
  
    
  
  ⁢
  and
  ⁢
  
    
  
  ⁢
  
    n
    1
  
  ⁢
  
    e
    
      -
      
        n
        m
      
    
  




do not remain bounded, but





  α
  =
  
    
      
        lim
        
          m
          ->
          ∞
        
      
      ⁢
      
        
          n
          m
        
        ⁢
        
          
        
        ⁢
        and
        ⁢
        
          
        
        ⁢
        
          α
          1
        
      
    
    =
    
      
        lim
        
          m
          ->
          ∞
        
      
      ⁢
      
        
          n
          1
        
        m
      
    
  




are bounded, the limit distributions of y0 and y1 converge to normal distribution, with




  
    
      
        
          lim
          
            m
            ->
            ∞
          
        
        ⁢
        
          E
          ⁡
          
            (
            
              y
              0
            
            )
          
        
      
      =
      
        m
        ⁢
        
          
        
        ⁢
        
          e
          
            -
            α
          
        
      
    
    ,
    
      
        
          lim
          
            m
            ->
            ∞
          
        
        ⁢
        
          var
          ⁡
          
            (
            
              y
              0
            
            )
          
        
      
      =
      
        m
        ⁢
        
          
        
        ⁢
        
          
            e
            
              -
              α
            
          
          ⁡
          
            (
            
              1
              -
              
                
                  e
                  
                    -
                    α
                  
                
                ⁡
                
                  (
                  
                    1
                    +
                    α
                  
                  )
                
              
            
            )
          
        
      
    
    ,
    
      

    
    ⁢
    and
  




  
    
      
        
          lim
          
            m
            ->
            ∞
          
        
        ⁢
        
          E
          ⁡
          
            (
            
              y
              1
            
            )
          
        
      
      =
      
        
          n
          1
        
        ⁢
        
          e
          
            -
            α
          
        
      
    
    ,
    
      

    
    ⁢
    
      
        
          lim
          
            m
            ->
            ∞
          
        
        ⁢
        
          var
          ⁡
          
            (
            
              y
              1
            
            )
          
        
      
      =
      
        
          n
          1
        
        ⁢
        
          
            
              e
              
                -
                α
              
            
            ⁡
            
              (
              
                1
                -
                
                  
                    α
                    1
                  
                  ⁢
                  
                    
                      e
                      
                        -
                        α
                      
                    
                    ⁡
                    
                      (
                      
                        
                          -
                          1
                        
                        +
                        
                          1
                          
                            α
                            1
                          
                        
                        +
                        α
                      
                      )
                    
                  
                
              
              )
            
          
          .
        
      
    
  



The case for y0 is again the same as that in the urn model, and the case for y1 can be proved based on the following probability theory which was proved in “H. Geiringer. On the probability theory of arbitrarily linked events. Annals of Mathematical Statistics, 9(4):260-271, 1938.”
Theorem 3.
Let p1, p2, . . . , pm be the probability of m events E1, E2, . . . , Em, pij be the probability of the simultaneous occurrence of Ei and Ej, pijk that of Ei, Ej, Ek and finally p12 . . . m that of E1, E2, . . . , Em. We want to determine the probability Pm(x) that x of the m events will take place. We consider the convergence of




  
    
      
        V
        m
      
      ⁢
      
        
      
      ⁢
      
        (
        x
        )
      
    
    =
    
      
        ∑
        
          t
          ≤
          x
        
      
      ⁢
      
        
          P
          m
        
        ⁡
        
          (
          t
          )
        
      
    
  
  ,




which is the CDF of x. Denoting the mean value of x for Vm(x) by am=Σx−1mxPm(x), and denoting the variance of x for Vm(x) by sm2, let




  
    
      
        S
        m
      
      ⁡
      
        (
        0
        )
      
    
    =
    1
  
  ,
  
    
      
        S
        m
      
      ⁡
      
        (
        1
        )
      
    
    =
    
      
        
          ∑
          i
        
        
          1
          ⁢
          
            
          
          ⁢
          ...
          ⁢
          
            
          
          ⁢
          n
        
      
      ⁢
      
        p
        i
      
    
  
  ,
  
    
      
        S
        n
      
      ⁡
      
        (
        2
        )
      
    
    =
    
      
        
          ∑
          
            i
            ,
            j
          
        
        
          1
          ⁢
          
            
          
          ⁢
          ...
          ⁢
          
            
          
          ⁢
          n
        
      
      ⁢
      
        p
        ij
      
    
  
  ,
  
    

  
  ⁢
  
    
      
        S
        n
      
      ⁡
      
        (
        3
        )
      
    
    =
    
      
        ∑
        
          i
          ,
          j
          ,
          k
        
        
          1
          ⁢
          
            
          
          ⁢
          ...
          ⁢
          
            
          
          ⁢
          n
        
      
      ⁢
      
        p
        ijk
      
    
  
  ,
  
    
      ...
      ⁢
      
        
      
      ⁢
      
        
          S
          m
        
        ⁡
        
          (
          m
          )
        
      
    
    =
    
      
        p
        
          12
          ⁢
          
            
          
          ⁢
          ...
          ⁢
          
            
          
          ⁢
          m
        
      
      .
    
  




If we introduce the following function of the discontinuous variable z=0, 1, 2, . . . , m




  
    
      
        g
        m
      
      ⁢
      
        
      
      ⁢
      
        (
        z
        )
      
    
    =
    
      
        
          z
          +
          1
        
        
          a
          m
        
      
      ⁢
      
        
          
            S
            m
          
          ⁡
          
            (
            
              z
              +
              1
            
            )
          
        
        
          
            S
            m
          
          ⁡
          
            (
            z
            )
          
        
      
    
  
  ,




and put z=amu where u is regarded as a continuous variable in the interval from 0 to ε(ε>0). If hm(u)=gm(z) satisfies the following conditions:
1) If m is sufficiently large, hm(u) admits derivatives of every order in the interval (0, ε).
2) At u=0, the first derivative of hm(u) has a limit, for m→∞, which is different from −1.
3) If u is in the interval (0, ε), the k-th derivatives of hm(u) remains, for every k, inferior to a bound Nk which is independent of m.
Then the asymptotic behavior of Pn(x) converges towards a normal distribution, that is




  
    
      
        lim
        
          n
          ->
          ∞
        
      
      ⁢
      
        
          V
          m
        
        (
        
          
            a
            m
          
          +
          
            
              ys
              m
            
            ⁢
            
              2
            
          
        
        )
      
    
    =
    
      
        1
        
          π
        
      
      ⁢
      
        
          ∫
          
            -
            ∞
          
          y
        
        ⁢
        
          
            e
            
              -
              
                x
                2
              
            
          
          ⁢
          
            d
            x
          
        
      
    
  
  ,
  
    

  
  ⁢
  
    
      and
      ⁢
      
        
      
      ⁢
      
        
          lim
          
            m
            ->
            ∞
          
        
        ⁢
        
          
            s
            m
            2
          
          
            a
            m
          
        
      
    
    =
    
      1
      +
      
        
          
            h
            m
            ′
          
          ⁡
          
            (
            0
            )
          
        
        .
      
    
  




Now following theorem 3, we have




  
    
      
        S
        m
      
      ⁡
      
        (
        z
        )
      
    
    =
    
      
        
          (
          
            
              
                m
              
            
            
              
                z
              
            
          
          )
        
        ⁢
        
          (
          
            
              
                
                  n
                  1
                
              
            
            
              
                z
              
            
          
          )
        
        ⁢
        
          z
          !
        
        ×
        
          
            (
            
              m
              -
              z
            
            )
          
          
            n
            -
            z
          
        
      
      
        m
        n
      
    
  
  ,




and





  
    
      
        
          
            g
            m
          
          ⁡
          
            (
            z
            )
          
        
        =
        
        ⁢
        
          
            
              z
              +
              1
            
            
              a
              m
            
          
          ×
          
            
              
                (
                
                  
                    
                      m
                    
                  
                  
                    
                      
                        z
                        +
                        1
                      
                    
                  
                
                )
              
              ⁢
              
                (
                
                  
                    
                      
                        n
                        1
                      
                    
                  
                  
                    
                      
                        z
                        +
                        1
                      
                    
                  
                
                )
              
              ⁢
              
                
                  (
                  
                    z
                    +
                    1
                  
                  )
                
                !
              
            
            
              
                (
                
                  
                    
                      m
                    
                  
                  
                    
                      z
                    
                  
                
                )
              
              ⁢
              
                (
                
                  
                    
                      
                        n
                        1
                      
                    
                  
                  
                    
                      z
                    
                  
                
                )
              
              ⁢
              
                z
                !
              
            
          
          ×
          
            
              
                (
                
                  m
                  -
                  
                    (
                    
                      z
                      +
                      1
                    
                    )
                  
                
                )
              
              
                n
                -
                
                  (
                  
                    z
                    +
                    1
                  
                  )
                
              
            
            
              
                (
                
                  m
                  -
                  z
                
                )
              
              
                n
                -
                z
              
            
          
        
      
    
  
  
    
      
        =
        
        ⁢
        
          
            
              z
              +
              1
            
            
              
                
                  
                    mn
                    1
                  
                  ⁡
                  
                    (
                    
                      1
                      m
                    
                    )
                  
                
                1
              
              ⁢
              
                
                  (
                  
                    1
                    -
                    
                      1
                      m
                    
                  
                  )
                
                
                  n
                  -
                  1
                
              
            
          
          ×
          
            
              
                (
                
                  
                    
                      m
                    
                  
                  
                    
                      
                        z
                        +
                        1
                      
                    
                  
                
                )
              
              ⁢
              
                (
                
                  
                    
                      
                        n
                        1
                      
                    
                  
                  
                    
                      
                        z
                        +
                        1
                      
                    
                  
                
                )
              
              ⁢
              
                
                  (
                  
                    z
                    +
                    1
                  
                  )
                
                !
              
            
            
              
                (
                
                  
                    
                      m
                    
                  
                  
                    
                      z
                    
                  
                
                )
              
              ⁢
              
                (
                
                  
                    
                      
                        n
                        1
                      
                    
                  
                  
                    
                      z
                    
                  
                
                )
              
              ⁢
              
                z
                !
              
            
          
          ×
        
      
    
  
  
    
      
        
        ⁢
        
          
            
              (
              
                m
                -
                
                  (
                  
                    z
                    +
                    1
                  
                  )
                
              
              )
            
            
              n
              -
              
                (
                
                  z
                  +
                  1
                
                )
              
            
          
          
            
              (
              
                m
                -
                z
              
              )
            
            
              n
              -
              z
            
          
        
      
    
  
  
    
      
        =
        
        ⁢
        
          
            
              m
              -
              z
            
            m
          
          ×
          
            
              
                n
                1
              
              -
              z
            
            
              n
              1
            
          
          ×
          
            
              m
              n
            
            
              
                (
                
                  m
                  -
                  1
                
                )
              
              
                n
                -
                1
              
            
          
          ×
          
            
              
                (
                
                  m
                  -
                  
                    (
                    
                      z
                      +
                      1
                    
                    )
                  
                
                )
              
              
                n
                -
                
                  (
                  
                    z
                    +
                    1
                  
                  )
                
              
            
            
              
                (
                
                  m
                  -
                  z
                
                )
              
              
                n
                -
                z
              
            
          
        
      
    
  
  
    
      
        =
        
        ⁢
        
          
            
              m
              -
              z
            
            m
          
          ×
          
            
              
                n
                1
              
              -
              z
            
            
              n
              1
            
          
          ×
        
      
    
  
  
    
      
        
        ⁢
        
          
            [
            
              
                
                  (
                  
                    
                      1
                      -
                      
                        
                          z
                          +
                          1
                        
                        m
                      
                    
                    
                      
                        (
                        
                          1
                          -
                          
                            z
                            m
                          
                        
                        )
                      
                      ⁢
                      
                        (
                        
                          1
                          -
                          
                            1
                            m
                          
                        
                        )
                      
                    
                  
                  )
                
                ma
              
              ×
              
                
                  
                    (
                    
                      1
                      -
                      
                        1
                        m
                      
                    
                    )
                  
                  ⁢
                  
                    
                      (
                      
                        1
                        -
                        
                          z
                          m
                        
                      
                      )
                    
                    z
                  
                
                
                  
                    (
                    
                      1
                      -
                      
                        
                          z
                          +
                          1
                        
                        m
                      
                    
                    )
                  
                  
                    z
                    +
                    1
                  
                
              
            
            ]
          
          .
        
      
    
  




Plug




  
    α
    1
  
  =
  
    
      n
      1
    
    m
  




into it, alto introduce a new variable





  
    v
    =
    
      
        z
        m
      
      =
      
        u
        ⁢
        
          
            a
            m
          
          m
        
      
    
  
  ,




since am is of the order of magnitude of m, we get





  
    
      
        h
        _
      
      m
    
    ⁡
    
      (
      v
      )
    
  
  =
  
    
      
        g
        m
      
      ⁡
      
        (
        z
        )
      
    
    =
    
      
        (
        
          1
          -
          v
        
        )
      
      ⁢
      
        
          
            α
            1
          
          -
          v
        
        
          α
          1
        
      
      ×
      
        
          [
          
            
              
                (
                
                  
                    1
                    -
                    
                      1
                      
                        m
                        ⁡
                        
                          (
                          
                            1
                            -
                            v
                          
                          )
                        
                      
                    
                  
                  
                    1
                    -
                    
                      1
                      m
                    
                  
                
                )
              
              ma
            
            ×
            
              
                1
                -
                
                  1
                  m
                
              
              
                1
                -
                v
                -
                
                  1
                  m
                
              
            
            ×
            
              
                (
                
                  1
                  -
                  
                    1
                    
                      m
                      ⁡
                      
                        (
                        
                          1
                          -
                          v
                        
                        )
                      
                    
                  
                
                )
              
              
                -
                mv
              
            
          
          ]
        
        .
      
    
  




We can easily see that the condition 1) and 3) in theorem 3 are satisfied (if ε<1) since the k-th derivatives of hm(v) contains only rational expressions of (1−v) and positive powers of




  
    log
    ⁡
    
      (
      
        1
        -
        
          1
          
            m
            ⁡
            
              (
              
                1
                -
                v
              
              )
            
          
        
      
      )
    
  
  ,




and




  
    
      
        
          
            
              lim
              
                m
                →
                ∞
              
            
            ⁢
            
              
                (
                
                  
                    d
                    
                      
                        
                          h
                          _
                        
                        m
                      
                      ⁡
                      
                        (
                        v
                        )
                      
                    
                  
                  
                    d
                    v
                  
                
                )
              
              
                v
                =
                0
              
            
          
          =
          
          ⁢
          
            
              lim
              
                m
                →
                ∞
              
            
            ⁢
            
              {
              
                
                  -
                  1
                
                -
                
                  1
                  
                    α
                    1
                  
                
                +
                
                  [
                  
                    
                      
                        
                          
                            -
                            
                              α
                              
                                1
                                -
                                
                                  1
                                  m
                                
                              
                            
                          
                          +
                          
                            1
                            
                              1
                              -
                              
                                1
                                m
                              
                            
                          
                          -
                        
                      
                    
                    
                      
                        
                          m
                          ⁢
                          
                            
                          
                          ⁢
                          
                            log
                            ⁡
                            
                              (
                              
                                1
                                -
                                
                                  1
                                  m
                                
                              
                              )
                            
                          
                        
                      
                    
                  
                  ]
                
              
              }
            
          
        
      
    
    
      
        
          
            =
            
            ⁢
            
              1
              -
              
                1
                
                  α
                  1
                
              
              -
              α
            
          
          ,
        
      
    
  




  so




  
    
      
        
          
            
              lim
              
                m
                →
                ∞
              
            
            ⁢
            
              
                (
                
                  
                    d
                    
                      
                        h
                        m
                      
                      ⁡
                      
                        (
                        u
                        )
                      
                    
                  
                  
                    d
                    u
                  
                
                )
              
              
                v
                =
                0
              
            
          
          =
          
            
              lim
              
                m
                →
                ∞
              
            
            ⁢
            
              
                
                  (
                  
                    
                      d
                      
                        
                          
                            h
                            _
                          
                          m
                        
                        ⁡
                        
                          (
                          v
                          )
                        
                      
                    
                    
                      d
                      v
                    
                  
                  )
                
                
                  v
                  =
                  0
                
              
              ×
              
                
                  lim
                  
                    m
                    →
                    ∞
                  
                
                ⁢
                
                  
                    a
                    m
                  
                  m
                
              
            
          
        
      
    
    
      
        
          =
          
            
              α
              1
            
            ⁢
            
              
                
                  e
                  
                    -
                    α
                  
                
                ⁡
                
                  (
                  
                    1
                    -
                    
                      1
                      
                        α
                        1
                      
                    
                    -
                    α
                  
                  )
                
              
              .
            
          
        
      
    
  



Let




  
    
      g
      ⁡
      
        (
        
          α
          1
        
        )
      
    
    =
    
      
        α
        1
      
      ⁢
      
        
          e
          
            -
            α
          
        
        ⁡
        
          (
          
            1
            -
            
              1
              
                α
                1
              
            
            -
            α
          
          )
        
      
    
  
  ,




we must prove g(a1)>−1 as stated in condition 2) of theorem 3.

Let f(α)=αe−α(1−1/α−α)=e−α(−α2+α−1), then its derivative f′(α)=e−α(α−1)(α−2), so the local min/max values are obtained at α=0, 1, 2, since α>0, and f′(1)=f′(2)=0. Since f′′(α)=−e−α(α2−5α+5), f′′(1)<0 and f′′(2)>0, the minimum values may be obtained at α=0 or 2. Since f(0)=−1 and f(2)=−3e−2, and α>0, we get f(α)>−1.
Now g(α1)−f(α)=e−α(α−α1)(α−1), since α1≦α, if α≧1, we can get g(α1)≧f(α)>−1. If α<1, that is 0<α1≦α1. Now g(α1)=e−α(1−α)α1−e−α>e−α>−1.
So, we finally get




  
    
      
        lim
        
          m
          →
          ∞
        
      
      ⁢
      
        
          h
          m
          ′
        
        ⁡
        
          (
          0
          )
        
      
    
    =
    
      
        g
        ⁡
        
          (
          
            α
            1
          
          )
        
      
      >
      
        -
        1
      
    
  
  ,




then we can conclude that, y1 converges to normal distribution with





  
    
      lim
      
        m
        →
        ∞
      
    
    ⁢
    
      
        s
        m
        2
      
      
        a
        m
      
    
  
  =
  
    1
    -
    
      
        α
        1
      
      ⁢
      
        
          
            e
            
              -
              α
            
          
          ⁡
          
            (
            
              
                -
                1
              
              +
              
                1
                
                  α
                  1
                
              
              +
              α
            
            )
          
        
        .
      
    
  




With simple manipulation, we get the results stated in proposition 2.

With Proposition 1 and 2, we have proved Lemma 1, since the sample mean is the MLE of the expectation of a Poisson or Normal distribution.▪
Lemma 2.
The number of singleton flows, n1, can be estimated asymptotically unbiased by an MLE {circumflex over (n)}1=m×y1/y0. The variance is approximately n1((eα−2α)α1+eα−1), where α1=limm→∞n1/m.
Proof for Lemma 2:
We prove four propositions step by step.
Proposition 1.
The two variables y0 and y1 are asymptotically independent.
Let us consider such a reordering of the packet arrivals that all flows of size more than one arrive before any singleton flow. Since such a reorder will not change the distribution of counter values, we will get the same probabilities. Assume right before any singleton flow arrives, exactly k counters remain empty. Now only those singleton flows which map into these k counters are able to induce counter value of zero or one, since the other m-k counters have value at least two. Assume n1′ singleton flows map into these k counters, then this is just a classical occupancy problem, where exactly y0 counters have value zero and y1 counters have value one. The coefficient of y0 and y1 in such a classical occupancy problem can almost be neglected when n1/m is not around 1 (following “Random Allocations”, equation (9), pp. 38), and since under most conditions, y1 and y0 are normal and their joint distribution is multivariate normal, they are asymptotically conditional independent for any given k, thus y1 and y0 are asymptotically independent.
Proposition 2.
Asymptotically, {circumflex over (n)}1 is a Maximum Likelihood Estimator (MLE) of n1 From Lemma 1, we know




  
    
      
        lim
        
          m
          →
          ∞
        
      
      ⁢
      
        
          E
          ⁡
          
            (
            
              y
              1
            
            )
          
        
        
          E
          ⁡
          
            (
            
              y
              0
            
            )
          
        
      
    
    =
    
      
        n
        1
      
      m
    
  
  ,




that is





  
    n
    1
  
  =
  
    m
    ×
    
      
        lim
        
          m
          →
          ∞
        
      
      ⁢
      
        
          
            E
            ⁡
            
              (
              
                y
                1
              
              )
            
          
          
            E
            ⁡
            
              (
              
                y
                0
              
              )
            
          
        
        .
      
    
  




Since if {circumflex over (X)}1, {circumflex over (X)}2, . . . , {circumflex over (X)}t are the MLEs of variables X1, X2, . . . , Xt respectively, and if function τ(X1, X2, . . . , Xt) is a transform of the parameter space of (X1, X2, . . . , Xt), then τ({circumflex over (X)}1, {circumflex over (X)}2, . . . , {circumflex over (X)}t) is the MLE of τ(X1, X2, . . . , Xt), and by Lemma 1, y0 and y1 are the MLEs of E(y0) and E(y1) respectively, we get that {circumflex over (n)}1 is the MLE of n1.

Proposition 3.
The estimator {circumflex over (n)}1 asymptotically unbiased.
Expanding f(X) by Taylor series, provided that f is thrice differentiable and that the mean and variance of X are finite, it will have




  
    
      
        
          E
          ⁡
          
            [
            
              f
              ⁡
              
                (
                X
                )
              
            
            ]
          
        
        =
        
        ⁢
        
          E
          [
          
            
              
                
                  
                    f
                    ⁡
                    
                      (
                      
                        E
                        ⁡
                        
                          (
                          X
                          )
                        
                      
                      )
                    
                  
                  +
                  
                    
                      [
                      
                        X
                        -
                        
                          E
                          ⁡
                          
                            (
                            X
                            )
                          
                        
                      
                      ]
                    
                    ⁢
                    
                      f
                      ′
                    
                    ⁢
                    
                      (
                      
                        E
                        ⁡
                        
                          (
                          X
                          )
                        
                      
                      )
                    
                  
                  +
                
              
            
            
              
                
                  
                    
                      
                        
                          [
                          
                            X
                            -
                            
                              E
                              ⁡
                              
                                (
                                X
                                )
                              
                            
                          
                          ]
                        
                        2
                      
                      2
                    
                    ⁢
                    
                      
                        f
                        ′′
                      
                      ⁡
                      
                        (
                        
                          E
                          ⁡
                          
                            (
                            X
                            )
                          
                        
                        )
                      
                    
                  
                  +
                  ...
                
              
            
          
          ]
        
      
    
  
  
    
      
        ≈
        
        ⁢
        
          
            E
            ⁡
            
              [
              
                f
                ⁡
                
                  (
                  
                    E
                    ⁡
                    
                      (
                      X
                      )
                    
                  
                  )
                
              
              ]
            
          
          +
          
            E
            ⁡
            
              [
              
                
                  [
                  
                    X
                    -
                    
                      E
                      ⁡
                      
                        (
                        X
                        )
                      
                    
                  
                  ]
                
                ⁢
                
                  
                    f
                    ′
                  
                  ⁡
                  
                    (
                    
                      E
                      ⁡
                      
                        (
                        X
                        )
                      
                    
                    )
                  
                
              
              ]
            
          
          +
        
      
    
  
  
    
      
        
        ⁢
        
          E
          [
          
            
              
                
                  [
                  
                    X
                    -
                    
                      E
                      ⁡
                      
                        (
                        X
                        )
                      
                    
                  
                  ]
                
                2
              
              2
            
            ⁢
            
              
                f
                ′′
              
              ⁡
              
                (
                
                  E
                  ⁡
                  
                    (
                    X
                    )
                  
                
                )
              
            
          
          ]
        
      
    
  
  
    
      
        =
        
        ⁢
        
          
            f
            ⁡
            
              (
              
                E
                ⁡
                
                  (
                  X
                  )
                
              
              )
            
          
          +
          
            
              
                var
                ⁡
                
                  (
                  X
                  )
                
              
              2
            
            ⁢
            
              
                
                  f
                  ′′
                
                ⁡
                
                  (
                  
                    E
                    ⁡
                    
                      (
                      X
                      )
                    
                  
                  )
                
              
              .
            
          
        
      
    
  




So for




  
    
      f
      ⁡
      
        (
        
          y
          0
        
        )
      
    
    =
    
      1
      
        y
        0
      
    
  
  ,




we have





  
    E
    ⁡
    
      (
      
        1
        
          y
          0
        
      
      )
    
  
  ≈
  
    
      1
      
        E
        ⁡
        
          (
          
            y
            0
          
          )
        
      
    
    +
    
      
        
          var
          ⁡
          
            (
            
              y
              0
            
            )
          
        
        
          
            E
            3
          
          ⁡
          
            (
            
              y
              0
            
            )
          
        
      
      .
    
  




Since y0 and y1 are two independent random variables, we have





  
    
      
        
          E
          ⁡
          
            (
            
              
                n
                ^
              
              1
            
            )
          
        
        =
        
        ⁢
        
          m
          ×
          
            E
            ⁡
            
              (
              
                y
                1
              
              )
            
          
          ×
          
            E
            ⁡
            
              (
              
                1
                
                  y
                  0
                
              
              )
            
          
        
      
    
  
  
    
      
        ≈
        
        ⁢
        
          m
          ×
          
            E
            ⁡
            
              (
              
                y
                1
              
              )
            
          
          ×
          
            (
            
              
                1
                
                  E
                  ⁡
                  
                    (
                    
                      y
                      0
                    
                    )
                  
                
              
              +
              
                
                  var
                  ⁡
                  
                    (
                    
                      y
                      0
                    
                    )
                  
                
                
                  
                    E
                    3
                  
                  ⁡
                  
                    (
                    
                      y
                      0
                    
                    )
                  
                
              
            
            )
          
        
      
    
  
  
    
      
        =
        
        ⁢
        
          m
          ×
          
            n
            1
          
          ⁢
          
            e
            
              -
              α
            
          
          ×
          
            (
            
              
                1
                
                  m
                  ⁢
                  
                    
                  
                  ⁢
                  
                    e
                    
                      -
                      α
                    
                  
                
              
              +
              
                
                  m
                  ⁢
                  
                    
                  
                  ⁢
                  
                    
                      e
                      
                        -
                        α
                      
                    
                    ⁡
                    
                      (
                      
                        1
                        -
                        
                          
                            e
                            
                              -
                              α
                            
                          
                          ⁡
                          
                            (
                            
                              1
                              +
                              α
                            
                            )
                          
                        
                      
                      )
                    
                  
                
                
                  
                    (
                    
                      m
                      ⁢
                      
                        
                      
                      ⁢
                      
                        e
                        
                          -
                          α
                        
                      
                    
                    )
                  
                  3
                
              
            
            )
          
        
      
    
  
  
    
      
        =
        
        ⁢
        
          
            n
            1
          
          ⁡
          
            (
            
              1
              +
              
                
                  (
                  
                    1
                    -
                    
                      
                        e
                        
                          -
                          α
                        
                      
                      ⁡
                      
                        (
                        
                          1
                          +
                          α
                        
                        )
                      
                    
                  
                  )
                
                
                  m
                  ⁢
                  
                    
                  
                  ⁢
                  
                    e
                    
                      -
                      α
                    
                  
                
              
            
            )
          
        
      
    
  
  
    
      
        =
        
        ⁢
        
          
            n
            1
          
          +
          
            
              
                
                  n
                  1
                
                ⁡
                
                  (
                  
                    1
                    -
                    
                      
                        e
                        
                          -
                          α
                        
                      
                      ⁡
                      
                        (
                        
                          1
                          +
                          α
                        
                        )
                      
                    
                  
                  )
                
              
              
                m
                ⁢
                
                  
                
                ⁢
                
                  e
                  
                    -
                    α
                  
                
              
            
            .
          
        
      
    
  




Since




  
    
      
        lim
        
          m
          →
          ∞
        
      
      ⁢
      
        bias
        (
        
          
            
              n
              ^
            
            1
          
          
            n
            1
          
        
        )
      
    
    =
    
      
        
          lim
          
            m
            →
            ∞
          
        
        ⁢
        
          
            
              e
              α
            
            -
            
              (
              
                1
                +
                α
              
              )
            
          
          m
        
      
      =
      0
    
  
  ,




{circumflex over (n)}1 is asymptotically unbiased.

Proposition 4.
Asymptotically,




  
    var
    ⁡
    
      (
      
        
          n
          ^
        
        1
      
      )
    
  
  ≈
  
    
      
        (
        
          
            e
            α
          
          -
          
            2
            ⁢
            α
          
        
        )
      
      ⁢
      
        
          n
          1
          2
        
        m
      
    
    +
    
      
        (
        
          
            e
            α
          
          -
          1
        
        )
      
      ⁢
      
        
          n
          1
        
        .
      
    
  




Similarly, using Taylor expansion,



  
    
      
        
          var
          ⁡
          
            [
            
              f
              ⁡
              
                (
                X
                )
              
            
            ]
          
        
        =
        
          
            var
            [
            
              
                f
                ⁡
                
                  (
                  
                    E
                    ⁡
                    
                      (
                      X
                      )
                    
                  
                  )
                
              
              +
              
                
                  [
                  
                    X
                    -
                    
                      E
                      ⁡
                      
                        (
                        X
                        )
                      
                    
                  
                  ]
                
                ⁢
                
                  
                    f
                    ′
                  
                  ⁡
                  
                    (
                    
                      E
                      ⁡
                      
                        (
                        X
                        )
                      
                    
                    )
                  
                
              
            
            )
          
          +
          ...
        
      
      ⁢
      
        
      
      ]
    
    ≈
    
      
        
          [
          
            
              f
              ′
            
            ⁡
            
              (
              
                E
                ⁡
                
                  (
                  X
                  )
                
              
              )
            
          
          ]
        
        2
      
      ⁢
      
        
          var
          ⁡
          
            (
            X
            )
          
        
        .
        
          

        
        ⁢
        
          
        
        ⁢
        so
      
    
  




  
    
      
    
    ⁢
    
      
        
          var
          (
          
            1
            
              y
              0
            
          
          )
        
        ≈
        
          
            
              [
              
                -
                
                  1
                  
                    
                      E
                      2
                    
                    ⁡
                    
                      (
                      
                        y
                        0
                      
                      )
                    
                  
                
              
              ]
            
            2
          
          ⁢
          
            var
            ⁡
            
              (
              
                y
                0
              
              )
            
          
        
      
      =
      
        
          
            var
            ⁡
            
              (
              
                y
                0
              
              )
            
          
          
            
              E
              4
            
            ⁡
            
              (
              
                y
                0
              
              )
            
          
        
        .
      
    
  



For independent random variables A and B, it will have



  
    
      
        var
        ⁡
        
          (
          AB
          )
        
      
      =
      
        
          
            var
            ⁡
            
              (
              A
              )
            
          
          ⁢
          
            
              E
              2
            
            ⁡
            
              (
              B
              )
            
          
        
        +
        
          
            var
            ⁡
            
              (
              B
              )
            
          
          ⁢
          
            
              E
              2
            
            ⁡
            
              (
              A
              )
            
          
        
        +
        
          
            var
            ⁡
            
              (
              A
              )
            
          
          ⁢
          
            var
            ⁡
            
              (
              B
              )
            
          
        
      
    
    ,
    
      

    
    ⁢
    
      so
      ⁢
      
        
      
      ⁢
      we
      ⁢
      
        
      
      ⁢
      have
    
  




  
    
      
        
          
            var
            ⁡
            
              (
              
                
                  y
                  1
                
                
                  y
                  0
                
              
              )
            
          
          =
          
          ⁢
          
            
              
                var
                ⁡
                
                  (
                  
                    y
                    1
                  
                  )
                
              
              ⁢
              
                
                  E
                  2
                
                ⁡
                
                  (
                  
                    1
                    
                      y
                      0
                    
                  
                  )
                
              
            
            +
            
              
                var
                ⁡
                
                  (
                  
                    1
                    
                      y
                      0
                    
                  
                  )
                
              
              ⁢
              
                
                  E
                  2
                
                ⁡
                
                  (
                  
                    y
                    1
                  
                  )
                
              
            
            +
            
              
                var
                ⁡
                
                  (
                  
                    y
                    1
                  
                  )
                
              
              ⁢
              
                var
                ⁡
                
                  (
                  
                    1
                    
                      y
                      0
                    
                  
                  )
                
              
            
          
        
      
    
    
      
        
          ≈
          
          ⁢
          
            
              
                
                  var
                  ⁡
                  
                    (
                    
                      y
                      1
                    
                    )
                  
                
                ⁡
                
                  [
                  
                    
                      1
                      
                        E
                        ⁡
                        
                          (
                          
                            y
                            0
                          
                          )
                        
                      
                    
                    +
                    
                      
                        var
                        ⁡
                        
                          (
                          
                            y
                            0
                          
                          )
                        
                      
                      
                        
                          E
                          3
                        
                        ⁡
                        
                          (
                          
                            y
                            0
                          
                          )
                        
                      
                    
                  
                  ]
                
              
              2
            
            +
          
        
      
    
    
      
        
          
          ⁢
          
            
              
                
                  var
                  ⁡
                  
                    (
                    
                      y
                      0
                    
                    )
                  
                
                
                  
                    E
                    4
                  
                  ⁡
                  
                    (
                    
                      y
                      0
                    
                    )
                  
                
              
              ⁢
              
                
                  E
                  2
                
                ⁡
                
                  (
                  
                    y
                    1
                  
                  )
                
              
            
            +
            
              
                var
                ⁡
                
                  (
                  
                    y
                    1
                  
                  )
                
              
              ⁢
              
                
                  var
                  ⁡
                  
                    (
                    
                      y
                      0
                    
                    )
                  
                
                
                  
                    E
                    4
                  
                  ⁡
                  
                    (
                    
                      y
                      0
                    
                    )
                  
                
              
            
          
        
      
    
    
      
        
          =
          
          ⁢
          
            
              
                
                  var
                  ⁡
                  
                    (
                    
                      y
                      1
                    
                    )
                  
                
                
                  
                    E
                    2
                  
                  ⁡
                  
                    (
                    
                      y
                      0
                    
                    )
                  
                
              
              ⁡
              
                [
                
                  1
                  +
                  
                    3
                    ⁢
                    
                      
                    
                    ⁢
                    
                      
                        var
                        ⁡
                        
                          (
                          
                            y
                            0
                          
                          )
                        
                      
                      
                        
                          E
                          2
                        
                        ⁡
                        
                          (
                          
                            y
                            0
                          
                          )
                        
                      
                    
                  
                  +
                  
                    
                      (
                      
                        
                          var
                          ⁡
                          
                            (
                            
                              y
                              0
                            
                            )
                          
                        
                        
                          
                            E
                            2
                          
                          ⁡
                          
                            (
                            
                              y
                              0
                            
                            )
                          
                        
                      
                      )
                    
                    2
                  
                
                ]
              
            
            +
          
        
      
    
    
      
        
          
          ⁢
          
            
              
                var
                ⁡
                
                  (
                  
                    y
                    0
                  
                  )
                
              
              
                
                  E
                  2
                
                ⁡
                
                  (
                  
                    y
                    0
                  
                  )
                
              
            
            ⁢
            
              
                
                  
                    E
                    2
                  
                  ⁡
                  
                    (
                    
                      y
                      1
                    
                    )
                  
                
                
                  
                    E
                    2
                  
                  ⁡
                  
                    (
                    
                      y
                      0
                    
                    )
                  
                
              
              .
            
          
        
      
    
  



Denoting by




  
    M
    =
    
      
        
          var
          ⁡
          
            (
            
              y
              0
            
            )
          
        
        
          
            E
            2
          
          ⁡
          
            (
            
              y
              0
            
            )
          
        
      
      =
      
        
          
            
              e
              α
            
            -
            1
            -
            α
          
          m
        
        ~
        
          O
          ⁡
          
            (
            
              1
              m
            
            )
          
        
      
    
  
  ,




we have





  
    
      
        
          
            
              
                var
                ⁡
                
                  (
                  
                    
                      y
                      1
                    
                    
                      y
                      0
                    
                  
                  )
                
              
              ≈
              
              ⁢
              
                
                  
                    
                      var
                      ⁡
                      
                        (
                        
                          y
                          1
                        
                        )
                      
                    
                    
                      var
                      ⁡
                      
                        (
                        
                          y
                          0
                        
                        )
                      
                    
                  
                  ⁢
                  
                    M
                    ⁡
                    
                      (
                      
                        1
                        +
                        
                          3
                          ⁢
                          M
                        
                        +
                        
                          M
                          2
                        
                      
                      )
                    
                  
                
                +
                
                  
                    
                      
                        E
                        2
                      
                      ⁡
                      
                        (
                        
                          y
                          1
                        
                        )
                      
                    
                    
                      
                        E
                        2
                      
                      ⁡
                      
                        (
                        
                          y
                          0
                        
                        )
                      
                    
                  
                  ⁢
                  M
                
              
            
          
        
        
          
            
              
                ≈
                
                ⁢
                
                  
                    [
                    
                      
                        
                          var
                          ⁡
                          
                            (
                            
                              y
                              1
                            
                            )
                          
                        
                        
                          var
                          ⁡
                          
                            (
                            
                              y
                              0
                            
                            )
                          
                        
                      
                      +
                      
                        
                          
                            E
                            2
                          
                          ⁡
                          
                            (
                            
                              y
                              1
                            
                            )
                          
                        
                        
                          
                            E
                            2
                          
                          ⁡
                          
                            (
                            
                              y
                              0
                            
                            )
                          
                        
                      
                    
                    ]
                  
                  ×
                  M
                
              
              ,
            
          
        
        
          
            
              
                var
                ⁡
                
                  (
                  
                    
                      n
                      ^
                    
                    1
                  
                  )
                
              
              =
              
              ⁢
              
                
                  m
                  2
                
                ×
                
                  var
                  ⁡
                  
                    (
                    
                      
                        y
                        1
                      
                      
                        y
                        0
                      
                    
                    )
                  
                
              
            
          
        
        
          
            
              ≈
              
              ⁢
              
                
                  m
                  2
                
                ×
                
                  [
                  
                    
                      
                        var
                        ⁡
                        
                          (
                          
                            y
                            1
                          
                          )
                        
                      
                      
                        var
                        ⁡
                        
                          (
                          
                            y
                            0
                          
                          )
                        
                      
                    
                    +
                    
                      
                        
                          E
                          2
                        
                        ⁡
                        
                          (
                          
                            y
                            1
                          
                          )
                        
                      
                      
                        
                          E
                          2
                        
                        ⁡
                        
                          (
                          
                            y
                            0
                          
                          )
                        
                      
                    
                  
                  ]
                
                ×
                
                  
                    
                      e
                      α
                    
                    -
                    1
                    -
                    α
                  
                  m
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  m
                  ⁡
                  
                    (
                    
                      
                        e
                        α
                      
                      -
                      1
                      -
                      α
                    
                    )
                  
                
                ×
                
                  [
                  
                    
                      
                        α
                        1
                      
                      ⁡
                      
                        (
                        
                          1
                          +
                          
                            
                              
                                α
                                1
                              
                              -
                              
                                
                                  α
                                  1
                                
                                ⁢
                                α
                              
                              +
                              α
                            
                            
                              
                                e
                                α
                              
                              -
                              1
                              -
                              α
                            
                          
                        
                        )
                      
                    
                    +
                    
                      α
                      1
                      2
                    
                  
                  ]
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                m
                ×
                
                  [
                  
                    
                      
                        (
                        
                          
                            e
                            α
                          
                          -
                          
                            2
                            ⁢
                            α
                          
                        
                        )
                      
                      ⁢
                      
                        α
                        1
                        2
                      
                    
                    +
                    
                      
                        (
                        
                          
                            e
                            α
                          
                          -
                          1
                        
                        )
                      
                      ⁢
                      
                        α
                        1
                      
                    
                  
                  ]
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  
                    (
                    
                      
                        e
                        α
                      
                      -
                      
                        2
                        ⁢
                        α
                      
                    
                    )
                  
                  ⁢
                  
                    
                      n
                      1
                      2
                    
                    m
                  
                
                +
                
                  
                    (
                    
                      
                        e
                        α
                      
                      -
                      1
                    
                    )
                  
                  ⁢
                  
                    
                      n
                      1
                    
                    .
                  
                
              
            
          
        
      
    
    
      
        
      
    
  




So, if n1 is very small, the variance is also small, and if n1 is large, the relative standard error is




  
    
      stderr
      ⁡
      
        (
        
          
            n
            ^
          
          1
        
        )
      
    
    =
    
      
        
          var
          (
          
            
              
                n
                ^
              
              1
            
            
              n
              1
            
          
          )
        
      
      ≈
      
        
          
            
              
                e
                α
              
              -
              
                2
                ⁢
                α
              
            
            m
          
          +
          
            
              
                e
                α
              
              -
              1
            
            
              n
              1
            
          
        
      
    
  
  ,




and this ensures that it is a good estimator for super scanners with a large n1 if we keep m large enough, and we use it as a cardinality sketch in our estimating module.▪

Lemma 3.
For estimating the number of small flows, we can use the following iterative equation to estimate n1, n2, . . . , nq step by step:




  
    
      
        
          
            n
            ^
          
          q
        
        =
        
          m
          ×
          
            (
            
              
                
                  y
                  q
                
                
                  y
                  0
                
              
              -
              
                
                  ∑
                  
                    i
                    =
                    1
                  
                  
                    
                      
                      
                        B
                        q
                      
                      
                    
                    -
                    1
                  
                
                ⁢
                
                  (
                  
                    
                      ∏
                      
                        d
                        =
                        1
                      
                      
                        q
                        -
                        1
                      
                    
                    ⁢
                    
                      
                    
                    ⁢
                    
                      
                        
                          (
                          
                            
                              
                                n
                                ^
                              
                              d
                            
                            /
                            m
                          
                          )
                        
                        
                          β
                          
                            i
                            ⁡
                            
                              (
                              d
                              )
                            
                          
                        
                      
                      
                        
                          β
                          
                            i
                            ⁡
                            
                              (
                              d
                              )
                            
                          
                        
                        !
                      
                    
                  
                  )
                
              
            
            )
          
        
      
    
    
      
        9
        )
      
    
  




Proof for Lemma 3:
Use q to denote the set of different flow set patterns that have exactly q packets, and use βi (1≦i≦q|) to denote a specific flow set pattern in q, so there are totally q packets in βi, and a counter with a value of q will correspond to some βi. Suppose βi is composed of βi(1) flows of size one, βi(2) flows of size two, . . . , βi(q) flows of size q, and no flow of size more than q, we can write

βi=<βi(1),βi(2), . . . ,βi(q),0, . . . >

and order them: β1=<q, 0, . . . , 0, 0, . . . > corresponding to q flows of size one, β2=<q−2, 1, 0, . . . , 0, 0, . . . > corresponding to q−2 flows of size one and one flow of size two, and β|βq|=<0, 0, . . . , 1, 0, . . . > (the q-th element is 1) corresponding to one flow of size q. Denoting the number of counters with value x by yx, and the number of flows of size x by nx, when m is large, we have




  
    
      E
      ⁡
      
        (
        
          
            y
            q
          
          m
        
        )
      
    
    =
    
      
        ∑
        
          i
          =
          1
        
        
          
          
            B
            q
          
          
        
      
      ⁢
      
        Pr
        ⁡
        
          (
          
            β
            i
          
          )
        
      
    
  
  ,




where Pr(βi), the probability that the flow pattern βi appears, is





  
    ∏
    
      d
      =
      1
    
    q
  
  ⁢
  
    
  
  ⁢
  
    
      
        
          C
          
            n
            d
          
          
            β
            
              i
              ⁡
              
                (
                d
                )
              
            
          
        
        (
        
          1
          m
        
        )
      
      
        β
        
          i
          ⁡
          
            (
            d
            )
          
        
      
    
    ⁢
    
      
        (
        
          1
          -
          
            1
            m
          
        
        )
      
      
        
          n
          d
        
        -
        
          β
          
            i
            ⁡
            
              (
              d
              )
            
          
        
      
    
    ⁢
    
      
        ∏
        
          d
          >
          q
        
        
          
        
      
      ⁢
      
        
      
      ⁢
      
        
          
            (
            
              1
              -
              
                1
                m
              
            
            )
          
          
            n
            d
          
        
        .
      
    
  




Then by simple manipulation, we get




  
    
      
        E
        ⁡
        
          (
          
            y
            q
          
          )
        
      
      m
    
    ≈
    
      
        
          E
          ⁡
          
            (
            
              y
              0
            
            )
          
        
        m
      
      [
      
        
          
            ∑
            
              i
              =
              1
            
            
              
                
                
                  B
                  q
                
                
              
              -
              1
            
          
          ⁢
          
            (
            
              
                ∏
                
                  d
                  =
                  1
                
                
                  q
                  -
                  1
                
              
              ⁢
              
                
              
              ⁢
              
                
                  
                    (
                    
                      
                        n
                        d
                      
                      /
                      m
                    
                    )
                  
                  
                    β
                    
                      i
                      ⁡
                      
                        (
                        d
                        )
                      
                    
                  
                
                
                  
                    β
                    
                      i
                      ⁡
                      
                        (
                        d
                        )
                      
                    
                  
                  !
                
              
            
            )
          
        
        +
        
          
            n
            q
          
          m
        
      
      ]
    
  
  ,




so





  
    
      n
      q
    
    ≈
    
      m
      ×
      
        (
        
          
            
              E
              ⁡
              
                (
                
                  y
                  q
                
                )
              
            
            
              E
              ⁡
              
                (
                
                  y
                  0
                
                )
              
            
          
          -
          
            
              ∑
              
                i
                =
                1
              
              
                
                  
                  
                    B
                    q
                  
                  
                
                -
                1
              
            
            ⁢
            
              (
              
                
                  ∏
                  
                    d
                    =
                    1
                  
                  
                    q
                    -
                    1
                  
                
                ⁢
                
                  
                
                ⁢
                
                  
                    
                      (
                      
                        
                          n
                          d
                        
                        /
                        m
                      
                      )
                    
                    
                      β
                      
                        i
                        ⁡
                        
                          (
                          d
                          )
                        
                      
                    
                  
                  
                    
                      β
                      
                        i
                        ⁡
                        
                          (
                          d
                          )
                        
                      
                    
                    !
                  
                
              
              )
            
          
        
        )
      
    
  
  ,




where q can be pre-computed.▪

2.2 Combining Three Columns of Counters
When considering the estimating unit 305, we use three columns of counters. Each column, by the above mathematical analysis, can be used to estimate the total small flow count of all hosts that are mapped to that column. Now we deal with how to combine them to estimate the small flow count of the host that is mapped to exactly the three columns.
Let us denote the three sketches by M1, M2 and M3, and denote the corresponding flows mapped to them by S1, S2 and S3. We denote by |Mi|k the number of flows with k packets estimated from Mi, which is an estimate on |Si|k, the exact number of flows with k packets in Si, and we abuse k=0 for total flows. So we can compute an estimation for |Si|k as =|Mi|k using equation 9) above. The idea of combining three columns is that, although more than one host can be mapped to each column, there is only a very small probability that more than one host can be simultaneously mapped to the same three columns. So we can just use |S1∩S2∩S3|k as the number of flows with k packets of the host mapped to the three columns.
Now we discuss operations among three sets (S1, S2, S3) and the corresponding columns (M1, M2, M3). The ancillary notations are: Sii=Si−Sj−Sk, Sij=(Si∩Sj)−Sl, and S=Si∩Sj∩Sl, where i, j, l is a permutation of 1, 2, 3, as shown in FIG. 12. We also denote by Mi+Mj (Mi+Mj+Ml) the counter-wise addition, such that (Mi+Mj)[i]=Mi[i]+Mj[i] ((Mi+Mj+Ml[i]=Mi[i]+Mj[i]++Ml[i]), for 1≦i≦m. We also call such a column of counters as a “sketch”. Note that when two sketches are added up, some packets are counted twice, and when three sketches are added up, some packets are counted twice, and some packets are counted thrice.
Case 1: For k=0, we have




  
    
      
        
        
          M
          i
        
        
      
      0
    
    =
    
      
        
          
          
            S
            i
          
          
        
        0
      
      ^
    
  
  ,
  
    

  
  ⁢
  
    
      
        
        
          
            M
            i
          
          +
          
            M
            j
          
        
        
      
      0
    
    =
    
      
        
        
          
            
              S
              i
            
            ⋃
            
              S
              j
            
          
          ^
        
        
      
      0
    
  
  ,
  
    

  
  ⁢
  
    
      
        
        
          
            M
            i
          
          +
          
            M
            j
          
          +
          
            M
            l
          
        
        
      
      k
    
    =
    
      
        
        
          
            S
            i
          
          ⋃
          
            
              S
              j
            
            ^
          
          ⋃
          
            S
            l
          
        
        
      
      0
    
  
  ,




so we get




  
    
      
        
          
            
              
                
                  
                    
                    S
                    
                  
                  0
                
                ^
              
              =
              
              ⁢
              
                
                  
                    
                      
                      
                        S
                        1
                      
                      
                    
                    0
                  
                  ^
                
                +
                
                  
                    
                      
                      
                        S
                        2
                      
                      
                    
                    0
                  
                  ^
                
                +
                
                  
                    
                      
                      
                        S
                        3
                      
                      
                    
                    0
                  
                  ^
                
                -
              
            
          
        
        
          
            
              
              ⁢
              
                
                  
                    
                      
                      
                        
                          S
                          1
                        
                        ⋃
                        
                          S
                          2
                        
                      
                      
                    
                    0
                  
                  ^
                
                -
                
                  
                    
                      
                      
                        
                          S
                          2
                        
                        ⋃
                        
                          S
                          3
                        
                      
                      
                    
                    0
                  
                  ^
                
                -
                
                  
                    
                      
                      
                        
                          S
                          1
                        
                        ⋃
                        
                          S
                          3
                        
                      
                      
                    
                    0
                  
                  ^
                
                +
              
            
          
        
        
          
            
              
              ⁢
              
                
                  
                    
                    
                      
                        S
                        1
                      
                      ⋃
                      
                        S
                        2
                      
                      ⋃
                      
                        S
                        3
                      
                    
                    
                  
                  0
                
                ^
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  
                    
                    
                      M
                      1
                    
                    
                  
                  0
                
                +
                
                  
                    
                    
                      M
                      2
                    
                    
                  
                  0
                
                +
                
                  
                    
                    
                      M
                      3
                    
                    
                  
                  0
                
                -
              
            
          
        
        
          
            
              
              ⁢
              
                
                  
                    
                    
                      
                        M
                        1
                      
                      +
                      
                        M
                        2
                      
                    
                    
                  
                  0
                
                -
                
                  
                    
                    
                      
                        M
                        2
                      
                      +
                      
                        M
                        3
                      
                    
                    
                  
                  0
                
                -
                
                  
                    
                    
                      
                        M
                        1
                      
                      +
                      
                        M
                        3
                      
                    
                    
                  
                  0
                
                +
              
            
          
        
        
          
            
              
              ⁢
              
                
                  
                    
                    
                      
                        M
                        1
                      
                      +
                      
                        M
                        2
                      
                      +
                      
                        M
                        3
                      
                    
                    
                  
                  0
                
                .
              
            
          
        
      
    
    
      
        10
        )
      
    
  




Case 2: For flow size of k=6x+1 or k=6x+5, we have




  
    
      
        
        
          M
          i
        
        
      
      k
    
    =
    
      
        
          
            
            
              S
              ii
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              ij
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              ik
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            S
            
          
          k
        
        ^
      
    
  
  ,
  
    

  
  ⁢
  
    
      
        
        
          
            M
            i
          
          +
          
            M
            j
          
        
        
      
      k
    
    =
    
      
        
          
            
            
              S
              ii
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              jj
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              il
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              jl
            
            
          
          k
        
        ^
      
    
  
  ,
  
    

  
  ⁢
  
    
      
        
        
          
            M
            i
          
          +
          
            M
            j
          
          +
          
            M
            l
          
        
        
      
      k
    
    =
    
      
        
          
            
            
              S
              ii
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              jj
            
            
          
          k
        
        ^
      
      +
      
        
          
            
              
              
                S
                ll
              
              
            
            k
          
          ^
        
        .
      
    
  




so we get




  
    
      
        
          
            
              
              S
              
            
            k
          
          ^
        
        =
        
          
            (
            
              
                
                  
                  
                    M
                    1
                  
                  
                
                k
              
              +
              
                
                  
                  
                    M
                    2
                  
                  
                
                k
              
              +
              
                
                  
                  
                    M
                    3
                  
                  
                
                k
              
              -
              
                
                  
                  
                    
                      M
                      1
                    
                    +
                    
                      M
                      2
                    
                  
                  
                
                k
              
              -
              
                
                  
                  
                    
                      M
                      2
                    
                    +
                    
                      M
                      3
                    
                  
                  
                
                k
              
              -
              
                
                  
                  
                    
                      M
                      1
                    
                    +
                    
                      M
                      3
                    
                  
                  
                
                k
              
              +
              
                
                  
                  
                    
                      M
                      1
                    
                    +
                    
                      M
                      2
                    
                    +
                    
                      M
                      3
                    
                  
                  
                
                k
              
            
            )
          
          ×
          
            
              1
              3
            
            .
          
        
      
    
    
      
        11
        )
      
    
  




Case 3: For flow size of k=6x+2 or k=6x+4, we have




  
    
      
        
        
          M
          i
        
        
      
      k
    
    =
    
      
        
          
            
            
              S
              ii
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              ij
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              il
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            S
            
          
          k
        
        ^
      
    
  
  ,
  
    

  
  ⁢
  
    
      
        
        
          
            M
            i
          
          +
          
            M
            j
          
        
        
      
      k
    
    =
    
      
        
          
            
            
              S
              ii
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              jj
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              il
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              jl
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              ij
            
            
          
          
            k
            /
            2
          
        
        ^
      
      +
      
        
          
            
            S
            
          
          
            k
            /
            2
          
        
        ^
      
    
  
  ,
  
    

  
  ⁢
  
    
      
        
        
          
            M
            i
          
          +
          
            M
            j
          
          +
          
            M
            l
          
        
        
      
      k
    
    =
    
      
        
          
            
            
              S
              ii
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              jj
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              ll
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              ij
            
            
          
          
            k
            /
            2
          
        
        ^
      
      +
      
        
          
            
            
              S
              il
            
            
          
          
            k
            /
            2
          
        
        ^
      
      +
      
        
          
            
            
              S
              jl
            
            
          
          
            k
            /
            2
          
        
        ^
      
    
  
  ,




so we have




  
    
      
        
          
            
              
                
                S
                
              
              k
            
            ^
          
          =
          
            
              
                (
                
                  
                    
                      
                      
                        M
                        1
                      
                      
                    
                    k
                  
                  +
                  
                    
                      
                      
                        M
                        2
                      
                      
                    
                    k
                  
                  +
                  
                    
                      
                      
                        M
                        3
                      
                      
                    
                    k
                  
                  -
                  
                    
                      
                      
                        
                          M
                          1
                        
                        +
                        
                          M
                          2
                        
                      
                      
                    
                    k
                  
                  -
                  
                    
                      
                      
                        
                          M
                          2
                        
                        +
                        
                          M
                          3
                        
                      
                      
                    
                    k
                  
                  -
                  
                    
                      
                      
                        
                          M
                          1
                        
                        +
                        
                          M
                          3
                        
                      
                      
                    
                    k
                  
                  +
                  
                    
                      
                      
                        
                          M
                          1
                        
                        +
                        
                          M
                          2
                        
                        +
                        
                          M
                          3
                        
                      
                      
                    
                    k
                  
                
                )
              
              ×
              
                1
                3
              
            
            +
            
              
                
                  
                  S
                  
                
                
                  k
                  /
                  2
                
              
              ^
            
          
        
        ,
      
    
    
      
        12
        )
      
    
  




where |S|k/2 can be induced from earlier computations.
Case 4: For flow size of k=6x+3, we have




  
    
      
        
        
          M
          i
        
        
      
      k
    
    =
    
      
        
          
            
            
              S
              ii
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              ij
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              il
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            S
            
          
          k
        
        ^
      
    
  
  ,
  
    

  
  ⁢
  
    
      
        
        
          
            M
            i
          
          +
          
            M
            j
          
        
        
      
      k
    
    =
    
      
        
          
            
            
              S
              ii
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              jj
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              il
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              jl
            
            
          
          k
        
        ^
      
    
  
  ,
  
    

  
  ⁢
  
    
      
        
        
          
            M
            i
          
          +
          
            M
            j
          
          +
          
            M
            l
          
        
        
      
      k
    
    =
    
      
        
          
            
            
              S
              ii
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              jj
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            
              S
              ll
            
            
          
          k
        
        ^
      
      +
      
        
          
            
            S
            
          
          
            k
            /
            3
          
        
        ^
      
    
  
  ,




so we get




  
    
      
        
          
            
              
                
                S
                
              
              k
            
            ^
          
          =
          
            
              
                -
                
                  (
                  
                    
                      
                        
                        
                          M
                          1
                        
                        
                      
                      k
                    
                    +
                    
                      
                        
                        
                          M
                          2
                        
                        
                      
                      k
                    
                    +
                    
                      
                        
                        
                          M
                          3
                        
                        
                      
                      k
                    
                    -
                    
                      
                        
                        
                          
                            M
                            1
                          
                          +
                          
                            M
                            2
                          
                        
                        
                      
                      k
                    
                    -
                    
                      
                        
                        
                          
                            M
                            2
                          
                          +
                          
                            M
                            3
                          
                        
                        
                      
                      k
                    
                    -
                    
                      
                        
                        
                          
                            M
                            1
                          
                          +
                          
                            M
                            3
                          
                        
                        
                      
                      k
                    
                    +
                    
                      
                        
                        
                          
                            M
                            1
                          
                          +
                          
                            M
                            2
                          
                          +
                          
                            M
                            3
                          
                        
                        
                      
                      k
                    
                  
                  )
                
              
              ×
              
                1
                3
              
            
            +
            
              
                
                  
                    
                    S
                    
                  
                  
                    k
                    /
                    3
                  
                
                ^
              
              ×
              
                1
                3
              
            
          
        
        ,
      
    
    
      
        13
        )
      
    
  




where |S|k/3 can be induced from earlier computations.
Case 5: For flow size of k=6x (x>0), we have




  
    
      
        
          
            
              
                
                S
                
              
              k
            
            ^
          
          =
          
            
              
                (
                
                  
                    
                      
                      
                        M
                        1
                      
                      
                    
                    k
                  
                  +
                  
                    
                      
                      
                        M
                        2
                      
                      
                    
                    k
                  
                  +
                  
                    
                      
                      
                        M
                        3
                      
                      
                    
                    k
                  
                  -
                  
                    
                      
                      
                        
                          M
                          1
                        
                        +
                        
                          M
                          2
                        
                      
                      
                    
                    k
                  
                  -
                  
                    
                      
                      
                        
                          M
                          2
                        
                        +
                        
                          M
                          3
                        
                      
                      
                    
                    k
                  
                  -
                  
                    
                      
                      
                        
                          M
                          1
                        
                        +
                        
                          M
                          3
                        
                      
                      
                    
                    k
                  
                  +
                  
                    
                      
                      
                        
                          M
                          1
                        
                        +
                        
                          M
                          2
                        
                        +
                        
                          M
                          3
                        
                      
                      
                    
                    k
                  
                
                )
              
              ×
              
                1
                3
              
            
            +
            
              
                
                  
                  S
                  
                
                
                  k
                  /
                  2
                
              
              ^
            
            -
            
              
                
                  
                    
                    S
                    
                  
                  
                    k
                    /
                    3
                  
                
                ^
              
              ×
              
                1
                3
              
            
          
        
        ,
      
    
    
      
        14
        )
      
    
  




so we get




  
    
  
  ⁢
  
    
      
        
          
          
            M
            i
          
          
        
        k
      
      =
      
        
          
            
              
              
                S
                ii
              
              
            
            k
          
          ^
        
        +
        
          
            
              
              
                S
                ij
              
              
            
            k
          
          ^
        
        +
        
          
            
              
              
                S
                il
              
              
            
            k
          
          ^
        
        +
        
          
            
              
              S
              
            
            k
          
          ^
        
      
    
    ,
    
      

    
    ⁢
    
      
    
    ⁢
    
      
        
          
          
            
              M
              i
            
            +
            
              M
              j
            
          
          
        
        k
      
      =
      
        
          
            
              
              
                S
                ii
              
              
            
            k
          
          ^
        
        +
        
          
            
              
              
                S
                jj
              
              
            
            k
          
          ^
        
        +
        
          
            
              
              
                S
                il
              
              
            
            k
          
          ^
        
        +
        
          
            
              
              
                S
                jl
              
              
            
            k
          
          ^
        
        +
        
          
            
              
              
                S
                ij
              
              
            
            
              k
              /
              2
            
          
          ^
        
        +
        
          
            
              
              S
              
            
            
              k
              /
              2
            
          
          ^
        
      
    
    ,
    
      

    
    ⁢
    
      
        
          
          
            
              M
              i
            
            +
            
              M
              j
            
            +
            
              M
              l
            
          
          
        
        k
      
      =
      
        
          
            
              
              
                S
                ii
              
              
            
            k
          
          ^
        
        +
        
          
            
              
              
                S
                jj
              
              
            
            k
          
          ^
        
        +
        
          
            
              
              
                S
                ll
              
              
            
            k
          
          ^
        
        +
        
          
            
              
              S
              
            
            
              k
              /
              3
            
          
          ^
        
        +
        
          
            
              
              
                S
                il
              
              
            
            
              k
              /
              2
            
          
          ^
        
        +
        
          
            
              
              
                S
                jl
              
              
            
            
              k
              /
              2
            
          
          ^
        
        +
        
          
            
              
              
                S
                ij
              
              
            
            
              k
              /
              2
            
          
          ^
        
      
    
    ,
  




where |S|k/2 and |S|k/3 can be induced from earlier computations.
Finally, when estimating the number of flows with no more than q packets, we need to add  together from k=1 to q, that is

St=Σk=1q  15)

A special case is when k=1, so using equation 11), we get

St=(|M1|1+|M2|1+|M3|1−|M1+M2|1−|M2+M3|1−|M1+M3|1+|M1+M2+M3|1)/3.

Combining this with Lemma 2 for estimating singleton flows from a single column, we get equation 7) used in step 905.
The present invention has been illustrated by the above descriptions and embodiments, but the present invention is not limited thereto. Various modifications and changes can be made by those skilled in the art according to the disclosure herein, which should be within the scope of the present invention.

## Claims

1. A system for catching top hosts from a plurality of hosts, comprising:
a filter configured to sample flows from the hosts and remove the flows that do not satisfy a constraint;
a tracker configured to record a first estimated flow count for each host and to determine a first set of hosts from the plurality of hosts in terms of the estimated flow count; and
an estimator configured to determine a second estimated flow count for each of the determined hosts and select a second set of hosts from the determined hosts based on the second estimated flow count,
wherein determining the second estimated flow count further comprises:
calculating a plurality of sums from a plurality of counters;
determining whether any of the sums overflow;
estimating the flow count based on the determined difference and a rate of sampling r if any of the sums are determined to overflow; and
estimating the flow count based on counts in the plurality of counters, the calculated sums, the rate of sampling r, and a threshold for filtering non-top hosts if any of the sums do not overflow in the estimating.

2. The system of claim 1, wherein the filter further comprises:
a sampler configured to sample the arrival packets of the flows and map each sampled packet into a value associated with a flow ID of the arrival packets,
an accounter configured with a plurality of counters for recording the mapped value, and
a determiner configured to determine whether the flows satisfy said constraint based on the mapped value, and remove the flows if said constraint is not satisfied.

3. The system of claim 2, wherein said constraint is set such that the determiner removes the flows associated with the value when the value is larger than a predetermined sampling threshold, and the determiner triggers the accounter to update the counters therein when the value is not larger than the predetermined sampling threshold.

4. The system of claim 2, wherein the accounter operates to update the counters therein by rule of:
if the value of the counter associated with the mapped value in the plurality of counters is no greater than q, said counter will increase by one,
where q represents a user specified parameter for characterizing small flows of no more than q packets.

5. The system of claim 2, wherein the data structure in the tracker comprises:
a hash table having a plurality of nodes; and
a min-heap,
wherein a key of each node in the hash table is host ID, and a value of each node in the hash table refers to a position of a node in the min-heap.

6. The system of claim 5, wherein each node in the min-heap comprises a field of host ID, a field of count, and a field of error of count, and
wherein the tracker further comprises a detector configured to detect the change of counters in the accounter so as to update the field of count and error in the min-heap.

7. The system of claim 6 wherein the detector is further configured to update the field of count in the min-heap by rule of


If ct[hm(f)]=i and i≦q, counts=counts+Ui,q(t)

wherein Ui,q(t) is set forth by rule of




  
    
      
        Y
        
          
            q
            -
            1
          
          ,
          q
        
      
      =
      
        m
        
          y
          0
        
      
    
    ,
    
      

    
    ⁢
    
      
        Y
        
          
            q
            -
            2
          
          ,
          q
        
      
      =
      
        
          -
          1
        
        ×
        
          [
          
            
              Y
              
                
                  q
                  -
                  1
                
                ,
                q
              
            
            ×
            
              
                y
                1
              
              
                y
                0
              
            
          
          ]
        
      
    
    ,
    
      

    
    ⁢
    
      
        Y
        
          
            q
            -
            3
          
          ,
          q
        
      
      =
      
        
          -
          1
        
        ×
        
          [
          
            
              
                Y
                
                  
                    q
                    -
                    2
                  
                  ,
                  q
                
              
              ×
              
                
                  y
                  1
                
                
                  y
                  0
                
              
            
            +
            
              
                Y
                
                  
                    q
                    -
                    1
                  
                  ,
                  q
                
              
              ×
              
                
                  y
                  2
                
                
                  y
                  0
                
              
            
          
          ]
        
      
    
    ,
    
      

    
    ⁢
    
      
        Y
        
          
            q
            -
            i
          
          ,
          q
        
      
      =
      
        
          -
          1
        
        ×
        
          [
          
            
              ∑
              
                j
                =
                1
              
              
                i
                -
                1
              
            
            ⁢
            
              
                Y
                
                  
                    q
                    -
                    
                      (
                      
                        i
                        -
                        j
                      
                      )
                    
                  
                  ,
                  q
                
              
              ×
              
                
                  y
                  j
                
                
                  y
                  0
                
              
            
          
          ]
        
      
    
    ,
    
      

    
    ⁢
    
      
    
    ⁢
    ...
  




  
    
      
        Y
        
          0
          ,
          q
        
      
      =
      
        
          
            -
            1
          
          ×
          
            
              [
              
                
                  ∑
                  
                    j
                    =
                    1
                  
                  
                    q
                    -
                    1
                  
                
                ⁢
                
                  
                    Y
                    
                      j
                      ,
                      q
                    
                  
                  ×
                  
                    
                      y
                      j
                    
                    
                      y
                      0
                    
                  
                
              
              ]
            
            .
            
              

            
            ⁢
            
              U
              
                0
                ,
                q
              
            
          
        
        =
        
          
            m
            /
            
              y
              0
            
          
          -
          
            Y
            
              0
              ,
              
                q
                +
                1
              
            
          
        
      
    
    ,
    
      

    
    ⁢
    
      
        U
        
          i
          ,
          q
        
      
      =
      
        -
        
          Y
          
            i
            ,
            
              q
              +
              1
            
          
        
      
    
    ,
    
      1
      ≤
      i
      ≤
      
        q
        .
      
    
  


where yi represents number of counters in the accounter with value i,
q represents a user specified parameter for characterizing small flows of no more than q packets,
m represents the number of counters in the accounter,
ct[hm(f)] is the value of the counter associated with the flow with ID f in the accounter,
counts represents the value of the counter associated with the host with ID s in the min-heap.

8. The system of claim 1, wherein the tracker further comprises:
a selector configured to determine the first set of hosts from the plurality of hosts in terms of the first estimated flow counts, wherein the estimated flow counts are determined based on a difference between a count and a count error for each host based on the received packets.

9. The system of claim 1, wherein the estimator further comprises:
a plurality of counters configured to record information of flow count for the first set of hosts; and
an updater configured to update the information on the plurality of counters.

10. The system of claim 9, wherein the estimator (30) further comprises:
a selector (303) configured to select three counters from a plurality of counters, and
wherein the updater (304) is further configured to update the selected counters by
For i=1 to 3


If Mhi(s)[hw(f)]<=q, Mhi(s)[hw(f)]=Mhi(s)[hw(f)]+1


where Mhi(s)[hw(f)] is a selected counter from the plurality of counters, and q represents a user specified parameter for characterizing small flows of no more than q packets.

11. The system of claim 10, wherein the estimator further comprises:
an estimator configured to estimate flow counts from the determined first set of hosts based on the numbers in the selected counters.

12. A method for catching top hosts from a plurality of hosts, comprising:
sampling a plurality of packets from the hosts during a determined interval of time;
determining a difference between a count and a count error for each of the hosts based on the sampled packets;
ranking the hosts based on the determined difference to identify a first set of hosts in the ranked hosts;
estimating a flow count for each of the first set of hosts; and
selecting a second set of hosts from the first set of hosts as the top hosts, based on the estimated flow count,
wherein the estimating further comprises:
calculating a plurality of sums from a plurality of counters;
determining whether any of the sums overflow;
estimating the flow count based on the determined difference and a rate of sampling r if any of the sums is determined overflow in the estimating; and
estimating the flow count based on counts in the plurality of counters, the calculated sums, the rate of sampling r, and a threshold for filtering non-top hosts T2 if any of the sums do not overflow in the estimating.

13. A system for catching top hosts, comprising:
a flow filter configured to test whether a packet in a flow from a plurality of hosts satisfies a predetermined constraint;
a tracker configured to get a plurality of candidate hosts with estimated flow counts thereof based on the test;
an estimator configured to select the top hosts from the candidate hosts and output the selected hosts ranked by the estimated flow counts thereof;
wherein each estimated flow count is determined by:
calculating a plurality of sums from a plurality of counters;
determining whether any of the sums overflow;
estimating the flow count based on the determined difference and a rate of sampling r if any of the sums are determined to overflow; and
estimating the flow count based on counts in the plurality of counters, the calculated sums, the rate of sampling r, and a threshold for filtering non-top hosts if any of the sums do not overflow in the estimating.

14. The system of claim 13, wherein the flow filter further comprises a sampling module configured to sample flows to be processed.

15. A method for catching top hosts, comprising:
testing whether a packet in a flow from one of a plurality of hosts satisfies a predetermined constraint;
getting candidate hosts with estimated flow counts thereof based on the testing;
selecting a plurality of top hosts from the candidate hosts and update the estimated flow counts thereof; and
outputting the selected top hosts ranked by the estimated flow counts thereof;
wherein each estimated flow count is determined by:
calculating a plurality of sums from a plurality of counters;
determining whether any of the sums overflow;
estimating the flow count based on the determined difference and a rate of sampling r if any of the sums are determined to overflow; and
estimating the flow count based on counts in the plurality of counters, the calculated sums, the rate of sampling r, and a threshold for filtering non-top hosts if any of the sums do not overflow in the estimating.

16. The method of claim 15, further comprising prior to the testing:
sampling the flow; and
removing the flow if it does not satisfy the predetermined constraint.

17. A system for catching top hosts, comprising:
a tester for testing whether a packet in a flow from a plurality of hosts satisfies a predetermined constraint;
an estimator for getting a plurality of candidate hosts with estimated flow counts thereof based on the test; and
a selector for selecting the top hosts from the candidate hosts and outputting the selected hosts ranked by the updated flow counts thereof;
wherein each estimated flow count is determined by:
calculating a plurality of sums from a plurality of counters;
determining whether any of the sums overflow;
estimating the flow count based on the determined difference and a rate of sampling r if any of the sums are determined to overflow; and
estimating the flow count based on counts in the plurality of counters, the calculated sums, the rate of sampling r, and a threshold for filtering non-top hosts if any of the sums do not overflow in the estimating.

18. The system of claim 17, wherein the tester further comprises:
a sampler for sampling the flow.