Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 02d0650

Browse files
docs: add new scaling doc to best practices section (#15904)
[preview](https://coder.com/docs/@bp-scaling-coder/tutorials/best-practices/scale-coder) --------- Co-authored-by: Spike Curtis <[email protected]>
1 parent 0fa6b3d commit 02d0650

File tree

4 files changed

+393
-39
lines changed

4 files changed

+393
-39
lines changed

docs/admin/infrastructure/scale-testing.md

+21-16
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,37 @@ without compromising service. This process encompasses infrastructure setup,
55
traffic projections, and aggressive testing to identify and mitigate potential
66
bottlenecks.
77

8-
A dedicated Kubernetes cluster for Coder is recommended to configure, host and
8+
A dedicated Kubernetes cluster for Coder is recommended to configure, host, and
99
manage Coder workloads. Kubernetes provides container orchestration
1010
capabilities, allowing Coder to efficiently deploy, scale, and manage workspaces
1111
across a distributed infrastructure. This ensures high availability, fault
1212
tolerance, and scalability for Coder deployments. Coder is deployed on this
1313
cluster using the
1414
[Helm chart](../../install/kubernetes.md#4-install-coder-with-helm).
1515

16+
For more information about scaling, see our [Coder scaling best practices](../../tutorials/best-practices/scale-coder.md).
17+
1618
## Methodology
1719

1820
Our scale tests include the following stages:
1921

2022
1. Prepare environment: create expected users and provision workspaces.
2123

22-
2. SSH connections: establish user connections with agents, verifying their
24+
1. SSH connections: establish user connections with agents, verifying their
2325
ability to echo back received content.
2426

25-
3. Web Terminal: verify the PTY connection used for communication with Web
27+
1. Web Terminal: verify the PTY connection used for communication with Web
2628
Terminal.
2729

28-
4. Workspace application traffic: assess the handling of user connections with
30+
1. Workspace application traffic: assess the handling of user connections with
2931
specific workspace apps, confirming their capability to echo back received
3032
content effectively.
3133

32-
5. Dashboard evaluation: verify the responsiveness and stability of Coder
34+
1. Dashboard evaluation: verify the responsiveness and stability of Coder
3335
dashboards under varying load conditions. This is achieved by simulating user
3436
interactions using instances of headless Chromium browsers.
3537

36-
6. Cleanup: delete workspaces and users created in step 1.
38+
1. Cleanup: delete workspaces and users created in step 1.
3739

3840
## Infrastructure and setup requirements
3941

@@ -54,13 +56,16 @@ channel for IDEs with VS Code and JetBrains plugins.
5456
The basic setup of scale tests environment involves:
5557

5658
1. Scale tests runner (32 vCPU, 128 GB RAM)
57-
2. Coder: 2 replicas (4 vCPU, 16 GB RAM)
58-
3. Database: 1 instance (2 vCPU, 32 GB RAM)
59-
4. Provisioner: 50 instances (0.5 vCPU, 512 MB RAM)
59+
1. Coder: 2 replicas (4 vCPU, 16 GB RAM)
60+
1. Database: 1 instance (2 vCPU, 32 GB RAM)
61+
1. Provisioner: 50 instances (0.5 vCPU, 512 MB RAM)
62+
63+
The test is deemed successful if:
6064

61-
The test is deemed successful if users did not experience interruptions in their
62-
workflows, `coderd` did not crash or require restarts, and no other internal
63-
errors were observed.
65+
- Users did not experience interruptions in their
66+
workflows,
67+
- `coderd` did not crash or require restarts, and
68+
- No other internal errors were observed.
6469

6570
## Traffic Projections
6671

@@ -90,11 +95,11 @@ Database:
9095

9196
## Available reference architectures
9297

93-
[Up to 1,000 users](./validated-architectures/1k-users.md)
98+
- [Up to 1,000 users](./validated-architectures/1k-users.md)
9499

95-
[Up to 2,000 users](./validated-architectures/2k-users.md)
100+
- [Up to 2,000 users](./validated-architectures/2k-users.md)
96101

97-
[Up to 3,000 users](./validated-architectures/3k-users.md)
102+
- [Up to 3,000 users](./validated-architectures/3k-users.md)
98103

99104
## Hardware recommendation
100105

@@ -107,7 +112,7 @@ guidance on optimal configurations. A reasonable approach involves using scaling
107112
formulas based on factors like CPU, memory, and the number of users.
108113

109114
While the minimum requirements specify 1 CPU core and 2 GB of memory per
110-
`coderd` replica, it is recommended to allocate additional resources depending
115+
`coderd` replica, we recommend that you allocate additional resources depending
111116
on the workload size to ensure deployment stability.
112117

113118
#### CPU and memory usage

docs/admin/infrastructure/scale-utility.md

+35-18
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
# Scale Tests and Utilities
22

3-
We scale-test Coder with [a built-in utility](#scale-testing-utility) that can
3+
We scale-test Coder with a built-in utility that can
44
be used in your environment for insights into how Coder scales with your
5-
infrastructure. For scale-testing Kubernetes clusters we recommend to install
5+
infrastructure. For scale-testing Kubernetes clusters we recommend that you install
66
and use the dedicated Coder template,
77
[scaletest-runner](https://github.com/coder/coder/tree/main/scaletest/templates/scaletest-runner).
88

99
Learn more about [Coder’s architecture](./architecture.md) and our
1010
[scale-testing methodology](./scale-testing.md).
1111

12+
For more information about scaling, see our [Coder scaling best practices](../../tutorials/best-practices/scale-coder.md).
13+
1214
## Recent scale tests
1315

14-
> Note: the below information is for reference purposes only, and are not
15-
> intended to be used as guidelines for infrastructure sizing. Review the
16-
> [Reference Architectures](./validated-architectures/index.md#node-sizing) for
17-
> hardware sizing recommendations.
16+
The information in this doc is for reference purposes only, and is not intended
17+
to be used as guidelines for infrastructure sizing.
18+
19+
Review the [Reference Architectures](./validated-architectures/index.md#node-sizing) for
20+
hardware sizing recommendations.
1821

1922
| Environment | Coder CPU | Coder RAM | Coder Replicas | Database | Users | Concurrent builds | Concurrent connections (Terminal/SSH) | Coder Version | Last tested |
2023
|------------------|-----------|-----------|----------------|-------------------|-------|-------------------|---------------------------------------|---------------|--------------|
@@ -25,26 +28,32 @@ Learn more about [Coder’s architecture](./architecture.md) and our
2528
| Kubernetes (GKE) | 4 cores | 16 GB | 2 | db-custom-8-30720 | 2000 | 50 | 2000 simulated | `v2.8.4` | Feb 28, 2024 |
2629
| Kubernetes (GKE) | 2 cores | 4 GB | 2 | db-custom-2-7680 | 1000 | 50 | 1000 simulated | `v2.10.2` | Apr 26, 2024 |
2730

28-
> Note: a simulated connection reads and writes random data at 40KB/s per
29-
> connection.
31+
> Note: A simulated connection reads and writes random data at 40KB/s per connection.
3032
3133
## Scale testing utility
3234

3335
Since Coder's performance is highly dependent on the templates and workflows you
3436
support, you may wish to use our internal scale testing utility against your own
3537
environments.
3638

37-
> Note: This utility is experimental. It is not subject to any compatibility
38-
> guarantees, and may cause interruptions for your users. To avoid potential
39-
> outages and orphaned resources, we recommend running scale tests on a
40-
> secondary "staging" environment or a dedicated
41-
> [Kubernetes playground cluster](https://github.com/coder/coder/tree/main/scaletest/terraform).
42-
> Run it against a production environment at your own risk.
39+
<blockquote class="admonition important">
40+
41+
This utility is experimental.
42+
43+
It is not subject to any compatibility guarantees and may cause interruptions
44+
for your users.
45+
To avoid potential outages and orphaned resources, we recommend that you run
46+
scale tests on a secondary "staging" environment or a dedicated
47+
[Kubernetes playground cluster](https://github.com/coder/coder/tree/main/scaletest/terraform).
48+
49+
Run it against a production environment at your own risk.
50+
51+
</blockquote>
4352

4453
### Create workspaces
4554

4655
The following command will provision a number of Coder workspaces using the
47-
specified template and extra parameters.
56+
specified template and extra parameters:
4857

4958
```shell
5059
coder exp scaletest create-workspaces \
@@ -56,8 +65,6 @@ coder exp scaletest create-workspaces \
5665
--job-timeout 5h \
5766
--no-cleanup \
5867
--output json:"${SCALETEST_RESULTS_DIR}/create-workspaces.json"
59-
60-
# Run `coder exp scaletest create-workspaces --help` for all usage
6168
```
6269

6370
The command does the following:
@@ -70,6 +77,12 @@ The command does the following:
7077
1. If you don't want the creation process to be interrupted by any errors, use
7178
the `--retry 5` flag.
7279

80+
For more built-in `scaletest` options, use the `--help` flag:
81+
82+
```shell
83+
coder exp scaletest create-workspaces --help
84+
```
85+
7386
### Traffic Generation
7487

7588
Given an existing set of workspaces created previously with `create-workspaces`,
@@ -105,7 +118,11 @@ The `workspace-traffic` supports also other modes - SSH traffic, workspace app:
105118
1. For SSH traffic: Use `--ssh` flag to generate SSH traffic instead of Web
106119
Terminal.
107120
1. For workspace app traffic: Use `--app [wsdi|wsec|wsra]` flag to select app
108-
behavior. (modes: _WebSocket discard_, _WebSocket echo_, _WebSocket read_).
121+
behavior.
122+
123+
- `wsdi`: WebSocket discard
124+
- `wsec`: WebSocket echo
125+
- `wsra`: WebSocket read
109126

110127
### Cleanup
111128

docs/manifest.json

+15-5
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,11 @@
243243
"title": "Scaling Utilities",
244244
"description": "Tools to help you scale your deployment",
245245
"path": "./admin/infrastructure/scale-utility.md"
246+
},
247+
{
248+
"title": "Scaling best practices",
249+
"description": "How to prepare a Coder deployment for scale",
250+
"path": "./tutorials/best-practices/scale-coder.md"
246251
}
247252
]
248253
},
@@ -761,16 +766,21 @@
761766
"description": "Guides to help you make the most of your Coder experience",
762767
"path": "./tutorials/best-practices/index.md",
763768
"children": [
764-
{
765-
"title": "Security - best practices",
766-
"description": "Make your Coder deployment more secure",
767-
"path": "./tutorials/best-practices/security-best-practices.md"
768-
},
769769
{
770770
"title": "Organizations - best practices",
771771
"description": "How to make the best use of Coder Organizations",
772772
"path": "./tutorials/best-practices/organizations.md"
773773
},
774+
{
775+
"title": "Scale Coder",
776+
"description": "How to prepare a Coder deployment for scale",
777+
"path": "./tutorials/best-practices/scale-coder.md"
778+
},
779+
{
780+
"title": "Security - best practices",
781+
"description": "Make your Coder deployment more secure",
782+
"path": "./tutorials/best-practices/security-best-practices.md"
783+
},
774784
{
775785
"title": "Speed up your workspaces",
776786
"description": "Speed up your Coder templates and workspaces",

0 commit comments

Comments
 (0)