Throttling Yourself First

A client library implements adaptive throttling. Over a rolling two-minute window it counts requests (calls the application attempted, including ones the library rejected locally) and accepts (calls the backend actually served). It drops new calls locally with probability

p=max⁡(0, requests−K⋅acceptsrequests+1)p = \max\left(0,\ \frac{\text{requests} - K\cdot\text{accepts}}{\text{requests} + 1}\right)

Right now requests is 1,800, accepts is 300, and K=2K = 2. What is pp, and what does it accomplish?

A

Zero. accepts is non-zero, so the backend is still serving traffic and the throttle only engages once it rejects everything.

B

About 0.67, so roughly two of every three new calls fail inside the client without a packet leaving it. The backend stops spending CPU on requests it was going to reject anyway, which is where a quota-exhausted service usually falls over.

C

About 0.67, but because requests counts locally rejected calls too, pp climbs toward 1 and the client stops calling the backend until an operator resets its counters.

D

About 0.83, from (1800−300)/1801(1800-300)/1801: KK scales the result rather than the accept count.