Skip to content

Add a script for startup performance measurement#14345

Merged
karolz-ms merged 5 commits intomainfrom
dev/karolz/perf-testing
Feb 11, 2026
Merged

Add a script for startup performance measurement#14345
karolz-ms merged 5 commits intomainfrom
dev/karolz/perf-testing

Conversation

@karolz-ms
Copy link
Member

This new script is just for (performance) engineering/testing. Entirely vibe-coded 😄

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14345

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14345"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds tooling for measuring .NET Aspire application startup performance by collecting and analyzing ETW traces. The script is designed for engineering and testing purposes to help assess the impact of code changes on startup performance.

Changes:

  • Added a PowerShell script (Measure-StartupPerformance.ps1) that automates running an Aspire application, collecting performance traces using dotnet-trace, and computing startup time
  • Added a C# trace analyzer tool (TraceAnalyzer) that parses .nettrace files and extracts timing information from AspireEventSource events (DcpModelCreation start/stop events)
  • Updated documentation to describe the new profiling script and its purpose

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tools/perf/TraceAnalyzer/TraceAnalyzer.csproj Project file for the trace analysis tool with opt-out of central package management
tools/perf/TraceAnalyzer/Program.cs C# program that parses .nettrace files and extracts DcpModelCreation event timing (event IDs 17 and 18)
tools/perf/Measure-StartupPerformance.ps1 PowerShell 7+ script that orchestrates the performance measurement process including building, running, trace collection, and analysis with support for multiple iterations and statistical calculations
docs/getting-perf-traces.md Documentation update adding a table describing the new profiling script

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🎬 CLI E2E Test Recordings

The following terminal recordings are available for commit f098bbe:

Test Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
CreateAndDeployToDockerCompose ▶️ View Recording
CreateAndDeployToDockerComposeInteractive ▶️ View Recording
CreateAndPublishToKubernetes ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateEmptyAppHostProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateStartWaitAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
ResourcesCommandShowsRunningResources ▶️ View Recording

📹 Recordings uploaded automatically from CI run #21915214491

Copy link
Member

@brianrob brianrob left a comment

Choose a reason for hiding this comment

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

Overall, looks good. I added a couple of comments below.

In terms of simplification, it's possible that using app startup tracing (see below) might help, but it's still likely to run into issues when using dotnet run since the process model for dotnet run is more complex.

Write-Verbose "$AppHostName started with PID: $appPid"

# Give the process a moment to initialize before attaching
Start-Sleep -Milliseconds 200
Copy link
Member

Choose a reason for hiding this comment

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

You may find this useful: https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-trace#use-diagnostic-port-to-collect-a-trace-from-app-startup

It's possible to have the runtime wait for you to attach before proceeding to execute the application. This is designed for start-up scenarios where you want to attach early.

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried this approach but when dotnet-trace is launched this way it does not seem to obey the --duration parameter?

@davidfowl
Copy link
Member

Make this a skill.

@karolz-ms karolz-ms self-assigned this Feb 11, 2026
@karolz-ms karolz-ms force-pushed the dev/karolz/perf-testing branch from f3beaa9 to f098bbe Compare February 11, 2026 01:59
@karolz-ms
Copy link
Member Author

Make this a skill.

Great idea! Done.

@davidfowl davidfowl closed this Feb 11, 2026
@davidfowl davidfowl reopened this Feb 11, 2026
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Feb 11, 2026
@karolz-ms karolz-ms merged commit 8776a7f into main Feb 11, 2026
1317 of 1349 checks passed
@karolz-ms karolz-ms deleted the dev/karolz/perf-testing branch February 11, 2026 18:53
mitchdenny pushed a commit that referenced this pull request Feb 12, 2026
* Add startup perf collection script

* Analyze trace more efficiently

* Increase pause between iterations

* Fix TraceAnalyzer

* Add startup-perf skill
mitchdenny added a commit that referenced this pull request Feb 23, 2026
…er (#14590)

* Add a script for startup performance measurement (#14345)

* Add startup perf collection script

* Analyze trace more efficiently

* Increase pause between iterations

* Fix TraceAnalyzer

* Add startup-perf skill

* Add backmerge release workflow to automate merging changes from release/13.2 to main (#14453)

* Add backmerge release workflow to automate merging changes from release/13.2 to main

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply more fixes and use dotnet's action

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Bump Aspire branding from 13.2 to 13.3 (#14456)

* Initial plan

* Bump Aspire branding from 13.2 to 13.3

Co-authored-by: joperezr <13854455+joperezr@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: joperezr <13854455+joperezr@users.noreply.github.com>

* Update Azure.Core to latest version - lift all runtime dependencies to latest (#14361)

* Update to Azure.Core 1.51.1

Use latest versions for all dotnet/runtime nuget packages. This simplifies our dependency management.

Remove ForceLatestDotnetVersions property from multiple project files

* Update AzureDeployerTests to use WaitForShutdown instead of StopAsync

There is a timing issue when using Start/Stop since the background pipeline might still be running and it cancels the pipeline before it can complete.

* Fix AuxiliaryBackchannelTests by adding a Task that completes when the AuxiliaryBackchannelService is listening and ready for connections.

* Remove double registration of AuxiliaryBackchannelService as an IHostedService.

* Fix ResourceLoggerForwarderServiceTests to ensure the ResourceLoggerForwarderService has started before signalling the stopping token.

* Update Arcade to latest version from the .NET 10 Eng channel (#13556)

Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>

* Refactor backmerge PR creation to update existing PRs and streamline body formatting (#14476)

* [main] Fix transitive Azure role assignments through WaitFor dependencies (#14478)

* Initial plan

* Fix transitive Azure role assignments through WaitFor dependencies

Remove CollectAnnotationDependencies calls from CollectDependenciesFromValue
to prevent WaitFor/parent/connection-string-redirect annotations from
referenced resources being included as direct dependencies of the caller.

Add tests verifying:
- DirectOnly mode excludes WaitFor deps from referenced resources
- WaitFor doesn't create transitive role assignments in Azure publish

Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>

* Remove auto-merge step from backmerge workflow (#14481)

* Remove auto-merge step from backmerge workflow

* Update PR body to request merge commit instead of auto-merge

* Add agentic workflow daily-repo-status (#14498)

* [Automated] Backmerge release/13.2 to main (#14536)

* Fix Windows pipeline image to use windows.vs2022.amd64.open (#14492)

* Fix Windows pipeline image to use windows.vs2022.amd64.open

* Use windows.vs2026preview.scout.amd64 for public pipeline Windows pool

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add Azure portal link for Resource Group in deploy pipeline summary (#14434)

* Add Azure portal link for Resource Group in pipeline summary

When printing the Resource Group in the pipeline summary of `aspire deploy`,
include a clickable link to the Azure portal resource group page.

The link uses the format:
https://portal.azure.com/#@{tenantId}/resource/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/overview

Changes:
- AzureEnvironmentResource.AddToPipelineSummary: construct markdown link for resource group
- ConsoleActivityLogger.FormatPipelineSummaryKvp: convert markdown to Spectre markup for clickable links
- Add ConsoleActivityLoggerTests for the new markdown rendering behavior

Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>

* Clean up the code

* Fix tests

* More test fixups

* Refactor code

* Update src/Aspire.Cli/Utils/MarkdownToSpectreConverter.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add test for color-enabled non-interactive rendering path

Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>

* fix test

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* [Automated] Update AI Foundry Models (#14541)

Co-authored-by: sebastienros <sebastienros@users.noreply.github.com>

* Detect CLI at default install paths when not on PATH (#14545)

Check default installation directories (~/.aspire/bin, ~/.dotnet/tools) when the
Aspire CLI is not found on the system PATH. If found at a default location, the
VS Code setting is auto-updated. If later found on PATH, the setting is cleared.

Resolution order: configured custom path > system PATH > default install paths.

Fixes #14235

* [automated] Unquarantine stable tests with 25+ days zero failures (#14531)

* Initial plan

* [automated] Unquarantine stable tests

- Unquarantined: DeployCommandIncludesDeployFlagInArguments
- Unquarantined: GetAppHostsCommand_WithMultipleProjects_ReturnsSuccessWithAllCandidates
- Unquarantined: GetAppHostsCommand_WithSingleProject_ReturnsSuccessWithValidJson
- Unquarantined: PushImageToRegistry_WithRemoteRegistry_PushesImage
- Unquarantined: ProcessParametersStep_ValidatesBehavior
- Unquarantined: WithHttpCommand_EnablesCommandOnceResourceIsRunning

These tests are being unquarantined as they have had 25+ days of quarantined run data with zero failures.

Co-authored-by: radical <1472+radical@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: radical <1472+radical@users.noreply.github.com>

* Partially fix quarantined test: Update stale snapshot for DeployAsync_WithMultipleComputeEnvironments_Works (#14551)

* Initial plan

* Update snapshot for DeployAsync_WithMultipleComputeEnvironments_Works test

Co-authored-by: radical <1472+radical@users.noreply.github.com>

* Remove quarantine attribute from DeployAsync_WithMultipleComputeEnvironments_Works test

Co-authored-by: radical <1472+radical@users.noreply.github.com>

* Restore quarantine attribute - step="deploy" case still fails

Co-authored-by: radical <1472+radical@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: radical <1472+radical@users.noreply.github.com>

* Update daily report to 13.2 milestone burndown (#14563)

* Update daily report to 13.2 milestone burndown

Refocus the daily-repo-status agentic workflow to serve as a 13.2
release burndown report:

- Track 13.2 milestone issues closed/opened in the last 24 hours
- Highlight new bugs added to the milestone
- Summarize PRs merged to release/13.2 branch
- List PRs targeting release/13.2 awaiting review
- Surface relevant 13.2 discussions
- Generate a Mermaid xychart burndown using cache-memory snapshots
- Keep general triage queue as a brief secondary section
- Schedule daily around 9am, auto-close older report issues

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address review feedback: clarify cache schema and queries

- Exclude PRs from milestone counts (issues-only filter)
- Specify exact JSON schema for cache-memory burndown snapshots
- Add dedup, sort, and trim-to-7 logic for cache entries
- Simplify 'new issues' query to opened-in-last-24h with milestone

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Update Aspire.Hosting.Kubernetes.csproj

* Initialize _kubernetesComponents with ResourceNameComparer

* Update KubernetesPublisherTests.cs

* Update Aspire.Hosting.Kubernetes.csproj

* Adds snapshots

* Adds Chart.yaml to snapshot

---------

Co-authored-by: Karol Zadora-Przylecki <karolz@microsoft.com>
Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: joperezr <13854455+joperezr@users.noreply.github.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>
Co-authored-by: David Negstad <50252651+danegsta@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Mitch Denny <midenn@microsoft.com>
Co-authored-by: sebastienros <sebastienros@users.noreply.github.com>
Co-authored-by: Adam Ratzman <adam@adamratzman.com>
Co-authored-by: radical <1472+radical@users.noreply.github.com>
davidfowl pushed a commit that referenced this pull request Feb 25, 2026
* Add startup perf collection script

* Analyze trace more efficiently

* Increase pause between iterations

* Fix TraceAnalyzer

* Add startup-perf skill
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.

5 participants