Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure GOMAXPROCS & GOMEMLIMIT align with K8s limits #1755

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lburgazzoli
Copy link
Member

@lburgazzoli lburgazzoli commented Mar 17, 2025

Description

Set GOMAXPROCS and GOMEMLIMIT based on the CPU/memory limits
defined in the deployment manifests. This ensures optimal
resource utilization and prevents performance degradation
caused by CPU throttling or OOM issues in containerized Go apps.

References:

Note

As of today, we do configure the operator Deployment with some
resources requests and limits, however, we do not configure the go
runtime according. At this stage this is just an hypothesis, but since
that on a large cluster, the GOMAXPROCS would be automatically
set to the number of cores, resulting in a sub-optimal setup as the
go runtime would assume it can use all the cores, However, we set
500m as resource limit for CPU so we won't be able to use more than
a single thread.

How Has This Been Tested?

Screenshot or short clip

Merge criteria

  • You have read the contributors guide.
  • Commit messages are meaningful - have a clear and concise summary and detailed explanation of what was changed and why.
  • Pull Request contains a description of the solution, a link to the JIRA issue, and to any dependent or related Pull Request.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

Set GOMAXPROCS and GOMEMLIMIT based on the CPU/memory limits
defined in the deployment manifests. This ensures optimal
resource utilization and prevents performance degradation
caused by CPU throttling or OOM issues in containerized Go apps.

References:
- https://www.ardanlabs.com/blog/2024/02/kubernetes-cpu-limits-go.html
- https://www.ardanlabs.com/blog/2024/02/kubernetes-memory-limits-go.html
Copy link

openshift-ci bot commented Mar 17, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link

openshift-ci bot commented Mar 17, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign asanzgom for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

codecov bot commented Mar 17, 2025

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.

Project coverage is 23.96%. Comparing base (06a1b25) to head (c49a4d0).

Files with missing lines Patch % Lines
pkg/cluster/cluster_config.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1755      +/-   ##
==========================================
- Coverage   23.97%   23.96%   -0.02%     
==========================================
  Files         172      172              
  Lines       11699    11704       +5     
==========================================
  Hits         2805     2805              
- Misses       8614     8619       +5     
  Partials      280      280              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lburgazzoli lburgazzoli requested review from VaishnaviHire and removed request for VaishnaviHire March 17, 2025 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

1 participant