Description
Some of our users have templates with a long time to provision (e.g. Kubernetes clusters, OpenStack VMs, etc.) or large startup scripts / git clones
that take 30+ minutes.
Overview
For users with templates with long-running scripts to initialize, this should allow starts to become near-instant. This does not speed up the provisioning of ephemeral resources (e.g. pods, containers, VMs).
This will also make Coder workspaces more useful for workspaces per-branch or per-PR as the start time is much faster
Improving build performance
In parallel, we are also working on making it easier to profile workspace start/stop time so template admins can understand how to optimize. While we've had prometheus metrics on start times, for a while we'll be adding API endpoints and a UI view for viewing resource provisioning time and script execution time (#14773):
We'll also write up some docs on optimizing build performance: #14858
References
Prior art: #9611
From: @ggjulio:
CDEs with a
Prebuilds
feature provides a way to use their workspaces as short-lived/ephemeral environnement on large/complex repositories.Coder's closest way of achieving something similar is through
startup scripts
, which is fine for small code base. But it doesn't works well for large repositories.As far as I know, there is currently 3 CDEs implementing it:
- Codespaces: https://docs.github.com/en/codespaces/prebuilding-your-codespaces
- Gitpod: https://www.gitpod.io/docs/configure/projects/prebuilds
- Hocus: https://hocus.dev/docs/prebuilds/
It usually works by building the main branches, (let's say the
main/master
branch) The "output" is stored and then any users can get a fresh workspace from it. Prebuilds are linked to the commit hash they have been built with.Theses fresh workspaces may contain:
- Object / bytecode files, final binaries / artefacts
- Any dependencies such as libraries/modules, container images, etc
- Debug related files -> symbols/map files, etc...
- Indexes/Caches from developer's tools
- ?
From the 3 CDE above, a prebuild may be triggered via:
- push/merge
- Scheduled
- Manual trigger
- On file change (like devcontainer.json)
- Every N commits
- ?
Why Prebuilds are worth to be implemented
The inability of using short lived/ephemeral workspaces on large repos have several impacts :
- Long lived workspaces may drift and result in "works on my machine" issues.
- Context switching takes time (reviewing PR, hotfix an issue, etc)
- ?
Large companies tend to have large and complex repositories. Implementing it may help them significantly reduce time spent on the two issues above.
Could also:
- Reduce resources consumption peaks (avoiding N builds by N developers when their workspaces starts)
- ?
Implementation ?
All CDEs above currently supports only one isolation model and/or infrastructure. Coder doesn't make any assumptions on neither of the infra or isolation model. Which could make it hard for coder to implement such a feature.
What are you thoughts about it ?
Resources: