Skip to content

Commit 4fc7143

Browse files
committed
command
1 parent 03279ae commit 4fc7143

File tree

1 file changed

+57
-35
lines changed

1 file changed

+57
-35
lines changed

docs/admin/scale.md

Lines changed: 57 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ Learn more about [Coder’s architecture](../about/architecture.md) and our
1010
## Recent scale tests
1111

1212
> Note: the below information is for reference purposes only, and are not
13-
> intended to be used as guidelines for infrastructure sizing.
13+
> intended to be used as guidelines for infrastructure sizing. Review the
14+
> [Reference Architectures](architectures/index.md) for hardware sizing
15+
> recommendations.
1416
1517
| Environment | Coder CPU | Coder RAM | Coder Replicas | Database | Users | Concurrent builds | Concurrent connections (Terminal/SSH) | Coder Version | Last tested |
1618
| ---------------- | --------- | --------- | -------------- | ----------------- | ----- | ----------------- | ------------------------------------- | ------------- | ------------ |
@@ -29,66 +31,86 @@ Since Coder's performance is highly dependent on the templates and workflows you
2931
support, you may wish to use our internal scale testing utility against your own
3032
environments.
3133

32-
> Note: This utility is intended for internal use only. It is not subject to any
33-
> compatibility guarantees, and may cause interruptions for your users. To avoid
34-
> potential outages and orphaned resources, we recommend running scale tests on
35-
> a secondary "staging" environment. Run it against a production environment at
36-
> your own risk.
34+
> Note: This utility is experimental. It is not subject to any compatibility
35+
> guarantees, and may cause interruptions for your users. To avoid potential
36+
> outages and orphaned resources, we recommend running scale tests on a
37+
> secondary "staging" environment or a dedicated
38+
> [Kubernetes playground cluster](https://github.com/coder/coder/tree/main/scaletest/templates).
39+
> Run it against a production environment at your own risk.
3740
38-
### Workspace Creation
41+
### Create workspaces
3942

40-
The following command will run our scale test against your own Coder deployment.
41-
You can also specify a template name and any parameter values.
43+
The following command will provision a number of Coder workspaces using the
44+
specified template and extra parameters.
4245

4346
```shell
4447
coder exp scaletest create-workspaces \
45-
--count 1000 \
46-
--template "kubernetes" \
47-
--concurrency 0 \
48-
--cleanup-concurrency 0 \
49-
--parameter "home_disk_size=10" \
50-
--run-command "sleep 2 && echo hello"
48+
--retry 5 \
49+
--count "${SCALETEST_PARAM_NUM_WORKSPACES}" \
50+
--template "${SCALETEST_PARAM_TEMPLATE}" \
51+
--concurrency "${SCALETEST_PARAM_CREATE_CONCURRENCY}" \
52+
--timeout 5h \
53+
--job-timeout 5h \
54+
--no-cleanup \
55+
--output json:"${SCALETEST_RESULTS_DIR}/create-workspaces.json"
5156

5257
# Run `coder exp scaletest create-workspaces --help` for all usage
5358
```
5459

55-
The test does the following:
60+
The command does the following:
5661

57-
1. create `1000` workspaces
58-
1. establish SSH connection to each workspace
59-
1. run `sleep 3 && echo hello` on each workspace via the web terminal
60-
1. close connections, attempt to delete all workspaces
61-
1. return results (e.g. `998 succeeded, 2 failed to connect`)
62-
63-
Concurrency is configurable. `concurrency 0` means the scaletest test will
64-
attempt to create & connect to all workspaces immediately.
65-
66-
If you wish to leave the workspaces running for a period of time, you can
67-
specify `--no-cleanup` to skip the cleanup step. You are responsible for
68-
deleting these resources later.
62+
1. Create `${SCALETEST_PARAM_NUM_WORKSPACES}` workspaces concurrently
63+
(concurrency level: `${SCALETEST_PARAM_CREATE_CONCURRENCY}`) using the
64+
template `${SCALETEST_PARAM_TEMPLATE}`.
65+
1. Leave workspaces running to use in next steps (`--no-cleanup` option).
66+
1. Store provisioning results in JSON format.
67+
1. If you don't want the creation process to be interrupted by any errors, use
68+
the `--retry 5` flag.
6969

7070
### Traffic Generation
7171

7272
Given an existing set of workspaces created previously with `create-workspaces`,
73-
the following command will generate traffic similar to that of Coder's web
74-
terminal against those workspaces.
73+
the following command will generate traffic similar to that of Coder's Web
74+
Terminal against those workspaces.
7575

7676
```shell
77+
# Produce load at about 1000MB/s (25MB/40ms).
7778
coder exp scaletest workspace-traffic \
78-
--byes-per-tick 128 \
79-
--tick-interval 100ms \
80-
--concurrency 0
79+
--template "${SCALETEST_PARAM_GREEDY_AGENT_TEMPLATE}" \
80+
--bytes-per-tick $((1024 * 1024 * 25)) \
81+
--tick-interval 40ms \
82+
--timeout "$((delay))s" \
83+
--job-timeout "$((delay))s" \
84+
--scaletest-prometheus-address 0.0.0.0:21113 \
85+
--target-workspaces "0:100" \
86+
--trace=false \
87+
--output json:"${SCALETEST_RESULTS_DIR}/traffic-${type}-greedy-agent.json"
8188
```
8289

83-
To generate SSH traffic, add the `--ssh` flag.
90+
Traffic generation can be parametrized:
91+
92+
1. Send `bytes-per-tick` every `tick-interval`.
93+
1. Enable tracing for performance debugging.
94+
1. Target a range of workspaces with `--target-workspaces 0:100`.
95+
1. For dashboard traffic: Target a range of users with `--target-users 0:100`.
96+
1. Store provisioning results in JSON format.
97+
98+
The `workspace-traffic` supports also other modes - SSH traffic, workspace app:
99+
100+
1. For SSH traffic: Use `--ssh` flag to generate SSH traffic instead of Web
101+
Terminal.
102+
1. For workspace app traffic: Use `--app [wsdi|wsec|wsra]` flag to select app
103+
behavior. (modes: _WebSocket discard_, _WebSocket echo_, _WebSocket read_).
84104

85105
### Cleanup
86106

87107
The scaletest utility will attempt to clean up all workspaces it creates. If you
88108
wish to clean up all workspaces, you can run the following command:
89109

90110
```shell
91-
coder exp scaletest cleanup
111+
coder exp scaletest cleanup \
112+
--cleanup-job-timeout 2h \
113+
--cleanup-timeout 15min
92114
```
93115

94116
This will delete all workspaces and users with the prefix `scaletest-`.

0 commit comments

Comments
 (0)