MAFAI:P4实现测量任务和sketch的思想
-
P4实现HLL
/* HLL SKETCH: https://research.neustar.biz/2012/10/25/sketch-of-the-day-hyperloglog-cornerstone-of-a-big-data-infrastructure/ */// NOTE: instead of indexing the bitmap using the B lowest order bits and calculating the #zeroes as seen starting from bit B+1,
// We do the opposite:
// The B higher order bits are used to index and the zeroes run is calculated from the B+1 highest bit.
// Doing this way, the calculation of the length of the zeroes-run is easier using an LPM lookup with the TCAM
![image]()
找前缀0的个数用LPM流表匹配的方式
2.0.0.0/7 => 0
1.0.0.0/8 => 1
0.128.0.0/9 => 2
0.64.0.0/10 => 3
0.32.0.0/11 => 4
0.16.0.0/12 => 5
0.8.0.0/13 => 6
0.4.0.0/14 => 7
0.2.0.0/15 => 8
0.1.0.0/16 => 9
0.0.128.0/17 => 10
0.0.64.0/18 => 11
0.0.32.0/19 => 12
0.0.16.0/20 => 13
0.0.8.0/21 => 14
0.0.4.0/22 => 15
0.0.2.0/23 => 16
0.0.1.0/24 => 17
0.0.0.128/25 => 18
0.0.0.64/26 => 19
0.0.0.32/27 => 20
0.0.0.16/28 => 21
0.0.0.8/29 => 22
0.0.0.4/30 => 23
0.0.0.2/31 => 24
0.0.0.1/32 => 25
0.0.0.0/32 => 26 -
超点检测
count-min sketch + bitmap(CM sketch的每一个cell都用一个bitmap表示。最后通过查cell的bitmap的个数得到每一个srcIP的dstIP基数)


浙公网安备 33010602011771号