# Understanding P4 Meters \*\*Explanation Needed\*\*

**URL:** <https://forum.p4.org/t/understanding-p4-meters-explanation-needed/89>\
**Category:** Getting Started with P4\
**Created:** [July 10, 2021, 9:24pm UTC](https://forum.p4.org/t/understanding-p4-meters-explanation-needed/89 "2021-07-10T21:24:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mharrist](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@mharrist](https://forum.p4.org/u/mharrist)\
**Post date:** [July 10, 2021, 9:24pm UTC](https://forum.p4.org/t/understanding-p4-meters-explanation-needed/89/1 "2021-07-10T21:24:57Z")

</div>

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](https://github.com/nsg-ethz/p4-learning/tree/master/examples/meter). 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>`

---

<div class="post-metadata">

**Author:** ![andyfingerhut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/andyfingerhut/32/17_2.png) [@andyfingerhut](https://forum.p4.org/u/andyfingerhut)\
**Post date:** [July 13, 2021, 3:32pm UTC](https://forum.p4.org/t/understanding-p4-meters-explanation-needed/89/2 "2021-07-13T15:32:25Z")

</div>

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](https://github.com/p4lang/behavioral-model/blob/main/docs/runtime_CLI.md#meter_set_rates)

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?

---

<div class="post-metadata">

**Author:** ![mharrist](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@mharrist](https://forum.p4.org/u/mharrist)\
**Post date:** [August 12, 2021, 12:26pm UTC](https://forum.p4.org/t/understanding-p4-meters-explanation-needed/89/3 "2021-08-12T12:26:31Z")

</div>

Hi Andy,

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

---

<div class="post-metadata">

**Author:** ![saikia](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@saikia](https://forum.p4.org/u/saikia)\
**Post date:** [November 22, 2022, 1:46pm UTC](https://forum.p4.org/t/understanding-p4-meters-explanation-needed/89/4 "2022-11-22T13:46:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![andyfingerhut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/andyfingerhut/32/17_2.png) [@andyfingerhut](https://forum.p4.org/u/andyfingerhut)\
**Post date:** [November 22, 2022, 1:51pm UTC](https://forum.p4.org/t/understanding-p4-meters-explanation-needed/89/5 "2022-11-22T13:51:38Z")

</div>

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:

- [RFC 2697: A Single Rate Three Color Marker](https://www.rfc-editor.org/rfc/rfc2697) “A Single Rate Three Color Marker”
- [RFC 2698: A Two Rate Three Color Marker](https://www.rfc-editor.org/rfc/rfc2698) “A Two Rate Three Color Marker”
