Sre
struct derives Debug, EqThe constants of probability-based client-side throttling.
The preset is sre. Build another with Sre::new, or update one in place with { ..sre, k: 2.0 }.
| field | type | what it is |
|---|---|---|
k | Double | How many calls each success pays for. At 1.5 a backend is left alone until more than a third of its calls fail. |
floor | Double | What k decays to while every bucket at the head of the window is failing, so past successes count for less the longer an outage lasts. |
protection | Double | Calls every backend gets regardless, which keeps a quiet one from throttling itself over two bad calls. |
probe | @moondate.Span | After this long with nothing let through, one call is let through anyway, so a backend that has recovered is noticed. |
size | Int32 | Buckets in the window. |
window | @moondate.Span | How far back the window reaches. |
pub fn Sre::new(k~ : Double = sre.k, floor~ : Double = sre.floor, protection~ : Double = sre.protection, probe~ : @moondate.Span = sre.probe, size~ : Int32 = sre.size, window~ : @moondate.Span = sre.window) -> SreA policy by name, every knob with the preset's value.
| parameter | type | default | what it is |
|---|---|---|---|
k~ | Double | sre.k | how many calls each success pays for; the preset's 1.5 leaves a backend alone until more than a third of its calls fail |
floor~ | Double | sre.floor | what k decays to during an outage, 1.1 in the preset |
protection~ | Double | sre.protection | calls every backend gets regardless, 5 in the preset |
probe~ | @moondate.Span | sre.probe | how long with nothing let through before one call is let through anyway |
size~ | Int32 | sre.size | buckets in the window, 40 in the preset |
window~ | @moondate.Span | sre.window | how far back the window reaches, 10 s in the preset |