Understanding P4 Meters **Explanation Needed**

Hi,

I have been looking into P4 meters which I could use as a traffic rate limiter for my application. I stumbled across this P4 meter example in P4-Learning GitHub Repo. From the Runtime CLI, when we execute:

meter_array_set_rates my_meter 0.0000005:1 0.00001:1

what exactly is happening here?

I have found this following format for setting the rates, but I still do not understand how to set the rate limits.

meter_set_rates <name> <index> <rate_1>:<burst_1> <rate_2>:<burst_2>

So this probably does not fully answer your question, but assuming the meter_set_rates command you refer to is the one available in the simple_switch_CLI command, there is a little bit of documentation for it here: behavioral-model/runtime_CLI.md at main · p4lang/behavioral-model · GitHub

It at least mentions the units of the parameters.

Is your question about the units of the meter parameters, or something more fundamental about what meters do?

Hi Andy,

Thank you for replying. I was able to find the necessary information explaining how the meter works.

May I know how it works or where did you find the information?

It would be good to clarify what it is that you would like to know how it works.

If you want to know how P4 meters work, these things are often also called “policers”, and there are these two RFCs that I would recommend reading to learn how they operate:

1 Like