webrtc_gcc_aimd (webrtc v0.1.0)

View Source

AIMD rate controller of the delay-based part of Google Congestion Control (draft-ietf-rmcat-gcc-02 §5.5).

States Hold, Increase and Decrease follow the transition table of §5.5: over-use moves to Decrease, normal moves Hold to Increase and Decrease to Hold, under-use moves to Hold.

  • Increase: multiplicative (at most 8% per second) while far from convergence, additive (half an expected packet per response time) when the incoming rate R_hat is within three standard deviations of the average rate measured at the previous decreases (exponential average, smoothing 0.95). An R_hat above that range for a response time resets the average, and so does one below it at a decrease (as libwebrtc does: the capacity fell). The estimate never goes above 1.5 R_hat + 10 kbps.
  • Response time: 300 ms whatever the RTT. The draft's RTT + 100 ms makes a flow on a longer path gain rate more slowly, so flows of different RTTs do not share a link fairly (RFC 8836 §2 item 2, RFC 8867 §5.5); 300 ms is that formula at libwebrtc's default RTT of 200 ms. Leaving the range on one high sample of R_hat sent the flow that decreased least into multiplicative increase, so R_hat must stay above it for a response time.
  • Decrease: A_hat = beta R_hat with beta 0.85, never above the current estimate, then Hold. A further decrease waits one RTT (between 10 and 200 ms) unless R_hat fell below half the estimate.
  • Startup: RFC 8836 §2 item 4 allows a faster startup. Until the first decrease, the multiplicative increase uses startup_gain per second (default 1.5) instead of 1.08.

Rates are bits per second, times milliseconds.

Summary

Functions

When the estimate was last decreased on over-use.

Change the bounds, keeping the controller state.

Set the estimate (a feedback timeout or new limits).

Run the controller with the detector signal, the incoming rate R_hat (undefined while unknown), the RTT and the current time.

Types

state/0

-opaque state()

Functions

info(Aimd)

-spec info(state()) -> map().

last_decrease(Aimd)

-spec last_decrease(state()) -> integer() | undefined.

When the estimate was last decreased on over-use.

new(Opts)

-spec new(#{start := pos_integer(), min := pos_integer(), max := pos_integer(), startup_gain => float()}) ->
             state().

rate(Aimd)

-spec rate(state()) -> pos_integer().

set_limits(Min, Max, A)

-spec set_limits(pos_integer(), pos_integer(), state()) -> state().

Change the bounds, keeping the controller state.

set_rate(R, Aimd)

-spec set_rate(pos_integer(), state()) -> state().

Set the estimate (a feedback timeout or new limits).

update(Signal, RHat, Rtt, Now, A0)

-spec update(webrtc_gcc_delay:signal(),
             non_neg_integer() | undefined,
             pos_integer(),
             integer(),
             state()) ->
                state().

Run the controller with the detector signal, the incoming rate R_hat (undefined while unknown), the RTT and the current time.