Skip to content

Commit

Permalink
RPS mode without RpsCooldownSeconds offset with fixed tests
Browse files Browse the repository at this point in the history
Signed-off-by: Lazar Cvetković <[email protected]>
  • Loading branch information
cvetkovic committed Nov 26, 2024
1 parent 050d5ac commit 07875f8
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 133 deletions.
9 changes: 8 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
| AsyncWaitToCollectMin [^6] | int | >= 0 | 0 | Time after experiment ends after which to collect invocation results |
| RpsTarget | int | >= 0 | 0 | Number of requests per second to issue |
| RpsColdStartRatioPercentage | int | >= 0 && <= 100 | 0 | Percentage of cold starts out of specified RPS |
| RpsCooldownSeconds | int | > 0 | 0 | The time it takes for the autoscaler to downscale function (higher for higher RPS) |
| RpsCooldownSeconds [^7] | int | > 0 | 0 | The time it takes for the autoscaler to downscale function (higher for higher RPS) |
| RpsImage | string | N/A | N/A | Function image to use for RPS experiments |
| RpsRuntimeMs | int | >=0 | 0 | Requested execution time |
| RpsMemoryMB | int | >=0 | 0 | Requested memory |
Expand Down Expand Up @@ -55,6 +55,13 @@ Lambda; https://aws.amazon.com/about-aws/whats-new/2018/10/aws-lambda-supports-f

[^6]: Dirigent specific

[^7] Because Knative's minimum autoscaling stable window is 6s, the minimum keep-alive for a function is 6s. This means
that we need multiple functions to achieve RPS=1, each scaling up/and down with a 1-second delay from each other. In RPS
mode, the number of functions for the cold start experiment is determined by the `RpsCooldownSeconds` parameter, which
is the minimum keep-alive. Due to the implementation complexity, the cold start experiment sleeps for the first
`RpsCooldownSeconds` seconds. In the results, the user should discard the first and the last `RpsCooldownSeconds` of the
results, since the RPS at those points is lower than the requested one.

---

InVitro can cause failure on cluster manager components. To do so, please configure the `cmd/failure.json`. Make sure
Expand Down
12 changes: 12 additions & 0 deletions pkg/generator/rps.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ func generateFunctionByRPS(experimentDuration int, rpsTarget float64) (common.IA
}
}

// make the first invocation be fired right away
if len(iatResult) > 0 {
iatResult[0] = 0
}

return iatResult, countResult
}

Expand All @@ -52,6 +57,13 @@ func GenerateWarmStartFunction(experimentDuration int, rpsTarget float64) (commo
return generateFunctionByRPS(experimentDuration, rpsTarget)
}

// GenerateColdStartFunctions Because Knative's minimum autoscaling stable window is 6s, the minimum keep-alive for a
// function is 6s. This means that we need multiple functions to achieve RPS=1, each scaling up/and down with a 1-second
// delay from each other. In RPS mode, the number of functions for the cold start experiment is determined by the
// RpsCooldownSeconds parameter, which is the minimum keep-alive. This produces the IAT array as above. Due to the
// implementation complexity, the cold start experiment sleeps for the first RpsCooldownSeconds seconds. In the results,
// the user should discard the first and the last RpsCooldownSeconds of the results, since the RPS at those points is
// lower than the requested one.
func GenerateColdStartFunctions(experimentDuration int, rpsTarget float64, cooldownSeconds int) ([]common.IATArray, [][]int) {
iat := 1000000.0 / float64(rpsTarget) // ms
totalFunctions := int(math.Ceil(rpsTarget * float64(cooldownSeconds)))
Expand Down
Loading

0 comments on commit 07875f8

Please sign in to comment.