Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Extremely slow cloning when using large SemVer range

オープン
#1,769 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
go
領域
performance

調査の方向性

まず fluxcd/pkg/git のクローン処理のコードを読み、Issue に記載されている ImagePolicies のタグ抽出の動作と、大きな SemVer 範囲の処理方法を比較します。大きな範囲と報告されている少ないタグ数を使用する GitRepository で不一致を再現し、その後 source-controller の CPU 使用率をプロファイルします。完了条件は、GitRepositories の SemVer パターン抽出をサポートするか、範囲比較のボトルネックを特定して解消することです。

索引モデルが issue の本文から書いたものです。

説明

Some info to set the stage:

  1. We use a monorepo style structure
  2. GitRepositories do not support parsing and extracting tags like ImagePolicies
    • you can parse+extract SemVer in OCI tags like my-app-v1.2.3 => 1.2.3
    • you must use exclusively plain SemVer tags for GitRepositories
  3. To get around this deficiency, we've allocated chunks of major SemVer git tags to projects in the repo.
    • project-1 gets 0.0.0 -> 999999.x.x
    • project-2 gets 1000000.0.0 -> 1999999.x.x
    • ...

This means when a team wants to deploy a dev version of kustomizations that control their app, it ends up looking something like this:

---
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
  name: project-1-dev
  namespace: flux-system
spec:
  interval: 1m0s
  ref:
    semver: '>=1000000 <2000000'
  secretRef:
    name: example-ssh-key
  url: ssh://[email protected]/owner/monorepo.git

This has been working very well for a long time, but there is a huge performance problem when the SemVar range is that big. I want to be clear, projects do not actually use that many tags (as writing, the most I see is ~60 majors).

Here is a graph of the enormous performance discrepancy:
Image
In the graph you can see that dev cloning is 50-75x slower and this project in particular only has 49 tags. On top of this it also causes relatively high CPU usage from the source-controller pod.

Potential solutions (in order of preference)
  1. Allow SemVer pattern extractions like ImagePolicies. This way we don't have to (ab)use git tags like this.
  2. Figure out why it takes so long to compare SemVer tags. I looked around in fluxcd/pkg/git but nothing in the cloning code stood out to me.
主要言語
Go
スター
283
フォーク
258
平均マージ
1日 17時間
マージ済み PR(30日)
15

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fluxcd/source-controller のほかの issue

fluxcd/source-controller の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。