Skip to content

fix: bound CPU parallelism for snapshot job scheduler, zstd and git pack operations#161

Merged
nssherpa merged 2 commits intomainfrom
nsherpa/cpu-throttle-limits
Feb 26, 2026
Merged

fix: bound CPU parallelism for snapshot job scheduler, zstd and git pack operations#161
nssherpa merged 2 commits intomainfrom
nsherpa/cpu-throttle-limits

Conversation

@nssherpa
Copy link
Contributor

@nssherpa nssherpa commented Feb 26, 2026

zstd was using -T0 (all cores) and git pack.threads was set to 0 (all
cores), causing sustained CPU throttling in both staging and production.
Limit both to 4 threads to stay within pod CPU limits.

nssherpa and others added 2 commits February 25, 2026 15:54
zstd was using -T0 (all cores) and git pack.threads was set to 0 (all
cores), causing sustained CPU throttling in both staging and production.
Limit both to 4 threads to stay within pod CPU limits.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
With zstd capped at 4 threads, running NumCPU concurrent snapshot jobs
simultaneously still saturates the CPU limit (8 cores × 4 threads = 32).
Capping concurrency at 4 limits simultaneous CPU-intensive jobs to
4 × 4 = 16 zstd threads, staying within the pod's 8–10 core budget.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

type Config struct {
Concurrency int `hcl:"concurrency" help:"The maximum number of concurrent jobs to run (0 means number of cores)." default:"0"`
Concurrency int `hcl:"concurrency" help:"The maximum number of concurrent jobs to run (0 means number of cores)." default:"4"`
Copy link
Contributor Author

@nssherpa nssherpa Feb 26, 2026

Choose a reason for hiding this comment

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

Perhaps this can go in the hcl if we don't want the default here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@nssherpa nssherpa Feb 26, 2026

Choose a reason for hiding this comment

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

In line 95 runtime.NumCPU() returns the total number of logical cores on the node vs the cores limited to the container, so I don't mind setting a non-zero default here.

@nssherpa nssherpa marked this pull request as ready for review February 26, 2026 05:19
@nssherpa nssherpa requested a review from a team as a code owner February 26, 2026 05:19
@nssherpa nssherpa requested review from js-murph and removed request for a team February 26, 2026 05:19
@nssherpa nssherpa changed the title fix: bound CPU parallelism for zstd and git pack operations fix: bound CPU parallelism for snapshot job scheduler, zstd and git pack operations Feb 26, 2026
@nssherpa nssherpa merged commit 39f1d8b into main Feb 26, 2026
6 checks passed
@nssherpa nssherpa deleted the nsherpa/cpu-throttle-limits branch February 26, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant