Confirmed users
927
edits
Tarek.ziade (talk | contribs) No edit summary |
Tarek.ziade (talk | contribs) |
||
Line 38: | Line 38: | ||
For every services, the parameters that can be configured are: | For every services, the parameters that can be configured are: | ||
* Retry-After: the value of the header | |||
* TTL: the time after which GR and GB are initialized to 0 | |||
* MinReqs: the minimum number of requests (GR+GB) before the ratio is considered meaningful | |||
* MinRatio: the value between 0 and 1 under which the service is considered unreliable | |||
These parameters are stored in configuration files but pushed into the DB. In other words they can be changed dynamically by the workers or an admin application. | |||
Every-time a request comes in, the web server get GR and BR and calculates the ratio of successes. | Every-time a request comes in, the web server get GR and BR and calculates the ratio of successes. | ||
Line 49: | Line 51: | ||
num_reqs = BR + GR | num_reqs = BR + GR | ||
ratio = GR / (BR + GR) | ratio = GR / (BR + GR) | ||
if num_reqs < min_reqs: | if num_reqs < min_reqs: | ||
# not meaningfull | # not meaningfull | ||
return | return | ||
if ratio < min_ratio: | if ratio < min_ratio: | ||
# oops, too many failures | # oops, too many failures | ||
raise 503("Retry-After: " + retry_after) | raise 503("Retry-After: " + retry_after) | ||
What are "Good" and "Bad" responses from the third-party services is to the workers discretion. | |||
= Disabled = | |||
The DB also store a '''disabled''' flag for each service, that can be toggled manually to shut down a service if needed. | The DB also store a '''disabled''' flag for each service, that can be toggled manually to shut down a service if needed. | ||
In that case, every request are backed-off. | |||