chore: make cpu usage more smooth (#3842)

This commit is contained in:
Kevin Wan
2024-01-13 19:36:25 +08:00
committed by GitHub
parent 7ba8adfc74
commit 81d72b5010
5 changed files with 11 additions and 6 deletions

View File

@@ -136,7 +136,7 @@ func (as *adaptiveShedder) addFlying(delta int64) {
// update avgFlying when the request is finished.
// this strategy makes avgFlying have a little bit lag against flying, and smoother.
// when the flying requests increase rapidly, avgFlying increase slower, accept more requests.
// when the flying requests drop rapidly, avgFlying drop slower, accept less requests.
// when the flying requests drop rapidly, avgFlying drop slower, accept fewer requests.
// it makes the service to serve as more requests as possible.
if delta < 0 {
as.avgFlyingLock.Lock()