Reduce stage log Put allocation overhead in filestore persistence
メンテナーはふだん 2 日以内に返信
評価
調査の方向性
pkg/app/server/stagelogstore/filestore.go から始め、65-82 行付近の stageLogFileStore.Put と、そのパフォーマンス TODO を読みます。issue に記載された、増加する lf.Blocks を対象とする集中的なベンチマークを追加し、その後、既存の読み取り動作を確認しながらアロケーションと書き込みコストを比較します。測定可能な改善があり、行区切り形式と EOL マーカーが維持され、無関係な動作の変更がないことが完了の条件です。
索引モデルが issue の本文から書いたものです。
説明
What happened:
Summary
stageLogFileStore.Put rewrites the entire stage-log fragment on every save by JSON-encoding each LogBlock into a fresh in-memory buffer and then writing the full byte slice to the filestore. The code already carries a TODO for this hot path, and the current implementation scales allocations and latency with total block count on every write.
Affected Area
pkg/app/server/stagelogstore/filestore.go- stage log persistence in the control plane filestore path
What you expected to happen:
Large or frequently updated stage logs should be persisted with lower peak allocation overhead and an encoding path that does not materialize avoidable intermediate payloads for every block.
How to reproduce it:
- Open
pkg/app/server/stagelogstore/filestore.go. - Inspect
stageLogFileStore.Putaround the existing performance TODO. - Note that each call loops over all
lf.Blocks, marshals each block individually, appends it to abytes.Buffer, and finally callsfilestore.Putwith the complete byte slice. - Add a focused benchmark that grows
lf.Blocksand repeatedly callsPut. - Observe allocation count and write cost grow with total block count because the full fragment is rebuilt for every save.
Environment:
pipedversion: repository checkout on 2026-07-13control-planeversion: repository checkout on 2026-07-13- Others: validated by current code inspection; previous related issue
#40was closed as stale, not fixed
Technical Evidence
pkg/app/server/stagelogstore/filestore.go:65-82rebuilds the payload in memory for everyPut- The code includes
TODO: Reduce the number of marshaling log blocks for improving performance - Upstream issue
#40tracked the same performance concern but was auto-closed as stale without an implementation change
Suspected Root Cause
The filestore path is implemented as full-object persistence, and Put currently uses per-block json.Marshal calls plus a whole-fragment buffer build before every write.
Proposed Direction
Start with a benchmark for realistic stage-log sizes, then refactor the write path to stream JSON encoding into the final buffer or otherwise reduce avoidable intermediate allocations while preserving the existing line-delimited on-disk format and EOL completion marker.
Acceptance Criteria
- A benchmark captures baseline throughput and allocations for larger stage-log fragments
- The write path measurably reduces allocations or latency compared with the current implementation
- Existing read compatibility for stored stage logs is preserved
- No unrelated stage-log behavior changes are introduced
- 主要言語
- 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 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
pipe-cd/pipecd#7622 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 2 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
docker-compose: postgres healthcheck should probe TCP (pg_isready -h localhost)対応中かも @zezo-mohamed22 が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
OneBusAway/watchdog#305 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
self-care self-care:agent-discoverability
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
githubnext/gh-cao#20928 ·
メンテナーはふだん 1 日以内に返信
-
automation documentation
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
SocialGouv/iterion#3287 ·
メンテナーはふだん 1 日以内に返信