Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions docs/build_cache_requirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Build Cache Service — Requirements for Crank Integration

## Context

Crank (the .NET benchmarking tool) has been updated to support a new `buildcache` channel that downloads pre-built runtime binaries from the Build Cache Service (BCS) instead of resolving versions from VMR/NuGet feeds. This gives per-commit granularity for performance testing and regression bisection.

The crank-side changes are complete. This document describes what's needed on the BCS/dotnet-performance-infra side to make the integration work end-to-end.

---

## Requirement 1: Public Blob Access

**Status:** Already in progress (per prior discussion).

Crank's BCS client uses unauthenticated HTTP GET requests to download artifacts. The blobs in the `pvscmdupload` storage account's `$web` container need to be publicly readable.

**URLs crank will hit:**

```
GET https://pvscmdupload.z22.web.core.windows.net/builds/{repoName}/latest/{branch}/latestBuilds.json
GET https://pvscmdupload.z22.web.core.windows.net/builds/{repoName}/buildArtifacts/{commitSha}/{configKey}/{artifactFile}
```
Comment on lines +19 to +22
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

This doc’s example URLs use the blob endpoint with /$web/..., but the agent default base URL (and client URL construction) uses the static website endpoint (https://pvscmdupload.z22.web.core.windows.net) without /$web. Please align the documented URLs with what the agent actually calls (or clarify which base URL should be configured via --build-cache-base-url).

Copilot uses AI. Check for mistakes.

Where:
- `repoName` = `runtime` (initially; `aspnetcore` in the future)
- `branch` = e.g., `main`, `release/10.0`
- `configKey` = e.g., `coreclr_x64_linux`, `coreclr_arm64_windows`
- `artifactFile` = e.g., `BuildArtifacts_linux_x64_Release_coreclr.tar.gz`

---

## Requirement 2: Commit Index File (Not Required)

~~Originally proposed as a per-branch `commitIndex.json` mapping commits to timestamps.~~

**Decision:** Not needed. For the default case, `latestBuilds.json` provides the latest commit. For specific-commit runs (e.g., bisection), users will already know the SHAs — either from git history, GitHub, or a local tool that queries the GitHub API for the commit list. A separate index in BCS would be redundant.

If automated bisection tooling is built in the future, it can query GitHub directly for ordered commit SHAs and then check BCS blob existence per-commit.

---

## Requirement 3: latestBuilds.json Compatibility

**Resolved.** The actual `latestBuilds.json` uses PascalCase (`CommitSha`, `CommitTime`), not snake_case. Crank's parser has been updated to accept both casings for forward compatibility.

---

## Requirement 4: Artifact Layout Stability

Crank extracts runtime artifacts using this path convention inside the archive:

```
microsoft.netcore.app.runtime.{rid}/Release/runtimes/{rid}/lib/net{X}.0/ → managed DLLs
microsoft.netcore.app.runtime.{rid}/Release/runtimes/{rid}/native/ → native libs
{rid}.Release/corehost/ → host binaries (dotnet, libhostfxr, libhostpolicy)
```

Where `{rid}` = `linux-x64`, `linux-arm64`, `win-x64`, etc.

This layout was confirmed by inspecting `BuildArtifacts_linux_arm64_Release_coreclr.tar.gz`. **If this layout changes in future builds, the crank extraction will break.** Consider treating it as a stable contract or documenting it.

---

## Nice-to-Have: Artifact Manifest

A `manifest.json` per commit+config that describes the archive contents would make extraction more robust:

```
builds/{repoName}/buildArtifacts/{commitSha}/{configKey}/manifest.json
```

```json
{
"runtimeVersion": "10.0.0-preview.4.26120.3",
"commitSha": "abc123...",
"rid": "linux-arm64",
"managedPath": "microsoft.netcore.app.runtime.linux-arm64/Release/runtimes/linux-arm64/lib/net10.0",
"nativePath": "microsoft.netcore.app.runtime.linux-arm64/Release/runtimes/linux-arm64/native",
"corehostPath": "linux-arm64.Release/corehost"
}
```

This isn't blocking — crank currently discovers paths by convention — but it would decouple crank from the internal archive layout and make future changes safe.

---

## Summary

| # | Requirement | Priority | Blocking? |
|---|-------------|----------|-----------|
| 1 | Public blob access | High | Yes — crank can't download without it |
| 2 | ~~Commit index~~ | N/A | Dropped — users provide SHAs directly or use GitHub |
| 3 | `latestBuilds.json` field names | N/A | Resolved — crank parser updated to handle PascalCase |
| 4 | Artifact layout stability | Medium | Not now, but breaking changes would break crank |
| 5 | Artifact manifest.json | Low | Nice-to-have for robustness |
53 changes: 52 additions & 1 deletion docs/dotnet_versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ When a TFM is configured, the agent will download the corresponding .NET SDK ver
- `current`: only latest public versions, this is the default
- `latest`: latest versions used by ASP.NET
- `edge`: latest nightly builds available
- `buildcache`: runtime from the Build Cache Service (per-commit builds)

The difference between `latest` and `edge` is that `latest` will pick runtimes and SDKs that are deemed compatible together. For instance a very recent .NET core runtime might be compatible with a less recent ASP.NET runtime. The `edge` is used to pick the absolute latest build for the select TFM.

The `buildcache` channel uses the Build Cache Service (BCS) from `dotnet-performance-infra` to resolve runtime versions by individual commit SHA rather than from VMR feeds. This provides much finer-grained control — every cached runtime commit is available, whereas VMR feeds may have multi-day gaps between ingested commits. SDK and ASP.NET Core versions are resolved from `latest` when using `buildcache`.

In order to benchmark and ASP.NET application using very recent runtimes of .NET 5, the `latest` channel is recommended:

```
Expand Down Expand Up @@ -115,4 +118,52 @@ The following command uses the `edge` channel but ASP.NET is fixed so it doesn't

```
> crank --config /crank/samples/hello/hello.benchmarks.yml --scenario hello --profile local --application.framework netcoreapp5.0 --application.channel edge --application.aspnetCoreVersion 5.0.0-preview.6.20279.12
```
```

## Using the Build Cache channel

The `buildcache` channel resolves the .NET runtime from the Build Cache Service (BCS), which caches pre-built runtime binaries for individual commits. This is useful for performance regression bisection where VMR feed gaps make it hard to pinpoint which commit caused a regression.

### Basic usage (latest cached build on main)

```
> crank --config benchmarks.yml --scenario json --profile aspnet-perf-lin --application.channel buildcache
```

### Specific commit SHA

```
> crank --config benchmarks.yml --scenario json --profile aspnet-perf-lin --application.channel buildcache --application.buildCacheCommitSha a1b2c3d4e5f6...
```

If the commit is not found in the cache, crank will fail with an error rather than falling back.

### Different branch

```
> crank --config benchmarks.yml --scenario json --profile aspnet-perf-lin --application.channel buildcache --application.buildCacheBranch release/10.0
```

### Mixed channels (BCS runtime + pinned ASP.NET)

```
> crank --config benchmarks.yml --scenario json --profile aspnet-perf-lin --application.channel buildcache --application.aspNetCoreVersion 10.0.0-preview.3.26115.7
```

### Build Cache properties

| Property | Default | Description |
|----------|---------|-------------|
| `buildCacheCommitSha` | (empty) | Specific runtime commit SHA. If empty, uses the latest cached build for the branch. |
| `buildCacheBranch` | `main` | Branch to query for the latest build. |
| `buildCacheConfig` | (auto-detected) | BCS configuration key (e.g., `coreclr_x64_linux`). Auto-detected from agent platform. |

### Agent configuration

The agent supports these command-line options for BCS:

| Option | Default | Description |
|--------|---------|-------------|
| `--build-cache-base-url` | `https://pvscmdupload.z22.web.core.windows.net` | Base URL for BCS blob storage. |
| `--build-cache-repo-name` | `runtime` | Repository name in BCS. |
| `--build-cache-disabled` | (not set) | Disables BCS integration on this agent. |
Loading