Package com.linkedin.venice.reliability
Class LoadController
java.lang.Object
com.linkedin.venice.reliability.LoadController
The LoadController is used to control the load on a server by tracking the request and accept rates, and it
borrows the idea from here:
https://sre.google/sre-book/handling-overload/
High-level idea:
1. The load controller will track every request.
2. For the request, which meets the expectation, it will mark it as accepted.
3. It uses the following formula to calculate the rejection ratio:
max(0, (requestRate - acceptMultiplier * acceptRate) / (requestRate + 1))
Here is how the rejection ratio calculation being implemented here:
1. This class is using a sliding window to calcuate the request rate and accept rate.
2. The window size is controlled by
windowSizeInSec
.
3. To reduce the overhead of calculating the rejection ratio, we only calculate it every
rejectionRatioUpdateIntervalInSec
.
4. This class also limits the maximum rejection ratio to maxRejectionRatio
to avoid
rejecting every request, otherwise, the backend won't be able to recover automatically.
5. We can tune acceptMultiplier
to control the rejection ratio.-
Nested Class Summary
Nested Classes -
Method Summary
-
Method Details
-
recordRequest
public void recordRequest() -
recordAccept
public void recordAccept() -
getRejectionRatio
public double getRejectionRatio() -
isOverloaded
public boolean isOverloaded() -
shouldRejectRequest
public boolean shouldRejectRequest() -
newBuilder
-