🤖 perf: pool members read GET /api/v2/users/me on every workspace read, doubling the request budget

未关闭
#443 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
65/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
go, kubernetes

调研方向

Start in internal/controller/coderworkspacepoolmember_ready.go at readPoolMemberWorkspace and confirmPoolMemberCreate to see the per-member GET /api/v2/users/me call. Cache the operator user ID keyed by the token Secret's resourceVersion, preserving provenance checks, then update the measured table in docs/how-to/workspace-pools.md. Done means member reads no longer call /api/v2/users/me and request counts match the plan budget.

由索引模型根据 Issue 内容生成。

描述

Problem

Measured in Kind with Coder v2.37.2 while working on #441 (#153 plan PR 12): a pool of 10 ready members makes 26 Coder requests per minute. Plan section 9 budgets at most 13.

Each member read sends two requests: GET /api/v2/workspaces/<id> and GET /api/v2/users/me (readPoolMemberWorkspace and confirmPoolMemberCreate in internal/controller/coderworkspacepoolmember_ready.go). So a ready member makes 2 requests per minute and a member that builds makes 24 instead of 12. The pool adds 6 per minute.

/api/v2/users/me is one path for every member of the operator, and Coder rate-limits per user and per path (512 per minute by default, coderd/httpmw/ratelimit.go keyByNormalizedEndpoint). From the measured rates, about 500 ready members or about 40 members that build reach that limit (inferred, not tested at that size).

Proposal

Read the operator user once per operator token (for example, cache the ID keyed by the token Secret's resourceVersion) instead of once per member read, and keep the provenance checks that use it. Then update the measured table in docs/how-to/workspace-pools.md.

Trigger

Before pools are recommended for more than a few dozen members, or together with #153 plan PR 13.

Refs #153


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh

主要语言
Go
星标
5
派生
3
平均合并
1 小时 50 分钟
30 天内合并 PR
160

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

coder/coder-k8s 的其他 Issue

查看 coder/coder-k8s 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。