Skip to content

Commit abab20f

Browse files
committed
expose concurrency knobs as parameters
1 parent 77d575c commit abab20f

File tree

2 files changed

+57
-8
lines changed

2 files changed

+57
-8
lines changed

scaletest/templates/scaletest-runner/main.tf

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,56 @@ data "coder_parameter" "dry_run" {
7171
ephemeral = true
7272
}
7373

74+
data "coder_parameter" "create_concurrency" {
75+
order = 10
76+
type = "number"
77+
name = "Create concurrency"
78+
default = 10
79+
description = "The number of workspaces to create concurrently."
80+
mutable = true
81+
82+
# Setting zero = unlimited, but perhaps not a good idea,
83+
# we can raise this limit instead.
84+
validation {
85+
min = 1
86+
max = 100
87+
}
88+
}
89+
90+
data "coder_parameter" "job_concurrency" {
91+
order = 11
92+
type = "number"
93+
name = "Scaletest job concurrency"
94+
default = 10
95+
description = "The number of concurrent jobs (e.g. when producing workspace traffic)."
96+
mutable = true
97+
98+
# Setting zero = unlimited, but perhaps not a good idea,
99+
# we can raise this limit instead.
100+
validation {
101+
min = 1
102+
max = 100
103+
}
104+
}
105+
106+
data "coder_parameter" "cleanup_concurrency" {
107+
order = 12
108+
type = "number"
109+
name = "Cleanup concurrency"
110+
default = 10
111+
description = "The number of concurrent cleanup jobs."
112+
mutable = true
113+
114+
# Setting zero = unlimited, but perhaps not a good idea,
115+
# we can raise this limit instead.
116+
validation {
117+
min = 1
118+
max = 100
119+
}
120+
}
121+
74122
data "coder_parameter" "workspace_template" {
75-
order = 3
123+
order = 20
76124
name = "workspace_template"
77125
display_name = "Workspace Template"
78126
description = "The template used for workspace creation."
@@ -106,7 +154,7 @@ data "coder_parameter" "workspace_template" {
106154
}
107155

108156
data "coder_parameter" "num_workspaces" {
109-
order = 10
157+
order = 21
110158
type = "number"
111159
name = "Number of workspaces to create"
112160
default = 100
@@ -142,16 +190,20 @@ resource "coder_agent" "main" {
142190
CODER_CONFIG_DIR : "/home/coder/.config/coderv2",
143191
CODER_USER_TOKEN : data.coder_workspace.me.owner_session_token,
144192
CODER_URL : data.coder_workspace.me.access_url,
193+
194+
# Global scaletest envs that may affect each `coder exp scaletest` invocation.
145195
CODER_SCALETEST_PROMETHEUS_ADDRESS : "0.0.0.0:21112",
146196
CODER_SCALETEST_PROMETHEUS_WAIT : "60s",
197+
CODER_SCALETEST_CONCURRENCY : "${data.coder_parameter.job_concurrency.value}",
198+
CODER_SCALETEST_CLEANUP_CONCURRENCY : "${data.coder_parameter.cleanup_concurrency.value}",
147199

200+
# Local envs passed as arguments to `coder exp scaletest` invocations.
148201
SCALETEST_RUN_ID : local.scaletest_run_id,
149202
SCALETEST_RUN_DIR : local.scaletest_run_dir,
150203
SCALETEST_TEMPLATE : data.coder_parameter.workspace_template.value,
151204
SCALETEST_SKIP_CLEANUP : "1",
152205
SCALETEST_NUM_WORKSPACES : data.coder_parameter.num_workspaces.value,
153-
SCALETEST_CREATE_CONCURRENCY : "10",
154-
SCALETEST_CLEANUP_CONCURRENCY : "10",
206+
SCALETEST_CREATE_CONCURRENCY : "${data.coder_parameter.create_concurrency.value}",
155207

156208
SCRIPTS_ZIP : filebase64(data.archive_file.scripts_zip.output_path),
157209
SCRIPTS_DIR : "/tmp/scripts",

scaletest/templates/scaletest-runner/scripts/run.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ touch /tmp/.scaletest_phase_creating_workspaces
2929

3030
coder exp scaletest create-workspaces \
3131
--count "${SCALETEST_NUM_WORKSPACES}" \
32-
--template="${SCALETEST_TEMPLATE}" \
32+
--template "${SCALETEST_TEMPLATE}" \
3333
--concurrency "${SCALETEST_CREATE_CONCURRENCY}" \
3434
--job-timeout 15m \
3535
--no-cleanup \
@@ -44,7 +44,6 @@ coder exp scaletest workspace-traffic \
4444
--ssh \
4545
--bytes-per-tick 10240 \
4646
--tick-interval 1s \
47-
--concurrency 0 \
4847
--timeout 5m \
4948
--output json:"${SCALETEST_RUN_DIR}/result-ssh.json"
5049
show_json "${SCALETEST_RUN_DIR}/result-ssh.json"
@@ -56,7 +55,6 @@ touch /tmp/.scaletest_phase_rpty
5655
coder exp scaletest workspace-traffic \
5756
--bytes-per-tick 10240 \
5857
--tick-interval 1s \
59-
--concurrency 0 \
6058
--timeout 5m \
6159
--output json:"${SCALETEST_RUN_DIR}/result-rpty.json"
6260
show_json "${SCALETEST_RUN_DIR}/result-rpty.json"
@@ -67,7 +65,6 @@ wait_baseline 5
6765
touch /tmp/.scaletest_phase_dashboard
6866
coder exp scaletest dashboard \
6967
--count "${SCALETEST_NUM_WORKSPACES}" \
70-
--concurrency 0 \
7168
--job-timeout 5m \
7269
--output json:"${SCALETEST_RUN_DIR}/result-dashboard.json"
7370
show_json "${SCALETEST_RUN_DIR}/result-dashboard.json"

0 commit comments

Comments
 (0)