Skip to content

Authenticating with an Agent token is very expensive at scale #21335

@spikecurtis

Description

@spikecurtis

When we run scale tests that hit the /api/v2/workspaceagents/me/app-status endpoint, the vast majority of DB query time is used just authenticating the request with the agent token.

Image

The top query is GetWorkspaceAgentAndLatestBuildByAuthToken which is called from httpmw.ExtractWorkspaceAgentAndLatestBuild every time we patch the app status.

The query takes 4ms in our tests, but has no sequential scans.

Image

It does involve a lot of joins, so one avenue to improving could be to denormalize some of the tables involved.

Caching the authentication, or moving the updates to the existing workspace Agent API (which maintains a long-lived websocket) could also help.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions