OCPBUGS-80952: perf: latency: compute memory resources dynamically#1517
Conversation
WalkthroughAdds LATENCY_TEST_MEMORY support for latency e2e tests: introduces defaults and a dynamic mode, computes/validates memory (dynamic = max(32Mi * cpus, default)), and applies the computed quantity as the pod container memory limit. ChangesLatency Test Memory Configuration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 10 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (10 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/e2e/performanceprofile/functests/4_latency/latency.go`:
- Around line 287-289: The check in getLatencyTestMemory that returns
defaultTestMemory when cpus == defaultTestCpus is unreachable given the current
call-site logic (latencyTestCpus is normalized before calling), so either remove
that branch to simplify getLatencyTestMemory (delete the if cpus ==
defaultTestCpus { return defaultTestMemory, nil } case) or keep it but add a
short comment on the cpus parameter explaining this is defensive for future
callers (mentioning defaultTestCpus and why it might still be passed) so readers
know the branch is intentional; locate getLatencyTestMemory and update
accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: c80f1a1c-34b6-48e4-95b1-f963938d2729
📒 Files selected for processing (1)
test/e2e/performanceprofile/functests/4_latency/latency.go
|
@shajmakh: This pull request references Jira Issue OCPBUGS-80952, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@shajmakh: This pull request references Jira Issue OCPBUGS-80952, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/retest |
|
/retest-required |
1 similar comment
|
/retest-required |
|
@shajmakh: This pull request references Jira Issue OCPBUGS-80952, which is valid. 3 validation(s) were run on this bug
DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/e2e/performanceprofile/functests/4_latency/latency.go`:
- Around line 326-330: The code only parses the memory quantity string via
resource.ParseQuantity(val) but returns val without validating it is positive;
capture the parsed Quantity (e.g., q, err := resource.ParseQuantity(val)), then
check q.Sign() > 0 (or return an error if q.Sign() <= 0) before returning val,
so you avoid re-parsing and fail early for zero/negative memory; update the
error message to indicate non-positive values when rejecting.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 853417d4-2e8b-4e08-9c31-2e82c7121ccf
📒 Files selected for processing (1)
test/e2e/performanceprofile/functests/4_latency/latency.go
7538632 to
f8b96cb
Compare
When CPUs are very high the pod's fixed memory resources may become too low to run the latency checks. Add an environment variable to allow more flexibility while preserving the old behavior for backward compatibility. The new behavior goes like this: 1. If no env var is set, scales up the memory amount per CPU floored at defaultTestMemory. 2. else, if it was set to a an explicit memory value and it's a valid quantity then use that in the latency pod, otherwise throw an error. `32Mi` was picked as the per-CPU memory factor based on input from consumers of the application; If happened that the memory is still not enough, the user has the flexibility to override the total memory with an explicit value. Signed-off-by: Shereen Haj <shajmakh@redhat.com>
MarSik
left a comment
There was a problem hiding this comment.
/lgtm
/hold You might want to update the PR description too.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MarSik, shajmakh The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@shajmakh: This pull request references Jira Issue OCPBUGS-80952, which is valid. 3 validation(s) were run on this bug
The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/unhold |
|
/cherry-pick release-4.22 |
|
@shajmakh: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/cherry-pick release-4.21 |
|
@shajmakh: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
/verified later @mrniranjan |
|
@shajmakh: This PR has been marked to be verified later by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@shajmakh: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
@shajmakh: Jira Issue OCPBUGS-80952: All pull requests linked via external trackers have merged: This pull request has the DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@shajmakh: new pull request created: #1520 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@shajmakh: new pull request created: #1521 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Fix included in release 5.0.0-0.nightly-2026-05-19-152900 |
When CPUs are very high the pod's fixed memory resources may become too
low to run the latency checks. Add an environment variable to allow more
flexibility while preserving the old behavior for backward
compatibility.
The new behavior goes like this:
defaultTestMemory.
quantity then use that in the latency pod, otherwise throw an error.
32Miwas picked as the per-CPU memory factor based on input fromconsumers of the application; If happened that the memory is still not
enough, the user has the flexibility to override the total memory with
an explicit value.
Summary by CodeRabbit
New Features
Documentation