feat: Set Go runtime hints for SDK sidecar#4569
Open
mnthe wants to merge 1 commit into
Open
Conversation
Limit SDK sidecar scheduler parallelism with GOMAXPROCS=1. When a sidecar memory request is configured, derive GOMEMLIMIT from 90% of that request so Go-managed memory stays aligned with the scheduled amount. Signed-off-by: JungHun Kim <mnthe@pubg.com>
4096c7a to
b0b8ae8
Compare
Member
|
/gcbrun |
markmandel
reviewed
May 19, 2026
Comment on lines
+71
to
+72
| sidecarGoMaxProcs = "1" | ||
| sidecarGoMemLimitRequestPercentage = 90 |
Member
There was a problem hiding this comment.
These seem like good defaults, but I wonder if this should be configurable, just in case. 🤔 WDYT/
Collaborator
|
Build Failed 😭 Build Id: b4c9e6ea-3e9c-4b44-93ce-a0be2c977c39 Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Member
|
Is that a legit test failure? It looks like one |
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.
/kind feature
What this PR does / Why we need it:
This PR sets Go runtime resource hints for the GameServer SDK
sidecar:
GOMAXPROCS=1GOMEMLIMIT=<90% of sidecar memory request>whenagones.image.sdk.memoryRequestis configuredThe SDK sidecar is expected to be lightweight and should not need more than one vCPU. In pods without CPU limits, the Go runtime may otherwise size scheduler parallelism from host- visible CPU resources, which can be inefficient for the sidecar workload.
For memory, this derives the runtime memory hint from the configured sidecar memory request. If no sidecar memory request is configured,
GOMEMLIMITis not set.This does not change Kubernetes CPU or memory requests or limits. It only provides runtime hints to the SDK sidecar process.
Which issue(s) this PR fixes:
Closes #4568
Special notes for your reviewer:
GOMAXPROCSis fixed at1because the SDK sidecar is not expected to need more than one vCPU, even when the CPU request is unset. If there are expected SDK sidecar workloads where using more than one vCPU is important, I can change this to deriveGOMAXPROCSfrom the configured CPU request instead.GOMEMLIMITis set to 90% of the memory request to leave headroom for memory outside Go runtime-managed memory. The 90% ratio is a heuristic; if this does not leave enough headroom, I can adjust it to a more conservative value such as 80%.The SDK sidecar is also expected to be lightweight in memory usage. However, in some Windows dedicated server deployments, the sidecar may be run in a Guaranteed QoS pod and can temporarily consume more memory than expected. For that case, this PR derives
GOMEMLIMITfrom the configured memory request so the Go runtime has a soft memory hint aligned with the scheduled sidecar resources.Validation:
git diff --checkgo test -mod=vendor ./pkg/gameservers -run TestControllerSidecarGoRuntimeResourceHints -count=1