Skip to content

Size active queried series worker pool from GOMAXPROCS - #7671

Open
anxkhn wants to merge 1 commit into
cortexproject:masterfrom
anxkhn:fix/active-queried-series-gomaxprocs
Open

Size active queried series worker pool from GOMAXPROCS#7671
anxkhn wants to merge 1 commit into
cortexproject:masterfrom
anxkhn:fix/active-queried-series-gomaxprocs

Conversation

@anxkhn

@anxkhn anxkhn commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

What this PR does:

The active queried series service sizes its worker pool with runtime.NumCPU(), which reports host logical CPUs and does not account for a container CPU quota. Cortex imports go.uber.org/automaxprocs so GOMAXPROCS reflects that quota, and other concurrency defaults already use runtime.GOMAXPROCS(0).

This switches the worker calculation to runtime.GOMAXPROCS(0), preserving the existing minimum of one and maximum of four workers. A table-driven regression test verifies the calculation across several GOMAXPROCS values.

Which issue(s) this PR fixes:

No open issue; this is a small self-contained correctness fix.

Checklist

  • Tests updated
  • Documentation added (n/a: no config, flags, or user-facing docs change)
  • CHANGELOG.md updated
  • docs/configuration/v1-guarantees.md updated if this PR introduces experimental flags (n/a: no flags)

This change was prepared with AI assistance per the project policy. I reviewed every line and validated the behavior and regression test.

@dosubot dosubot Bot added component/ingester go Pull requests that update Go code type/bug type/tests labels Jul 5, 2026
@anxkhn
anxkhn force-pushed the fix/active-queried-series-gomaxprocs branch from e5c4b2b to 5917b6e Compare July 16, 2026 08:14
The active queried series service sized its worker pool with
runtime.NumCPU(), which returns the host's logical CPU count and ignores
the CPU cgroup quota. Cortex imports go.uber.org/automaxprocs so that
GOMAXPROCS matches the container's CPU limit, and reads container-aware
parallelism via runtime.GOMAXPROCS(0) elsewhere (for example the resource
monitor's CPU limit and the engine's decoding concurrency default). This
one call site was inconsistent: in a CPU-limited container on a many-core
host it sized the pool off the host cores instead of the CPU budget.

Use runtime.GOMAXPROCS(0) so the pool follows the container CPU quota,
matching the rest of the codebase. The min(..., 4) cap is unchanged. Add
a regression test asserting the worker count follows GOMAXPROCS.

Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
@anxkhn
anxkhn force-pushed the fix/active-queried-series-gomaxprocs branch from 5917b6e to 5cb8dc3 Compare July 27, 2026 17:48
@anxkhn

anxkhn commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

rebased onto current master and resolved the changelog conflict. the focused ingester tests and go vet pass locally. ready for re-review.

@anxkhn

anxkhn commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

ci is complete. build, lint, dco, unit tests, and nearly all integration jobs pass. the two failures are unrelated flaky coverage: the same arm64 query-fuzz job failed on #7672, while #7672 passed the amd64 querier integration that failed here. neither failure exercises the ingester worker-pool change.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant