Skip to content

Commit

Permalink
RPS with warmup bugfix
Browse files Browse the repository at this point in the history
Signed-off-by: Lazar Cvetković <[email protected]>
  • Loading branch information
cvetkovic committed Dec 6, 2024
1 parent bf57897 commit a4c7efc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
9 changes: 5 additions & 4 deletions cmd/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ func determineDurationToParse(runtimeDuration int, warmupDuration int) int {
result := 0

if warmupDuration > 0 {
result += 1 // profiling
result += warmupDuration // warmup
}

Expand Down Expand Up @@ -214,18 +213,20 @@ func runTraceMode(cfg *config.LoaderConfiguration, readIATFromFile bool, writeIA
}

func runRPSMode(cfg *config.LoaderConfiguration, readIATFromFile bool, writeIATsToFile bool) {
experimentDuration := determineDurationToParse(cfg.ExperimentDuration, cfg.WarmupDuration)

rpsTarget := cfg.RpsTarget
coldStartPercentage := cfg.RpsColdStartRatioPercentage

warmStartRPS := rpsTarget * (100 - coldStartPercentage) / 100
coldStartRPS := rpsTarget * coldStartPercentage / 100

warmFunction, warmStartCount := generator.GenerateWarmStartFunction(cfg.ExperimentDuration, warmStartRPS)
coldFunctions, coldStartCount := generator.GenerateColdStartFunctions(cfg.ExperimentDuration, coldStartRPS, cfg.RpsCooldownSeconds)
warmFunction, warmStartCount := generator.GenerateWarmStartFunction(experimentDuration, warmStartRPS)
coldFunctions, coldStartCount := generator.GenerateColdStartFunctions(experimentDuration, coldStartRPS, cfg.RpsCooldownSeconds)

experimentDriver := driver.NewDriver(&config.Configuration{
LoaderConfiguration: cfg,
TraceDuration: determineDurationToParse(cfg.ExperimentDuration, cfg.WarmupDuration),
TraceDuration: experimentDuration,

YAMLPath: parseYAMLSpecification(cfg),

Expand Down
1 change: 1 addition & 0 deletions pkg/generator/rps.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ func CreateRPSFunctions(cfg *config.LoaderConfiguration, warmFunction common.IAT
Name: fmt.Sprintf("warm-function-%d", rand.Int()),

InvocationStats: &common.FunctionInvocationStats{Invocations: warmFunctionCount},
RuntimeStats: &common.FunctionRuntimeStats{Average: float64(cfg.RpsRuntimeMs)},
MemoryStats: &common.FunctionMemoryStats{Percentile100: float64(cfg.RpsMemoryMB)},
DirigentMetadata: &common.DirigentMetadata{
Image: cfg.RpsImage,
Expand Down
6 changes: 0 additions & 6 deletions pkg/generator/rps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,6 @@ func TestColdStartMatrix(t *testing.T) {
}

for fIndex := 0; fIndex < len(matrix); fIndex++ {
currentMinute := 0

if len(matrix[fIndex]) != len(test.expectedIAT[fIndex]) {
t.Errorf("Unexpected length of function %d IAT array - got: %d, expected: %d", fIndex, len(matrix[fIndex]), len(test.expectedIAT[fIndex]))
}
Expand All @@ -395,10 +393,6 @@ func TestColdStartMatrix(t *testing.T) {
if math.Abs(matrix[fIndex][i]-test.expectedIAT[fIndex][i]) > epsilon {
t.Errorf("Unexpected value fx %d val %d - got: %f; expected: %f", fIndex, i, matrix[fIndex][i], test.expectedIAT[fIndex][i])
}

if currentMinute > len(test.expectedCount[fIndex]) {
t.Errorf("Invalid expected count array size for function with index %d", fIndex)
}
}

for i := 0; i < len(test.expectedCount[fIndex]); i++ {
Expand Down
2 changes: 1 addition & 1 deletion tools/driver/experiment_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func (d *Driver) collectStats() {
for idx, client := range clients {
go func(client *simplessh.Client, idx int) {
defer wg.Done()
durationInt = durationInt + d.WarmupDuration + 1 // add warmup and profiling duration
durationInt = durationInt + d.WarmupDuration
duration := strconv.Itoa(durationInt)
metrics := []string{"duration"}
if d.loaderConfig.loaderConfiguration.EnableMetricsScrapping {
Expand Down

0 comments on commit a4c7efc

Please sign in to comment.