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

Đang mở
#443 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
65/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, kubernetes

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Go
Star
5
Fork
3
Merge trung bình
1 giờ 50 phút
Pull request đã merge (30 ngày)
160

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của coder/coder-k8s

Tất cả issue của coder/coder-k8s

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.