Skip to content

Bound parallel worker counts - #139

Draft
afermg wants to merge 1 commit into
mainfrom
perf/worker-budget
Draft

Bound parallel worker counts#139
afermg wants to merge 1 commit into
mainfrom
perf/worker-budget

Conversation

@afermg

@afermg afermg commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Introduce one explicit, memory-aware worker budget across similarity, AP, null-distribution, and mAP aggregation paths:

  • default cap of 8 workers
  • affinity-aware available-CPU detection
  • task-count cap
  • max_workers= keyword controls on public AP APIs
  • COPAIRS_MAX_WORKERS process-level override
  • serial execution that still honors progress reporting
  • consistent validation for empty and nonempty task sets

Benchmark

Synthetic cosine workload: 5,000 × 196, 10,000 pairs, 20 batches, identical output digest:

origin/main default This PR default
Resolved workers 20 8
Wall time 0.0323 s 0.0226 s
Peak RSS 162 MB 132 MB

This is 1.43× faster with 18.5% lower peak RSS for the benchmark.

The default of 8 is based on a real JUMP-lite scaling sweep: 1/4/8/16 workers used approximately 459/507/862/1,415 MB; 8 workers retained most throughput while avoiding the multi-GB pressure of higher defaults. Explicit and environment overrides remain available.

Validation

  • 48 focused tests passed
  • worker resolution, affinity, environment parsing, empty tasks, progress at one worker, AP/multilabel/null/mAP propagation, and exact output parity covered
  • Ruff and git diff --check passed
  • independent follow-up review: OK

@afermg
afermg marked this pull request as draft September 2, 2026 17:12
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