Skip to content

Add configurable MaxConcurrentReconciles for CHK controller#2033

Open
miguel-signoz wants to merge 1 commit into
Altinity:0.27.2from
miguel-signoz:0.27.2-chk-concurrent-reconciles
Open

Add configurable MaxConcurrentReconciles for CHK controller#2033
miguel-signoz wants to merge 1 commit into
Altinity:0.27.2from
miguel-signoz:0.27.2-chk-concurrent-reconciles

Conversation

@miguel-signoz

Copy link
Copy Markdown

Summary

Adds a reconcileCHKsThreadsNumber config option to control the number of concurrent ClickHouseKeeperInstallation reconciliations.

The CHK controller currently uses controller-runtime's default MaxConcurrentReconciles=1, meaning all CHK resources are reconciled serially. This becomes a significant bottleneck at scale — with 1,000+ CHK resources and ~30-40 seconds per reconciliation (due to force restarts and hardcoded sleeps), a full reconciliation cycle takes 9-12 hours. During this time, newly created CHK resources are added to the back of the FIFO queue and can wait hours before the operator begins reconciling them.

The new setting mirrors the existing reconcileCHIsThreadsNumber for CHI resources. Defaults to 1 to preserve existing behavior.

Changes

  • cmd/operator/app/thread_keeper.go: Add .WithOptions(controller.Options{MaxConcurrentReconciles: ...}) to the controller-runtime builder chain
  • pkg/apis/clickhouse.altinity.com/v1/type_configuration_chop.go: Add ReconcileCHKsThreadsNumber field to OperatorConfigReconcileRuntime struct, default constant, and normalization logic

Config YAML

reconcile:
  runtime:
    reconcileCHIsThreadsNumber: 10
    reconcileCHKsThreadsNumber: 10  # <-- new
    reconcileShardsThreadsNumber: 5
    reconcileShardsMaxConcurrencyPercent: 50

Closes #2032

Signed-off-by: miguel-signoz miguel@signoz.io

@sunsingerus sunsingerus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full cycle with CRD modification is needed as well

Add reconcileCHKsThreadsNumber config option to control the number of
concurrent ClickHouseKeeperInstallation reconciliations. Previously
hardcoded to 1 via controller-runtime defaults, this caused a
significant bottleneck at scale when many CHK resources needed
reconciliation simultaneously.

The new setting mirrors the existing reconcileCHIsThreadsNumber for CHI
resources. Defaults to 1 to preserve existing behavior.

Closes Altinity#2032

Signed-off-by: miguel-signoz <miguel@signoz.io>
@miguel-signoz miguel-signoz force-pushed the 0.27.2-chk-concurrent-reconciles branch from 858ed9d to 09d6b17 Compare July 7, 2026 13:47
@miguel-signoz

Copy link
Copy Markdown
Author

@sunsingerus

Updated added reconcileCHKsThreadsNumber to CRD schemas, config files, helm values, and JSON schema across all deploy targets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants