From a4c7efc843110eaa758821c008176d2dad504b7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lazar=20Cvetkovi=C4=87?= Date: Thu, 5 Dec 2024 17:11:24 +0100 Subject: [PATCH] RPS with warmup bugfix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lazar Cvetković --- cmd/loader.go | 9 +++++---- pkg/generator/rps.go | 1 + pkg/generator/rps_test.go | 6 ------ tools/driver/experiment_driver.go | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/cmd/loader.go b/cmd/loader.go index 212fc7fbf..e8c18e1a0 100644 --- a/cmd/loader.go +++ b/cmd/loader.go @@ -116,7 +116,6 @@ func determineDurationToParse(runtimeDuration int, warmupDuration int) int { result := 0 if warmupDuration > 0 { - result += 1 // profiling result += warmupDuration // warmup } @@ -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), diff --git a/pkg/generator/rps.go b/pkg/generator/rps.go index be0de3fb8..e3db9b9d6 100644 --- a/pkg/generator/rps.go +++ b/pkg/generator/rps.go @@ -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, diff --git a/pkg/generator/rps_test.go b/pkg/generator/rps_test.go index 2d2cd61e0..a243517ed 100644 --- a/pkg/generator/rps_test.go +++ b/pkg/generator/rps_test.go @@ -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])) } @@ -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++ { diff --git a/tools/driver/experiment_driver.go b/tools/driver/experiment_driver.go index d5080966f..f9d08cc3d 100644 --- a/tools/driver/experiment_driver.go +++ b/tools/driver/experiment_driver.go @@ -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 {