minio / sidekick

High Performance HTTP Sidecar Load Balancer
GNU Affero General Public License v3.0
546 stars 82 forks source link

Distribute to all nodes if the load is low to medium #99

Closed vadmeste closed 8 months ago

poornas commented 9 months ago

@vadmeste ,

            backend.Stats.CurrentCalls.Add(-1)
            backend.Stats.LastFinished.Store(time.Now().UnixNano())

this should be done in UpdateCallStats after the call finishes, not after choosing the backend - otherwise it will always pick the last backend. your fix will only make it work to pick a random backend which is anyway the default.

vadmeste commented 9 months ago

@poornas sorry I am not able to understand. Are you saying there is an issue in this PR or an issue in unrelated another code ?

Also this

backend.Stats.CurrentCalls.Add(-1)
backend.Stats.LastFinished.Store(time.Now().UnixNano())

is executed after the call finishes already. nextProxy() returns a function that will be executed when the call finishes

poornas commented 9 months ago

is executed after the call finishes already. nextProxy() returns a function that will be executed when the call finishes

oops, you are right. missed that