-
Notifications
You must be signed in to change notification settings - Fork 823
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Specify CPU Request for the SDK Server Sidecar
This provides the mechanism (and defaults) for being able to set both the CPU request, and CPU limits for the SDK Server `GameServer` sidecar. I've only set the Request level, as it seems that the major issue is not CPU usage, but actually how the scheduler allots space for the sidecar (by default 100/0.1 vCPU is alloted to each container. After discussion, the CPU request has been set to 30m, but is also configurable via the helm chart. I've not set a CPU limit, as I found when setting a low (<= 20m) CPU limit on the sidecar it mostly stopped working. But if people want to experiment with this, it is also configurable via the Helm chart. Closes #344
- Loading branch information
1 parent
1923a41
commit c6f714a
Showing
12 changed files
with
162 additions
and
60 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Limiting CPU & Memory | ||
|
||
Kubernetes natively has inbuilt capabilities for requesting and limiting both CPU and Memory usage of running containers. | ||
|
||
As a short description: | ||
|
||
- CPU `Requests` are limits that are applied when there is CPU congestion, and as such can burst above their set limits. | ||
- CPU `Limits` are 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](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/) | ||
Kubernetes documentation for more details on "requests" and "limits" to both CPU and Memory, and how to configure them. | ||
|
||
## GameServers | ||
|
||
Since the `GameServer` specification provides a full [`PodSpecTemplate`](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#podtemplatespec-v1-core), | ||
we can take advantage of both resource limits and requests in our `GameServer` configurations. | ||
|
||
For example, to set a CPU limit on our `GameServer` configuration of 250m/0.25 of a cpu, | ||
we could do so as followed: | ||
|
||
```yaml | ||
apiVersion: "stable.agones.dev/v1alpha1" | ||
kind: GameServer | ||
metadata: | ||
name: "simple-udp" | ||
spec: | ||
ports: | ||
- name: default | ||
portPolicy: "dynamic" | ||
containerPort: 7654 | ||
template: | ||
spec: | ||
containers: | ||
- name: simple-udp | ||
image: gcr.io/agones-images/udp-server:0.4 | ||
resources: | ||
limit: | ||
cpu: "250m" #this is our limit here | ||
``` | ||
If you do not set a limit or request, the default is set my Kubernetes at a 100m CPU request. | ||
## SDK GameServer sidecar | ||
⚠️⚠️⚠️ **This is currently a development feature and has not been released** ⚠️⚠️⚠️ | ||
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](../install/helm/README.md#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. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.