8000 runnable sharding · open-lambda/open-lambda@4749469 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4749469

Browse files
committed
8000
runnable sharding
1 parent 07a63c3 commit 4749469

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/boss/cloudvm/worker.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -596,18 +596,18 @@ func (pool *WorkerPool) RunLambda(w http.ResponseWriter, r *http.Request) {
596596

597597
// a simple load balancer based on worker's processed tasks
598598
assigned := worker.workerId
599-
// var smallWorker *Worker
600-
// var smallWorkerTask int32
601-
// smallWorkerTask = 10000
602-
// for _, curWorker := range pool.workers[RUNNING] {
603-
// if curWorker.numTask < smallWorkerTask {
604-
// smallWorkerTask = curWorker.numTask
605-
// smallWorker = curWorker
606-
// }
607-
// }
608-
// if smallWorkerTask < (worker.numTask - 10) {
609-
// worker = smallWorker
610-
// }
599+
var smallWorker *Worker
600+
var smallWorkerTask int32
601+
smallWorkerTask = 10000
602+
for _, curWorker := range pool.workers[RUNNING] {
603+
if curWorker.numTask < smallWorkerTask {
604+
smallWorkerTask = curWorker.numTask
605+
smallWorker = curWorker
606+
}
607+
}
608+
if smallWorkerTask < (worker.numTask - 32) {
609+
worker = smallWorker
610+
}
611611

612612
// fmt.Printf("Debug: function %s assigned to %s\n", thisTask, assigned)
613613

0 commit comments

Comments
 (0)
0