-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow PageRank to be used independently of the ISCC
For certain workloads it may not be necessary to use PageRank to automatically pick an optimally sized worker. Still, it may be useful to enable the Initial Size Class Cache (ISCC). That way it's possible to observe timing statistics in bb_browser. This change adds a simple StrategyCalculator that is functionally equivalent to FallbackAnalyzer. It always runs actions on the smallest size class, falling back to running it on the largest.
- Loading branch information
1 parent
0bcfdc0
commit f94b63a
Showing
4 changed files
with
92 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
pkg/scheduler/initialsizeclass/smallest_size_class_strategy_calculator.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package initialsizeclass | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/buildbarn/bb-storage/pkg/proto/iscc" | ||
) | ||
|
||
type smallestSizeClassStrategyCalculator struct{} | ||
|
||
func (sc smallestSizeClassStrategyCalculator) GetStrategies(perSizeClassStatsMap map[uint32]*iscc.PerSizeClassStats, sizeClasses []uint32, originalTimeout time.Duration) []Strategy { | ||
if len(sizeClasses) <= 1 { | ||
return nil | ||
} | ||
return []Strategy{ | ||
{ | ||
Probability: 1.0, | ||
ForegroundExecutionTimeout: originalTimeout, | ||
}, | ||
} | ||
} | ||
|
||
func (sc smallestSizeClassStrategyCalculator) GetBackgroundExecutionTimeout(perSizeClassStatsMap map[uint32]*iscc.PerSizeClassStats, sizeClasses []uint32, sizeClassIndex int, originalTimeout time.Duration) time.Duration { | ||
panic("Background execution should not be performed") | ||
} | ||
|
||
// SmallestSizeClassStrategyCalculator implements a StrategyCalculator | ||
// that always prefers running actions on the smallest size class. | ||
// | ||
// This StrategyCalculator behaves similar to FallbackAnalyzer, with the | ||
// main difference that it still causes execution times and outcomes to | ||
// be tracked in the Initial Size Class Cache (ISCC). | ||
var SmallestSizeClassStrategyCalculator StrategyCalculator = smallestSizeClassStrategyCalculator{} |