Files
coder/docs/templates
Nick Vigilanteandcoder[bot] 7340da6380 docs: add guidance for high-concurrency prebuilt workspace claims (#31991)
Adds a **Prepare for high-concurrency claims** section to the prebuilt
workspaces page. It covers what admins should do when many developers
create workspaces from the same preset at once, such as a training
session or onboarding day:

- Before the event: size the pool with headroom, give it time to fill,
confirm `eligible` matches `desired`, and raise
`CODER_PG_CONN_MAX_OPEN`.
- During the event: don't publish template versions, invalidate presets,
or lower `instances`; retry `409 Conflict` from API clients with jitter;
watch the claim metrics.

Also adds a short note to **Template updates and the prebuilt workspace
lifecycle**: until the new version's prebuilds are eligible, new
workspaces are built from scratch.

## Verified against code

- Pool exhaustion falls back to a normal build (`coderd/workspaces.go`,
`ErrNoClaimablePrebuiltWorkspaces`).
- `409` comes from `wsbuilder` (`http.StatusConflict`, "A workspace
build is already active.").
- `CODER_PG_CONN_MAX_OPEN` default is `10` (server CLI reference).
- Prebuild metrics carry `template_name`, `preset_name`, and
`organization_name` labels
(`enterprise/coderd/prebuilds/metricscollector.go`).

## Needs engineering confirmation before merge

- [ ] The 20 to 30 percent headroom recommendation
- [ ] Retry delay of 1 to 2 seconds with jitter
- [ ] Whether to publish a recommended `CODER_PG_CONN_MAX_OPEN` range
(field guidance was about 50 to 100 per replica; left out of the page
until confirmed)
- [ ] The line that a claim in progress can fail if its prebuild is
deleted (known limitation noted in #31518; included as configure-around
guidance per the content guidelines' bug exception)

## Intentionally left out

- "Upgrade to v2.38.5 / v2.39.0+" for the concurrent-claim fix (#31518).
That's version history, so per the content guidelines it belongs in the
changelog or a Support KB article, not this page.

Linear: DOCS-1729


Supersedes #31944, reopened under a human author for attribution.

Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
2026-11-12 13:31:16 -05:00
..