Plan preview request routing scans all active pipeds
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
- #7088 @rootp1 による — マージされずにクローズ
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- go
- 領域
- api, performance
調査の方向性
pkg/app/server/grpcapi/api.go の API.RequestPlanPreview から始め、pipedStore.List の呼び出しと repository-matching ループを調べます。少数および多数の piped 数を対象とするベンチマークを追加し、その後、繰り返しのリクエストに対して、対象を絞った検索、インデックス、または上限付きキャッシュを評価します。複数の piped が一致する場合にも正しい結果を維持しながら、繰り返しのルーティングでアクティブな piped の全スキャンを回避できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
What happened:
RequestPlanPreview currently lists all enabled pipeds in the project and scans every configured repository entry in memory to find pipeds that match the requested repository remote and base branch. This makes each interactive plan preview request scale with total active piped count and repository mappings instead of the number of matching pipeds.
Summary
Plan preview request routing performs an O(number of pipeds x repositories per piped) in-memory scan for every request.
Affected Area
pkg/app/server/grpcapi/api.go, specifically API.RequestPlanPreview.
Steps to Reproduce
- Create a test or benchmark environment with many active pipeds in one project and repository mappings on those pipeds.
- Call
API.RequestPlanPreviewrepeatedly for one repository remote and base branch. - Capture allocations and latency with
go test -benchor pprof. - Observe that request cost grows with total piped count rather than with the matching pipeds.
What you expected to happen:
Plan preview routing should avoid a full active-piped scan on every request. Repeated routing for a repository/base-branch pair should be close to O(matches), for example via an index, bounded cache, or targeted lookup.
Expected Behaviour
Routing a plan preview request should avoid repeated full scans and should keep behavior correct when multiple pipeds match the same repository and branch.
How to reproduce it:
- Seed or mock thousands of enabled pipeds for one project.
- Give only a subset a repository entry matching the plan preview request remote and base branch.
- Repeatedly call
RequestPlanPreviewfor that remote and branch. - Compare latency/allocations as piped count increases.
Actual Behaviour
Each request calls pipedStore.List with only ProjectId and Disabled=false filters, then iterates through every returned piped and every repository entry until it finds matching mappings.
Technical Evidence
In pkg/app/server/grpcapi/api.go, RequestPlanPreview lists enabled pipeds for the project and then builds a repositories map by checking each p.Repositories entry against req.RepoRemoteUrl and req.BaseBranch. The code also has a TODO noting that caching may be needed to reduce database load.
Suspected Root Cause
The API layer has no repository-to-piped routing index or cache, so it must perform repository matching after fetching all enabled pipeds.
Proposed Direction
Add a focused benchmark for plan preview routing at small and large piped cardinalities, then avoid repeated full scans by adding a bounded cache or another targeted lookup for repository-to-piped matches.
Acceptance Criteria
- A benchmark covering small and large piped counts is added.
- Repeated plan preview routing for the same project/repository/base-branch avoids repeated full active-piped scans.
- Correct behavior is preserved when multiple pipeds match the same repository and branch.
Environment:
pipedversion: Not applicablecontrol-planeversion: Currentmasterbranch- Others: Not applicable
- 主要言語
- Go
- スター
- 1.4k
- フォーク
- 391
- 平均マージ
- 4日 1時間
- マージ済み PR(30日)
- 58
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pipe-cd/pipecd のほかの issue
-
Applications at the repository root are not triggered by new commits対応中かも @Daksha1611 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 2 日以内に返信
-
pipedv1 kubernetes plugins ignore trafficRouting.istio.host in K8S_TRAFFIC_ROUTING対応中かも @Dhirenderchoudhary が今日担当しました。 オープン
難易度 2/5 半日 初心者へのやさしさ 74/100
pipe-cd/pipecd#7626 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信
-
pipectl transfer restore application drops backed-up labels対応中かも @bhavishyajain545 が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
pipe-cd/pipecd#7622 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 2 日以内に返信
似ている issue
-
needs-triage typo
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
llm-d-incubation/llm-d-scaling-manager#122 ·
メンテナーはふだん 1 日以内に返信
-
good first issue severity: low tech-debt
難易度 2/5 半日 初心者へのやさしさ 75/100
TMHSDigital/subenum#329 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] Backend summarize min() / max() panics when a field has no numeric values対応中かも @weng5e が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
grafana/grafana-infinity-datasource#1832 ·
メンテナーはふだん 1 日以内に返信
-
tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
GillMacedo/godebugdiff#13 ·