[P4-dev] heavy_hitter: number of packets sent by h1,h2 and h3.

Antonin Bas antonin at barefootnetworks.com
Mon Nov 27 11:45:45 EST 2017


Hi Aldo,

It's been a while since I looked at this but I'll do my best to answer.
This is my understanding when I read the instructions:
- the purpose of the tutorial is to design a method to detect heavy
hitters, i.e. hosts that generate the most traffic (eventually it could be
to throttle them)
- the starter code provides one solution, based on the use of a P4 counter,
called ip_src_counter
- however, this solution does not scale to a huge number of hosts so the
tutorial asks you to "ditch" the counter and implement a Bloom Filter
instead, using 2 P4 registers
Therefore the solution does not include a counter anymore, because packet
counting is done through a more scalable Bloom Filter instead.
If you are not familiar with Bloom Filters, you may want to do some reading
about them. As mentioned in the instructions, there could be collisions,
which means it is not really possible to determine how many packets were
sent by each host in the general case. If you use large registers and a
small number of hosts, you will reduce the probability of collision. You
can then compute the hash values for each host (which are used as indices
to increment filter entries) and determine how may packets were sent by
each host. In the example you give, it is likely that one host sent 150
packets because 150 appears in both registers; however it is impossible for
me to tell you which host without computing the hash values.
You can play with the solution to modify the number of hosts, or the size
of the register arrays, thus increasing / decreasing the probability of
collision and the effectiveness of our detection scheme.

Best,

Antonin

On Thu, Nov 23, 2017 at 6:51 PM, Aldo Febro <af12abw at gmail.com> wrote:

> Hi,
>
> I tried the reference solution for heavy hitter tutorial to find out how
> many packets sent by h1, h2, h3. I launched "read_counter.sh" but it
> returned the following error message:
> "RuntimeCmd: Error: Invalid counter name (ip_src_counter)"
>
> https://github.com/p4lang/tutorials/blob/master/SIGCOMM_
> 2016/heavy_hitter/read_counters.sh
>
> When I checked the reference solution file (heavy_hitter.p4), it doesn't
> have ip_src_counter defined, so that makes sense. However, it has 2
> registers defined (heavy_hitter_counter1 and heavy_hitter_counter2).
>
> After running the 'send.py' file, these registers have the following
> values:
>
> ===[heavy_hitter_counter1]===
>
> RuntimeCmd: register_read heavy_hitter_counter1 0
> heavy_hitter_counter1[0]=  251
> RuntimeCmd: register_read heavy_hitter_counter1 1
> heavy_hitter_counter1[1]=  0
> RuntimeCmd: register_read heavy_hitter_counter1 2
> heavy_hitter_counter1[2]=  0
> RuntimeCmd: register_read heavy_hitter_counter1 3
> heavy_hitter_counter1[3]=  208
> RuntimeCmd: register_read heavy_hitter_counter1 4
> heavy_hitter_counter1[4]=  0
> RuntimeCmd: register_read heavy_hitter_counter1 5
> heavy_hitter_counter1[5]=  0
> RuntimeCmd: register_read heavy_hitter_counter1 6
> heavy_hitter_counter1[6]=  0
> RuntimeCmd: register_read heavy_hitter_counter1 7
> heavy_hitter_counter1[7]=  183
> RuntimeCmd: register_read heavy_hitter_counter1 8
> heavy_hitter_counter1[8]=  0
> RuntimeCmd: register_read heavy_hitter_counter1 9
> heavy_hitter_counter1[9]=  112
> RuntimeCmd: register_read heavy_hitter_counter1 10
> heavy_hitter_counter1[10]=  0
> RuntimeCmd: register_read heavy_hitter_counter1 11
> heavy_hitter_counter1[11]=  0
> RuntimeCmd: register_read heavy_hitter_counter1 12
> heavy_hitter_counter1[12]=  263
> RuntimeCmd: register_read heavy_hitter_counter1 13
> heavy_hitter_counter1[13]=  150
> RuntimeCmd: register_read heavy_hitter_counter1 14
> heavy_hitter_counter1[14]=  105
> RuntimeCmd: register_read heavy_hitter_counter1 15
> heavy_hitter_counter1[15]=  30
> RuntimeCmd:
>
>
> ===[heavy_hitter_counter2]===
>
> RuntimeCmd: register_read heavy_hitter_counter2 0
> heavy_hitter_counter2[0]=  30
> RuntimeCmd: register_read heavy_hitter_counter2 1
> heavy_hitter_counter2[1]=  208
> RuntimeCmd: register_read heavy_hitter_counter2 2
> heavy_hitter_counter2[2]=  0
> RuntimeCmd: register_read heavy_hitter_counter2 3
> heavy_hitter_counter2[3]=  114
> RuntimeCmd: register_read heavy_hitter_counter2 4
> heavy_hitter_counter2[4]=  0
> RuntimeCmd: register_read heavy_hitter_counter2 5
> heavy_hitter_counter2[5]=  0
> RuntimeCmd: register_read heavy_hitter_counter2 6
> heavy_hitter_counter2[6]=  297
> RuntimeCmd: register_read heavy_hitter_counter2 7
> heavy_hitter_counter2[7]=  112
> RuntimeCmd: register_read heavy_hitter_counter2 8
> heavy_hitter_counter2[8]=  0
> RuntimeCmd: register_read heavy_hitter_counter2 9
> heavy_hitter_counter2[9]=  183
> RuntimeCmd: register_read heavy_hitter_counter2 10
> heavy_hitter_counter2[10]=  208
> RuntimeCmd: register_read heavy_hitter_counter2 11
> heavy_hitter_counter2[11]=  0
> RuntimeCmd: register_read heavy_hitter_counter2 12
> heavy_hitter_counter2[12]=  0
> RuntimeCmd: register_read heavy_hitter_counter2 13
> heavy_hitter_counter2[13]=  0
> RuntimeCmd: register_read heavy_hitter_counter2 14
> heavy_hitter_counter2[14]=  0
> RuntimeCmd: register_read heavy_hitter_counter2 15
> heavy_hitter_counter2[15]=  150
> RuntimeCmd:
>
> From these value, how would you determine which host sent which packets?
>
> I'm wondering if the solution reference here is a complete one:
> https://github.com/p4lang/tutorials/blob/master/SIGCOMM_
> 2016/heavy_hitter/solution.tar.gz
>
> Any help will be appreciated. Thanks!
>
> Aldo
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>



-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20171127/347e95a6/attachment-0002.html>


More information about the P4-dev mailing list