Limiting CPU & Memory
As a short description:
Requestsare limits that are applied when there is CPU congestion, and as such can burst above their set limits.
Limitsare hard limits on how much CPU time the particular container gets access to.
This is useful for game servers, not just as a mechanism to distribute compute resources evenly, but also as a way to advice the Kubernetes scheduler how many game server processes it is able to fit into a given node in the cluster.
It’s worth reading the Managing Compute Resources for Containers Kubernetes documentation for more details on “requests” and “limits” to both CPU and Memory, and how to configure them.
GameServer specification provides a full
we can take advantage of both resource limits and requests in our
For example, to set a CPU limit on our
GameServer configuration of
250m/0.25 of a CPU,
we could do so as followed:
apiVersion: "agones.dev/v1" kind: GameServer metadata: name: "simple-game-server" spec: ports: - name: default containerPort: 7654 template: spec: containers: - name: simple-game-server image: gcr.io/agones-images/simple-game-server:0.13 resources: limits: cpu: "250m" #this is our limit here
If you do not set a limit or request, the default is set by Kubernetes at a 100m CPU request.
SDK GameServer sidecar
You may also want to tweak the CPU request or limits on the SDK
GameServer sidecar process that spins up alongside
each game server container.
You can do this through the Helm configuration when installing Agones.
By default, this is set to having a CPU request value of 30m, with no hard CPU limit. This ensures that the sidecar always has enough CPU to function, but it is configurable in case a lower, or higher value is required on your clusters, or if you desire hard limit.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.
Last modified June 23, 2022: Delete Katacoda link because Katacoda is closed (#2640) (079dced)