Repository navigation
Conversation
Add internal priority-aware coordinator requests, scheduling, and strict priority-cap settings without adding public BuildParameters API. Co-authored-by: Copilot App <[email protected]>
Cover env-driven priority negotiation, priority-aware queueing, reservations, caps, and telemetry. Co-authored-by: Copilot App <[email protected]>
Describe priority requests, reservation/cap behavior, and the environment-variable-based request path. Co-authored-by: Copilot App <[email protected]>
Add repeatable scripts and instructions for CDK project-data and Roslyn mixed-workload coordinator benchmarking. Co-authored-by: Copilot App <[email protected]>
DustinCampbell
left a comment
There was a problem hiding this comment.
I spent some time trying to read through the changes in MSBuild-Coordinator.md and have provided some feedback. I'll take a look at the code later on, but I wanted to provide some general feedback that the documentation feels pretty laden with jargon and undefined concepts. To my eye, it's much more difficult to read and understand.
| 5. **Auto-shutting down** after a timeout period | ||
| 2. **Capping individual grants** so one build does not assume it owns the whole machine | ||
| 3. **Prioritizing queued builds** when hosts identify latency-sensitive work | ||
| 4. **Reserving high-priority capacity** so interactive builds can start predictably |
There was a problem hiding this comment.
What are "interactive builds"? That's a new concept and reads to me as jargon.
There was a problem hiding this comment.
Good point. I was using “interactive builds” as shorthand for builds that block a user-facing interaction, like IDE-requested design-time builds. But that introduces a new concept here and makes the priority behavior sound narrower than it is. I changed this to say high-priority builds instead.
| ``` | ||
|
|
||
| Wait-queue drain path (`DrainWaitQueue`): | ||
| `same_effective_priority_waiting_builds` includes the build currently being evaluated for a grant. Effective priority includes deterministic aging, so a lower-priority request can eventually participate in a higher-priority fair-share group after higher-priority work has bypassed it enough times. By default, a queued request ages upward by one effective priority level after 3 bypasses. Set `MSBUILDCOORDINATORPRIORITYAGINGTHRESHOLD` to a positive integer to tune that threshold. |
There was a problem hiding this comment.
Should we decide on terminology for the priority "groups"? I've seen "slices" used in this document as well. Are these different concepts? Or are they used as synonyms? Should they be defined somewhere above?
There was a problem hiding this comment.
Agreed. These were not meant to be synonyms, but the wording made that unclear. I updated the docs to avoid “priority groups” and use “effective priority” for queue ordering. I also changed the “slice” wording to “per-build cap” / “grant” where possible, so “slice” doesn’t sound like a separate priority concept.
| New requests that arrive while same- or higher-priority builds are already queued are placed in the wait queue in both capped and uncapped modes. | ||
|
|
||
| Initial request path (`TryGrant`): | ||
| When `MSBUILDCOORDINATORMAXNODESPERBUILD` is `0`, there is no per-build cap. During wait-queue draining, this preserves the previous fair-share behavior: |
There was a problem hiding this comment.
This isn't quite accurate. I believe this is also true if 'MSBUILDCOORDINATORMAXNODESPERBUILD' is not set at all, right?
There was a problem hiding this comment.
Good question. I changed this to describe the resolved per-build cap instead of the raw env-var value. Setting MSBUILDCOORDINATORMAXNODESPERBUILD=0 always disables the per-build cap. Leaving it unset uses the computed default: uncapped for total node budgets below 8, but 4 for total node budgets 8 and above. I also added an earlier sentence summarizing those defaults before the fair-share/capped behavior is described.
| 1. Client sends `ReleaseNodesMessage` with its grant ID | ||
| 1. Client sends `ReleaseNodesMessage` for its connection |
There was a problem hiding this comment.
How is the text improved by this change?
There was a problem hiding this comment.
Good callout. I looked at this again and ReleaseNodesMessage does not carry a grant ID; the server associates the release with the connection. I updated this to say the message releases the grant associated with the client connection.
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Summary
The MSBuild Coordinator enforces a global node budget across concurrent builds, but the current allocator does not distinguish latency-sensitive work from regular or background work. An initial build can consume the full budget, leaving later work queued until capacity is released.
This change adds generalized
Low,Normal, andHighpriority for root Coordinator requests. The Coordinator does not inspectDesignTimeBuildor any other project property: a client maps its own intent to a priority. For example, a UI-blocking design-time build can requestHighwithout adding design-time-build-specific behavior to the Coordinator.This PR also adds computed allocation defaults that preserve capacity for
Highwork while avoiding a permanent four-node limit when the Coordinator is otherwise idle.Behavior
The resolved defaults depend on the total Coordinator node budget:
Low/NormalforHighThe idle maximum applies only when no root grants are active and no requests are waiting:
NormalorHighrequest may receive up to 8 nodes if it requests and can use 8.Lowrequests always use the regular maximum.LowandNormalcannot consume the four nodes reserved forHigh.On a 16-node budget, three full-budget
Normalrequests therefore produce8, 4, queued; when the 8-node build releases, the queued request receives 4 rather than another idle 8-node grant. If aHighrequest arrives while the initial 8-nodeNormalbuild is active, it can receive the four reserved nodes immediately.Configuration semantics
0disables that individual setting.MSBUILDCOORDINATORHIGHPRIORITYRESERVEDNODESvalue is an explicit reservation, clamped to leave at least one non-Highnode.MSBUILDCOORDINATORMAXNODESPERBUILDvalue is always a hard maximum, clamped to the total budget, and disables the idle 8-node exception.0restores the current uncapped, no-reservation allocation behavior.Clients select a request priority with
MSBUILDCOORDINATORBUILDREQUESTPRIORITY=Low|Normal|High. The setting should be scoped to the build process whose request is being prioritized.Protocol and compatibility
Priority is an optional extended field on the existing
RequestNodesMessage:prioritycapability.Normal, including requests from older clients.There is no new public API in this change. The Coordinator remains opt-in through
MSBUILDUSECOORDINATOR, and explicit0/0provides the previous allocator behavior, so this is not gated by a ChangeWave.Why 4 reserved / 4 regular / 8 while idle?
The current Coordinator may grant all 16 nodes to the first build and queue everything that arrives afterward. Reserving four nodes lets a later
Highrequest start without preempting or resizing the first grant.A permanent four-node maximum performed well under heavy contention, but it imposed a substantial isolated-build cost. Clean node-count calibration showed that four nodes took 34.4% longer than eight for Roslyn and 19.8% longer for Aspire. The idle 8-node maximum avoids imposing that permanent limit on a single build.
For large full-solution builds, eight rather than sixteen is a throughput/resource compromise. In the same calibration, eight nodes took 6.2% longer than sixteen for Roslyn and 15.2% longer for Aspire, while reducing measured process-tree memory:
These are node-count calibration results without the Coordinator; they explain the selected grant sizes rather than claiming end-to-end Coordinator overhead. The direct isolated-project comparison below did not reproduce this full-solution timing cost.
An independent idle-grant setting is intentionally not added. A caller that specifies a positive per-build maximum gets that literal hard maximum, while callers using the computed four-node maximum get the documented idle exception.
Performance evidence
The portable reports, source/binary identities, exact scripts, raw summaries, launch records, and checksums are available in the PR #14241 benchmark evidence package. Each report identifies its exact baseline and candidate; the newest isolated and sustained campaigns directly compare the latest-
mainbaseline used for this rebase with the final scheduling implementation.Campaigns used pinned Roslyn and Aspire worktrees on a Windows 11 VM exposing 8 cores / 16 logical AMD EPYC 7763 processors, approximately 64 GiB RAM, and the High performance power plan. The earlier contention campaigns used
Compilers.slnfandAspire-Core.slnf; the direct isolated campaign used the representative projects named below. Conditions used balanced within-block ordering. Effects below are paired within-block log-ratio estimates rather than ratios of independent medians.Isolated current-versus-final comparison
A direct matched comparison used current Coordinator commit
ff5b281f0cand final scheduling commit9aa319701c. Subsequent PR-head commits change tests, documentation, and diagnostic wording only; the measured allocator and protocol behavior is unchanged. One excluded warm-up and six measured paired blocks per repository used a complete Williams design with exact0/0position and carryover imbalance. Grant replay confirmed that the current Coordinator granted 16 nodes and the final computed defaults granted 8:The 8-node final defaults therefore had effectively the same duration as the current 16-node Coordinator for both representative isolated projects. Memory differences were small and inconsistent between repositories, and median descendant process counts were unchanged, so this campaign does not support a generalized memory benefit.
The same direct campaign exercised the final implementation in explicit
0/0compatibility mode. It was 1.2% faster for Roslyn and 0.7% slower for Aspire than the current Coordinator; both descriptive intervals crossed zero. Full details are in the isolated validated report.Concurrent compatibility control
An earlier propagated-solution campaign also compared the pre-priority Coordinator directly with the priority implementation configured as explicit
0/0. Ten paired measured blocks per repository found no meaningful implementation/protocol overhead:NormalEvery descriptive interval crossed zero.
Bounded contention and priority
The final-default behavior was measured with four initial
Normalbuilds plus one build injected after 15 seconds. Comparing an injectedHighrequest with the otherwise-identical all-Normalcondition:HighcompletionNormalcompletionThis shows the intended transfer: the selected request completes materially sooner, while the initial
Normalbuilds absorb a measurable cost.The same campaign compared the computed idle-8 behavior with an explicit fixed
4/4all-Normalcondition:NormalcompletionThe immutable first 8-node grant is therefore not free when several
Normalbuilds arrive immediately afterward. This regression is the explicit tradeoff for avoiding a permanent four-node limit on isolated builds.The idle/default matrix had four measured paired blocks per repository. Its results are descriptive and directional: with
n=4, the minimum attainable two-sided exact sign-flip p-value is.125.Sustained contention
A direct current-versus-final campaign used eight closed-loop
Normalworkers for a fixed eight-minute measured window, with an additional request injected after four minutes. The queue was nonempty for 94-95% of current-Coordinator samples and 100% of final-candidate samples. Three complete paired blocks per repository were accepted.With all requests
Normal, the final defaults kept approximately 12 of 16 nodes allocated, leaving the four-nodeHighreservation unused. This reduced sustainedNormalthroughput while also reducing machine pressure:Normalthroughput versus currentChanging only the injected request from
NormaltoHighmade its reserved-capacity grant nearly immediate:Normal→HighNormalthroughput versus final all-NormalNormalthroughput versus currentCompared directly with the current Coordinator, the final
Highrequest completed 60.3% sooner for Roslyn and 56.8% sooner for Aspire. The result demonstrates the intended tradeoff: reserving capacity substantially improves latency-sensitive work and lowers resource pressure, but reduces throughput when a continuously backlogged workload consists only ofNormalrequests.These sustained estimates are directional (
n=3; minimum attainable two-sided exact sign-flip p-value.25). One host-suspended partial attempt was excluded after telemetry gaps exceeded the predeclared limits; no partial scenario was reused. Full details are in the sustained contention report.Grant validation
Across 200 successful measured binlogs and 72,231,961 replayed events:
Highrequest received 4 while the initial 8-nodeNormalbuild was still active.Validation
.\build.cmd -verbosity qMSBuild.Coordinator.UnitTestsonnet11.0: 176 passedBuildManagerPassesEnvironmentBuildRequestPriorityToCoordinatoronnet11.0: passedOut of scope
BuildParameterspriority API.