Repository navigation
fix(loadtest): generate the large deploy body per iteration and cap its concurrency - #1381
Merged
Merged
Conversation
The 200 MB deploy runs in its own executor whose concurrency is capped by the memory of the load generator pod. The cap is the largest whole number whose bodies and headroom fit that limit, and an override over the rule must be refused with a message that names both numbers. The tests come first, so they are seen failing before the module exists.
The 200 MB deploy holds one body per in-flight request, so the number of requests that may run at once has to fit the memory of the load generator pod. The cap is derived from that limit, and an override that breaks the rule is refused before a run starts.
The load generator pod is sized from two constants: its memory limit and the headroom the runtime needs next to the bodies. The tests check that both are Kubernetes quantities, that the headroom lies below the limit, and that the TestRun requests and limits exactly that memory, so a typo cannot reach the cluster.
The 200 MB bodies are held in the memory of the load generator pod, and without a limit the pod can take the memory of its node. The limit and the headroom beside the bodies are constants, provisional until a measured run replaces them, and the TestRun requests exactly the limit so the pod is not scheduled into memory it cannot have.
A virtual user that keeps the 200 MB body holds a full copy of it, and every virtual user runs its own runtime, so the copies multiply with the concurrency. The tests require a pure sender that generates the body right before the request, from the seed of its size, and generates it again on the next call, so nothing keeps it between iterations.
The module-level map kept one body per size in every virtual user, so each virtual user that deployed held its own 200 MB copy. The body is now generated for each deploy, handed to the request and dropped when the iteration returns, which keeps the bodies in memory at one per request in flight. The seed of a size is unchanged, so the bytes stay the same across runs.
Every size of the deploy shared one executor, so the 200 MB bodies in flight were not bounded by the memory of the load generator pod. The tests require the 200 MB size in a separate constant-arrival-rate executor capped at the derived cap, the other sizes in theirs, and the rate of the profile split between the two without change.
All sizes of the deploy shared one executor, so the bodies of the largest size in flight were bounded by nothing but the virtual user pool. The 200 MB size now runs in a constant-arrival-rate executor whose maxVUs is the cap derived from the memory of the load generator pod, and the other sizes keep theirs. The arrival rate is split between the two, so the load of the profile stays the same.
A cap that needs more memory than the load generator pod has would be found out only when the 200 MB bodies are already in memory, after the install and the wait. The test requires the run to stop before the install and before any cluster call, and the refusal to name the cap and the memory limit.
A run whose cap breaks the memory rule is now refused before the install and before any cluster call. The runner checks the cap before it writes the credentials file, so a refused run leaves no secret behind. The override of the cap is read from --deploy-cap and passed to the archive as LOADTEST_DEPLOY_CAP, so the executor that runs the 200 MB size is capped at the value that was checked.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The deploy scenario was meant to send a 200 MB artifact, but k6 cannot stream a request body. Every virtual user kept its own full copy of each body, so a busy deploy step would exhaust the memory of the load generator pod long before it said anything about Ingot. The pod also had no memory limit, so the failure would show up as a node under pressure rather than as a clear error.
Following the amended design D10 of
add-load-tests(#1380):--deploy-capoverride that would not fit is refused before anything touches the cluster, with a message naming the cap and the limitThe memory limit (2Gi) and headroom (512Mi) are provisional and give a cap of 7. They are replaced with the measured peak after a run on the cluster (task 9.10).
Type of change
fix- bug fixHow was this tested?
npm run typecheckinloadtest/: passesnpm testinloadtest/: 363 tests, all pass; each new test was seen failing before its fixChecklist
CLAUDE.md(English, imperative, one offeat,fix,docs,refactor,test,build,ci,chore,perf)./gradlew buildpasses locally (not applicable,loadtest/only)