Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gmichelo authored Nov 3, 2019
1 parent ceb9edc commit 9eff255
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
Sometimes, certain messages are more important than others. The drr package provides a generic implementation of [Deficit Round Robin scheduler](https://en.wikipedia.org/wiki/Deficit_round_robin) for Go channels. Through this package, developer can merge multiple input channels into a single output one by enforcing different input rates.

## Quick overview on DRR theory
Let's assume you have one single worker goroutine that must handle all the incoming requests. Let's also assume that there are two sources of those requests implemented through a couple of channels. Channel _In_1_ carries the requests with higher priority _P1_. While channel _In_2_ carries the requests with lower priority _P2_.
Let's assume you have one single worker goroutine that must handle all the incoming requests. Let's also assume that there are two sources of those requests implemented through a couple of channels. Channel _In_1_ carries the requests with higher priority _P1_, while channel _In_2_ carries the requests with lower priority _P2_.

<p align="center">
<img src="doc/img/drrschema.png">
</p>

What we observe from channel _Out_ is that input flows _In_1_ and _In_2_ share the output's capacity according to their priorities. That is, flow _In_1_ takes <img src="https://latex.codecogs.com/svg.latex?\inline&space;\fn_phv&space;\LARGE&space;\frac{P1}{P1&plus;P2}" title="Fraction of In1" /> fraction of output capacity. While flow _In_2_ uses the remaining fraction, <img src="https://latex.codecogs.com/svg.latex?\inline&space;\fn_phv&space;\LARGE&space;\frac{P2}{P1&plus;P2}" title="Fraction of In1" />.
What we observe from channel _Out_ is that input flows _In_1_ and _In_2_ share the output's capacity according to their priorities. That is, flow _In_1_ takes <img src="https://latex.codecogs.com/svg.latex?\inline&space;\fn_phv&space;\LARGE&space;\frac{P1}{P1&plus;P2}" title="Fraction of In1" /> fraction of output capacity. While flow _In_2_ uses the remaining fraction, <img src="https://latex.codecogs.com/svg.latex?\inline&space;\fn_phv&space;\LARGE&space;\frac{P2}{P1&plus;P2}" title="Fraction of In2" />.

<p align="center">
<img src="doc/img/barchart.png">
</p>

DRR scheduling algorithm does not take into account empty flows (i.e. those that do not have nothing to transmit). Therefore, the output capacity is shared among all the non-empty input flows.
DRR scheduling algorithm does not take into account empty flows (i.e. those that do not have anything to transmit). Therefore, the output capacity is shared among all the non-empty input flows.

## API Documentation
Documentation can be found [here](https://godoc.org/github.com/bigmikes/drr).
Expand Down

0 comments on commit 9eff255

Please sign in to comment.