Professional Documents
Culture Documents
Counter Braids: A Novel Counter Architecture For Per-Flow Measurement
Counter Braids: A Novel Counter Architecture For Per-Flow Measurement
Counter Braids: A Novel Counter Architecture For Per-Flow Measurement
Measurement
where a denotes all the flows that hash into counter a. The
problem is to estimate f given c.
3
Each random mapping in CB is a random bipartite graph The change will save some computations in implementation.
with edges generated by the k hash functions. It is sparse The proof of this fact and ensuing analytical consequences
because the number of edges is linear in the number of nodes, is deferred to forthcoming publications. In this paper, we
as opposed to quadratic for a complete bipartite graph. stick to the algorithm in Exhibit 2.
Toy example. Figure 6 shows the evolution of messages dence with only those counters in layer 1 that have over-
over 4 iterations on a toy example. In this particular exam- flown; that is, counters whose status bits are set to 1. The
ple, all flow sizes are reconstructed correctly. Note that we new flow size is still the number of times the corresponding
are using different degrees at some flow nodes. In general, counter overflows, but in this case, the minimum value is 1.
this gives potentially better performance than all flow nodes It is clear from the figure that the use of status bits effec-
having the same degree, but we will stick to the latter in tively reduces the number of flow nodes in layer 2. Hence,
this paper for its ease of implementation. fewer counters are needed in layer 2 for good decodability.
The flow estimates at each iteration are listed in Table 1. This reduction in counter space at layer 2 trades off with
All messages converge in 4 iterations and the estimates at the additional space needed for status bits themselves! As
Iteration 1 (second column) is the Count-Min estimate. we shall see in Section 6, when the number of layers in CB
is small, the tradeoff favors the use of status bits.
iteration 0 1 2 3 4 The flow sizes are decoded recursively, starting from the
fb1 0 34 1 1 1 topmost layer. For example, after decoding the layer-2 flows,
fb2 0 34 1 1 1 we add their sizes (the amount of overflow from layer-1 coun-
fb3 0 32 32 32 32 ters) to the values of layer-1 counters. We then use the new
values of layer-1 counters to decode the flow sizes. Details
Table 1: Flow estimates at each iteration. All messages of the algorithm are presented in Exhibit 3.
converge after Iteration 3.
Exhibit 3: The Multi-layer Algorithm
4.2 Multi-layer 1: for l = L to 1
Multi-layer Counter Braids are decoded recursively, one 2: construct the graph for lth layer
layer at a time. It is conceptually helpful to construct a as in Figure 7 if without status bits;
new set of flows fl for layer-l counters based on the counter as in Figure 8 if with status bits;
values at layer (l 1). The presence of status bits affects 3: decode fl from cl as in Exhibit 2
the definition of fl . 4: cl1 = cl1 + fl 2dl1
where dl1 is the counter depth in bits
at layer (l 1)
5. SINGLE-LAYER ANALYSIS
The decoding algorithm works one layer at a time; hence,
we first analyze the single-layer message passing algorithm
and determine its rate r and reconstruction error probability
Perr . This analysis lays the foundation for the design of
multi-layer Counter Braids, to be presented in Section 6.
Since all counters in layer 1 have the same depth d1 , a very
Figure 7: Without status bits, flows in f2 have a one-to-
relevant quantity for the analysis is the number of counters
one map to all counter in c1 .
per flow:
m/n,
where m is the number of counters and n is the number
of flows. The compression rate in bits per flow is given by
r = d1 . The bipartite graph in Figure 5 will be the focus
of study, as its properties determine the performance of the
algorithm.
0.5
0.4
50
0.3
0
0 0.2 0.4 0.6 0.8 1
10
0 1 2 3 4 5 6 7 8 9
4. Use 5-bit counters at layer 1 for 1.1, and 8-bit bits per flow
counters for < 1.1. Use deep enough counters at
layer 2 so that the largest flow is accommodated (in
general, 64-bit counters at layer-2 are deep enough).
5.5
7. EVALUATION 5
m
Average Error Magnitude, E
4.5
We evaluate the performance of Counter Braids using 4
both randomly generated traces and real Internet traces. 3.5
In Section 7.1 we generate a random graph and a random 3
0.8 at threshold
distribution P(fi > x) = x1.5 , whose entropy is a little less
proportion of flows
0.7
above threshold
than 3 bits. We vary the total number of bits per flow in 0.6
4-bit deep layer-1 counters with status bits. The results are 0.3
lution. We observe that with 1000 flows, there is a sharp number of iterations
decrease in Perr around this asymptotic threshold. Indeed,
the error is less than 1 in 1000 when the number of bits per Figure 13: Performance over number of iterations. Note
flow is 1 bit above the asymptotic threshold. With a larger that Perr for a Count-Min sketch with the same space as
number of flows, the decrease around threshold is expected CB is high.
to be even sharper.
Similarly, once above the threshold, the average error mag- Next, we investigate the number of iterations required to
nitude for both 1-layer and 2-layer Counter Braids is close reconstruct the flows. Figure 13 shows the remaining pro-
to 1, the minimum magnitude of an error. When below the portion of incorrectly decoded flows as the number of iter-
threshold, the average error magnitude increases only lin- ations increases. The experiments are run for 1000 flows
early as the number of bits decreases. At 1 bit per flow, we with the same distribution as above, on a one-layer Counter
have 40 50% flows incorrectly decoded, but the average er- Braids. The number of bits per flow is chosen to be below, at
ror magnitude is only about 5. This means that many flow and above the asymptotic threshold. As predicted by den-
estimates are not far from the true values. sity evolution, Perr decreases exponentially and converges to
Together, we see that the 2-layer CB has much better 0 at or above the asymptotic threshold, and converges to a
performance than the 1-layer CB with the same space. As positive error when below threshold. In this experiment, 10
we increase the number of layers, the asymptotic threshold iterations are sufficient to recover most of the flows.
7.2 Trace Simulation 8. IMPLEMENTATION
We use two OC-48 (2.5 Gbps) one-hour contiguous traces
at a San Jose router. Trace 1 was collected on Wednesday, 8.1 On-Chip Updates
Jan 15, 2003, 10am to 11am, hence representative of week- Each layer of CB can be built on a separate block of SRAM
day traffic. Trace 2 was collected on Thur Apr 24, 2003, to enable pipelining. On pre-built memories, the counter
12am to 1am, hence representative of night-time traffic. We depth is chosen to be an integer fraction of the word length,
divide each trace into 12 5-minute segments, corresponding so as to maximize space usage. This constraint does not
to a measurement epoch. Figure 14 plots the tail distribu- exist with custom-made memories.
tion (P(fi > x)) for all segments. Although the line rate We need a list of flow labels to construct the first-layer
is not high, the number of active flows is already signifi- graph for reconstruction. In cases where access frequencies
cant. Each segment in trace 1 has approximately 0.9 million for pre-fixes or filters are being collected, the flow nodes are
flows and 20 million packets, and each segment in trace 2 simply the set of pre-fixes or filter criteria, which are the
has approximately 0.7 million flows and 9 million packets. same across all measurement epochs. Hence no flow labels
The statistics across different segments within one trace are need to be collected or transferred.
similar. In other cases where the flow labels are elements of a large
space (e.g. flow 5-tuples), the labels need to be collected and
0
10 transferred to the decoding unit. The method for collecting
1 trace 1, 12 segments
flow labels is application-specific, and may depend on the
10
trace 2, 12 segments particular implementation of the application. We give the
tail distribution. P(f >x)
2
10 following suggestion for collecting flow 5-tuples in a specific
i
3
scenario.
10
For TCP flows, a flow label can be written to a DRAM
4
10 which maintains flow IDs when a flow is established; for
5
10
example, when a SYN packet arrives. Since flows are es-
tablished much less frequently than packet arrivals (approx-
6
10 0
10 10
1 2
10 10
3
10
4
10
5 imately one in 40 packets causes a flow to be set up [10]),
flow size in packets these memory accesses do not create a bottleneck. Flows
that span boundaries of measurement epochs can be identi-
Figure 14: Tail distribution. fied using a Bloom Filter[3].
Finally, we evaluated the algorithm by measuring flow
Trace 1 has heavier traffic than trace 2 and also a heavier sizes in packets. The algorithm can be used to measure
tail. In fact, it is the heaviest trace we have encountered so flow sizes in bytes. Since most byte-counting is really the
far, and is much heavier than, for instance, traces plotted in counting of byte-chunks (e.g. 32 or 64 byte-chunks), there
[16]. The proportion of one-packet flows in trace 1 is only is the question of choosing the right granularity: a small
0.11, similar to that of a power-law distribution with = value gives accurate counts but uses more space and vice
0.17. Flows with size larger than 10 packets are distributed versa. We are working on a nice approach to this problem
similar to a power law with 1. and will report results in future publications.
We fix the same sizing of CB for all segments, mimicking
the realistic scenario where traffic varies over time and CB 8.2 Computation Cost of Decoder
is built in hardware. We present the proportion of flows We reconstruct the flow sizes using the iterative message
in error Perr and the average error magnitude Em for both passing algorithm in an offline unit. The decoding com-
traces together. We vary the total number of bits in CB7 , plexity is linear in the number of flows. Decoding CB with
denoted by B, and present the result in Table 3. more than one layer imposes only a small additional cost,
For all experiments, we use a two-layer CB with status since the higher layers are 1 2 orders smaller than the first
bits, and 3 hash functions at both layers. The layer-1 coun- layer. For example, decoding 1 million flows on a two-layer
ters are 8 bits deep and the layer-2 counters are 56 bits deep. Counter Braids takes, on average, 15 seconds on a 2.6GHz
machine.
B (MB) 1.2 1.3 1.35 1.4
Perr 0.33 0.25 0.15 0
Em 3 1.9 1.2 0
9. CONCLUSION AND FURTHER WORK
We presented Counter Braids, a efficient minimum-space
counter architecture, that solves large-scale network mea-
Table 3: Simulation results of counting 2 traces in 5- surement problems such as per-flow and per-prefix counting.
minute segments, on a fixed-size CB with total space B. Counter Braids incrementally compresses the flow sizes as
it counts and the message passing reconstruction algorithm
We observe a similar phenomenon as in Figure 12. As recovers flow sizes almost perfectly. We minimize counter
we underprovide space, the reconstruction error increases space with incremental compression, and solve the flow-to-
significantly. However, the error magnitude remains small. counter association problem using random graphs. As shown
For these two traces, 1.4 MB is sufficient to count all flows from real trace simulations, we are able to count upto 1 mil-
correctly in 5-minute segments. lion flows purely in SRAM and recover the exact flow sizes.
We are currently implementing this in an FPGA to deter-
7
We are not using bits per flow here since the number of mine the actual memory usage and to better understand
flows is different in different segments. implementation issues.
Several directions are open for further exploration. We [17] Y. Lu, A. Montanari, and B. Prabhakar. Detailed
mention two: (i) Since a flow passes through multiple routers, network measurements using sparse graph counters:
and since our algorithm is amenable to a distributed imple- The theory. Allerton Conference, September 2007.
mentation, it will save counter space dramatically to com- [18] M. Luby, M. Mitzenmacher, A. Shokrollahi, D. A.
bine the counts collected at different routers. (ii) Since Spielman, and V. Stemann. Practical loss-resilient
our algorithm degrades gracefully, in the sense that if the codes. In Proc. of STOC, pages 150159, 1997.
amount of space is less than the required amount, we can [19] M. Mezard and A. Montanari. Constraint satisfaction
still recover many flows accurately and have errors of known networks in Physics and Computation. In Preparation.
size on a few, it is worth studying the graceful degradation [20] S. Ramabhadran and G. Varghese. Efficient
formally as a lossy compression problem. implementation of a statistics counter architecture.
Acknowledgement: Support for OC-48 data collection is Proc. ACM SIGMETRICS, pages 261271, 2003.
provided by DARPA, NSF, DHS, Cisco and CAIDA mem- [21] T. Richardson and R. Urbanke. Modern Coding
bers. This work has been supported in part by NSF Grant Theory. Cambridge University Press, 2007.
Number 0653876, for which we are thankful. We also thank [22] D. Shah, S. Iyer, B. Prabhakar, and N. McKeown.
the Clean Slate Program at Stanford University, and the Analysis of a statistics counter architecture. Proc.
Stanford Graduate Fellowship program for supporting part IEEE HotI 9.
of this work. [23] Q. G. Zhao, J. J. Xu, and Z. Liu. Design of a novel
statistics counter architecture with optimal space and
10. REFERENCES time efficiency. SIGMetrics/Performance, June 2006.
[1] http://www.cisco.com/warp/public/732/Tech/netflow.
Appendix: Asymptotic Optimality
[2] Juniper networks solutions for network accounting.
www.juniper.net/techcenter/appnote/350003.html. We state the result on asymptotic optimality without a
proof. The complete proof can be found in [17].
[3] B. Bloom. Space/time trade-offs in hash coding with
We make two assumptions on the flow size distribution p:
allowable errors. Comm. ACM, 13, July 1970.
[4] J. W. Byers, M. Luby, M. Mitzenmacher, and A. Rege. 1. It has at most power-law tails. By this we mean that
A digital fountain approach to reliable distribution of P{fi x} Ax for some constant A and some > 0.
bulk data. In SIGCOMM, pages 5667, 1998. This is a valid assumption for network statistics [9].
[5] G. Caire, S. Shamai, and S. Verdu. Noiseless data 2. It has decreasing digit entropy. P
compression with low density parity check codes. In Write fi in its q-ary expansion a0 fi (a)q a . Let hl =
P
DIMACS, New York, 2004. x P(fi (l) = x) log q P(fi (l) = x) be the q-ary entropy
[6] E. Candes and T. Tao. Near optimal signal recovery of fi (l). Then hl is monotonically decreasing in l for
from random projections and universal encoding any q large enough.
strategies. IEEE Trans. Inform. Theory, 2004. We call a distribution p with these two properties admis-
[7] G. Cormode and S. Muthukrishnan. An improved sible. This class includes most cases of practical interest.
data stream summary: the count-min sketch and its For instance, any power-law distribution is admissible. The
applications. Journal of Algorithms, 55(1), April 2005. (binary) entropy of this distribution is denoted by H2 (p)
P
[8] T. M. Cover and J. A. Thomas. Elements of x p(x) log2 p(x).
Information Theory. Wiley, New York, 1991.
For this section only, we assume that all counters in CB
[9] M. Crovella and A. Bestavros. Self-similarity in world have an equal depth of d bits. Let q = 2d .
wide web traffic: Evidence and possible causes.
IEEE/ACM Trans. Networking, 1997. Definition 2. We represent CB as a sparse graph G,
[10] S. Dharmapurikar and V. Paxson. Robust tcp stream with vertices consisting of n flows and a total of m(n) coun-
reassembly in the presence of adversaries. 14th ters in all layers. A sequence of Counters Braids {Gn }has
USENIX Security Symposium, 2005. design rate r if
[11] D. Donoho. Compressed sensing. IEEE Trans. Inform.
m(n)
Theory, 52(4), April 2006. r = lim log2 q . (1)
n n
[12] C. Estan and G. Varghese. New directions in traffic
measurement and accounting. Proc. ACM SIGCOMM It is reliable for the distribution p if there exists a sequence
Internet Measurement Workshop, pages 7580, 2001. of reconstruction functions F bn FbGn such that
[13] R. G. Gallager. Low-Density Parity-Check Codes. MIT bn ) P{F n
bn (c) 6= f }
Perr (Gn , F 0. (2)
Press, Cambridge, Massachussetts.
[14] M. Grossglauser and J. Rexford. Passive traffic
measurement for ip operations. The Internet as a Here is the main theorem:
Large-Scale Complex System, 2002. Theorem 3. For any admissible input distribution p, and
[15] F. Kschischang, B. Frey, and H.-A. Loeliger. Factor any rate r > H2 (p) there exists a sequence of reliable sparse
graphs and the sum-product algorithm. IEEE Trans. Counter Braids with asymptotic rate r.
Inform. Theory, 47:498519, 2001.
[16] A. Kumar, M. Sung, J. J. Xu, and J. Wang. Data The theorem is satisfying as it shows that the CB archi-
streaming algorithms for efficient and accurate tecture is fundamentally good in the information-theoretic
estimation of flow size distribution. Proceedings of sense. Despite being incremental and linear, it is as good
ACM SIGMETRICS, 2004. as, for example, Huffman codes, at infinite blocklength.