-
Notifications
You must be signed in to change notification settings - Fork 956
Closed
Labels
need-backendIssues that need backend workIssues that need backend workneeds-rfcIssues that needs an RFC due to an expansive scope and unclear implementation path.Issues that needs an RFC due to an expansive scope and unclear implementation path.
Description
Motivation
The autobuild/
package periodically queries for workspaces that are eligible for a state transition via GetWorkspacesEligibleForTransition
.
This is run every CODER_AUTOBUILD_POLL_INTERVAL
, which defaults to 1 minute.
This would probably be OK if that were all it did, but it also kicks off a bunch of other queries per workspace in the result set:
GetWorkspaceByID
GetUserByID
GetLatestWorkspaceBuildByWorkspaceID
GetProvisionerJobByID
GetTemplateByID
GetTemplateVersionByID
GetTemplateAccessControl
This can cause significant database load with multiple Coder instances and/or large numbers of workspaces.
Solutions
a) Instead of periodically querying, move to an event-based approach based on the next time we know we need to start a workspace.
b) Keep the existing timer-based approach but optimize the query.
c) Only have one replica running the autobuild query at a time.
stirby and aaronlehmann
Metadata
Metadata
Assignees
Labels
need-backendIssues that need backend workIssues that need backend workneeds-rfcIssues that needs an RFC due to an expansive scope and unclear implementation path.Issues that needs an RFC due to an expansive scope and unclear implementation path.