You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/admin/scale.md
+75-12
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
We scale-test Coder with the [same utility](#scaletest-utility) that can be used in your environment for insights into how Coder scales with your infrastructure.
1
+
We scale-test Coder with [a built-in utility](#scaletest-utility) that can be used in your environment for insights into how Coder scales with your infrastructure.
2
2
3
3
## General concepts
4
4
@@ -17,43 +17,80 @@ Coder runs workspace operations in a queue. The number of concurrent builds will
17
17
18
18
## Infrastructure recommendations
19
19
20
+
> Note: The below are guidelines for planning your infrastructure. Your mileage may vary depending on your templates, workflows, and users.
21
+
22
+
When planning your infrastructure, we recommend you consider the following:
23
+
24
+
1. CPU and memory requirements for `coderd`. We recommend allocating 1 CPU core and 2 GB RAM per `coderd` replica at minimum. See [Concurrent users](#concurrent-users) for more details.
25
+
1. CPU and memory requirements for [external provisioners](../admin/provisioners.md#running-external-provisioners), if required. We recommend allocating 1 CPU core and 1 GB RAM per 5 concurrent workspace builds to external provisioners. Note that this may vary depending on the template used. See [Concurrent workspace builds](#concurrent-workspace-builds) for more details. By default, `coderd` runs 3 integrated provisioners.
26
+
1. CPU and memory requirements for the database used by `coderd`. We recommend allocating an additional 1 CPU core to the database used by Coder for every 1000 active users.
27
+
1. CPU and memory requirements for workspaces created by Coder. This will vary depending on users' needs. However, the Coder agent itself requires at minimum 0.1 CPU cores and 256 MB to run inside a workspace.
28
+
29
+
### Concurrent users
30
+
31
+
We recommend allocating 2 CPU cores and 4 GB RAM per `coderd` replica per 1000 active users.
32
+
We also recommend allocating an additional 1 CPU core to the database used by Coder for every 1000 active users.
33
+
Inactive users do not consume Coder resources, although workspaces configured to auto-start will consume resources when they are built.
34
+
35
+
Users' primary mode of accessing Coder will also affect resource requirements.
36
+
If users will be accessing workspaces primarily via Coder's HTTP interface, we recommend doubling the number of cores and RAM allocated per user.
37
+
For example, if you expect 1000 users accessing workspaces via the web, we recommend allocating 4 CPU cores and 8 GB RAM.
38
+
39
+
Users accessing workspaces via SSH will consume fewer resources, as SSH connections are not proxied through Coder.
40
+
20
41
### Concurrent workspace builds
21
42
22
-
Workspace builds are CPU-intensive, as it relies on Terraform. Various [Terraform providers](https://registry.terraform.io/browse/providers) have different resource requirements. When tested with our [kubernetes](https://github.com/coder/coder/tree/main/examples/templates/kubernetes) template, `coderd` will consume roughly 8 cores per 30 concurrent workspace builds. For effective provisioning, our helm chart prefers to schedule [one coderd replica per-node](https://github.com/coder/coder/blob/main/helm/values.yaml#L110-L121).
43
+
Workspace builds are CPU-intensive, as it relies on Terraform. Various [Terraform providers](https://registry.terraform.io/browse/providers) have different resource requirements.
44
+
When tested with our [kubernetes](https://github.com/coder/coder/tree/main/examples/templates/kubernetes) template, `coderd` will consume roughly 0.25 cores per concurrent workspace build.
45
+
For effective provisioning, our helm chart prefers to schedule [one coderd replica per-node](https://github.com/coder/coder/blob/main/helm/values.yaml#L110-L121).
23
46
24
-
To support 120 concurrent workspace builds, for example:
47
+
We recommend:
48
+
49
+
- Running `coderd` on a dedicated set of nodes. This will prevent other workloads from interfering with workspace builds. You can use [node selectors](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector), or [taints and tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) to achieve this.
50
+
- Disabling autoscaling for `coderd` nodes. Autoscaling can cause interruptions for users, see [Autoscaling](#autoscaling) for more details.
51
+
- (Enterprise-only) Running external provisioners instead of Coder's built-in provisioners (`CODER_PROVISIONER_DAEMONS=0`) will separate the load caused by workspace provisioning on the `coderd` nodes. For more details, see [External provisioners](../admin/provisioners.md#running-external-provisioners).
52
+
- Alternatively, if increasing the number of integrated provisioner daemons in `coderd` (`CODER_PROVISIONER_DAEMONS>3`), allocate additional resources to `coderd` to compensate (approx. 0.25 cores and 256 MB per provisioner daemon).
53
+
54
+
For example, to support 120 concurrent workspace builds:
25
55
26
56
- Create a cluster/nodepool with 4 nodes, 8-core each (AWS: `t3.2xlarge` GCP: `e2-highcpu-8`)
27
57
- Run coderd with 4 replicas, 30 provisioner daemons each. (`CODER_PROVISIONER_DAEMONS=30`)
28
58
- Ensure Coder's [PostgreSQL server](./configure.md#postgresql-database) can use up to 2 cores and 4 GB RAM
29
59
30
60
## Recent scale tests
31
61
32
-
| Environment | Users | Concurrent builds | Concurrent connections (Terminal/SSH) | Coder Version | Last tested |
Since Coder's performance is highly dependent on the templates and workflows you support, we recommend using our scale testing utility against your own environments.
72
+
Since Coder's performance is highly dependent on the templates and workflows you support, you may wish to use our internal scale testing utility against your own environments.
73
+
74
+
> Note: This utility is intended for internal use only. It is not subject to any compatibility guarantees, and may cause interruptions for your users.
75
+
> To avoid potential outages and orphaned resources, we recommend running scale tests on a secondary "staging" environment.
76
+
> Run it against a production environment at your own risk.
77
+
78
+
### Workspace Creation
40
79
41
80
The following command will run our scale test against your own Coder deployment. You can also specify a template name and any parameter values.
42
81
43
82
```sh
44
-
coder scaletest create-workspaces \
83
+
coder exp scaletest create-workspaces \
45
84
--count 1000 \
46
85
--template "kubernetes" \
47
86
--concurrency 0 \
48
87
--cleanup-concurrency 0 \
49
88
--parameter "home_disk_size=10" \
50
89
--run-command "sleep 2 && echo hello"
51
90
52
-
# Run `coder scaletest create-workspaces --help` for all usage
91
+
# Run `coder exp scaletest create-workspaces --help` for all usage
53
92
```
54
93
55
-
> To avoid potential outages and orphaned resources, we recommend running scale tests on a secondary "staging" environment.
56
-
57
94
The test does the following:
58
95
59
96
1. create `1000` workspaces
@@ -64,6 +101,32 @@ The test does the following:
64
101
65
102
Concurrency is configurable. `concurrency 0` means the scaletest test will attempt to create & connect to all workspaces immediately.
66
103
104
+
If you wish to leave the workspaces running for a period of time, you can specify `--no-cleanup` to skip the cleanup step.
105
+
You are responsible for deleting these resources later.
106
+
107
+
### Traffic Generation
108
+
109
+
Given an existing set of workspaces created previously with `create-workspaces`, the following command will generate traffic similar to that of Coder's web terminal against those workspaces.
110
+
111
+
```sh
112
+
coder exp scaletest workspace-traffic \
113
+
--byes-per-tick 128 \
114
+
--tick-interval 100ms \
115
+
--concurrency 0
116
+
```
117
+
118
+
To generate SSH traffic, add the `--ssh` flag.
119
+
120
+
### Cleanup
121
+
122
+
The scaletest utility will attempt to clean up all workspaces it creates. If you wish to clean up all workspaces, you can run the following command:
123
+
124
+
```sh
125
+
coder exp scaletest cleanup
126
+
```
127
+
128
+
This will delete all workspaces and users with the prefix `scaletest-`.
129
+
67
130
## Autoscaling
68
131
69
132
We generally do not recommend using an autoscaler that modifies the number of coderd replicas. In particular, scale
0 commit comments