Skip to content

[release/8.0] Port dump collection perf improvements#128022

Merged
hoyosjs merged 3 commits into
dotnet:release/8.0-stagingfrom
hoyosjs:juhoyosa/use-heap2-8
May 13, 2026
Merged

[release/8.0] Port dump collection perf improvements#128022
hoyosjs merged 3 commits into
dotnet:release/8.0-stagingfrom
hoyosjs:juhoyosa/use-heap2-8

Conversation

@hoyosjs
Copy link
Copy Markdown
Member

@hoyosjs hoyosjs commented May 11, 2026

Fixes #122459

main PRs:

Description

Backports three DAC performance improvements for minidump collection:

  1. Use SHash as DAC instance hash (Use SHash as DAC instance hash #125631): Replaces the hand-rolled hash table in DacInstanceManager with an SHash-based implementation. The previous fixed-bucket hash degraded quickly for Find and insertion operations under high load. Measured ~9.5x speedup for minidump collection against a repro app with 2.5k-frame deep stacks over 50 threads.

  2. Cache debugger patches (Cache debugger patches to speed up x64 stackwalk epilogue/prologue scanning #125459): Caches the list of debugger breakpoint patches so that x64 stack unwinding doesn't re-scan the 1,000-bucket patch hash table on every frame. The cache is populated once on first access and invalidated on Flush(). Measured reduction from 55s to ~7s for minidump collection (10,000 iterations across 10 threads).

  3. Enable CLRDATA_ENUM_MEM_HEAP2 via environment variable: When the target process has DOTNET_EnableFastHeapDumps set, the DAC promotes CLRDATA_ENUM_MEM_HEAP to CLRDATA_ENUM_MEM_HEAP2, which dumps loader heap pages in bulk instead of walking individual runtime structures.

Customer Impact

Customers collecting minidumps of large .NET applications (many threads, deep stacks) experience extremely slow dump collection times - on the order of minutes for what should take seconds. This directly impacts incident response time in production environments. Without these fixes, dump collection through Watson/dotnet-dump/createdump remains unacceptably slow for large workloads.

Regression

Yes, with respect to framework. Customers doing migrations have noticed them - framework used non-portable variants of the MSVC library.

Testing

Risk

Low.

  • The SHash and patch cache changes are confined to DAC-only code paths (daccess.cpp, dacfn.cpp, dacimpl.h) that execute only during diagnostic operations (dump collection, debugging). They do not affect runtime execution.
  • The DOTNET_EnableFastHeapDumps env var is opt-in and does not change default behavior.
  • All three changes have been running in main since March without reported issues.

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
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 backports three CoreCLR DAC-focused changes intended to reduce minidump/heap-dump collection time for large workloads (many threads, deep stacks) by improving DAC caching behavior and optionally enabling a faster heap enumeration mode.

Changes:

  • Add an opt-in knob (DOTNET_EnableFastHeapDumps) that promotes heap dump enumeration from CLRDATA_ENUM_MEM_HEAP to CLRDATA_ENUM_MEM_HEAP2.
  • Introduce a DAC-side cache of debugger breakpoint patches to avoid re-scanning the patch table during x64 unwinding.
  • Replace the non-scaling DAC instance hash implementation with an SHash-based implementation (intended).

Reviewed changes

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

Show a summary per file
File Description
src/coreclr/vm/vars.hpp Declares g_EnableFastHeapDumps global.
src/coreclr/vm/vars.cpp Defines/initializes g_EnableFastHeapDumps.
src/coreclr/vm/ceemain.cpp Reads EXTERNAL_EnableFastHeapDumps at startup into g_EnableFastHeapDumps.
src/coreclr/inc/dacvars.h Exposes g_EnableFastHeapDumps to the DAC via DEFINE_DACVAR.
src/coreclr/inc/clrconfigvalues.h Adds EXTERNAL_EnableFastHeapDumps config entry.
src/coreclr/debug/daccess/enummem.cpp Promotes heap dump enumeration to HEAP2 when enabled.
src/coreclr/debug/daccess/dacimpl.h Updates instance-hash implementation (intended SHash) and adds DacPatchCache to ClrDataAccess.
src/coreclr/debug/daccess/dacfn.cpp Implements patch cache population and uses cached patches during host-memory patch replacement.
src/coreclr/debug/daccess/daccess.cpp Updates DacInstanceManager map operations for the SHash-based implementation and flushes the patch cache on ClrDataAccess::Flush().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/coreclr/debug/daccess/dacimpl.h Outdated
Comment thread src/coreclr/debug/daccess/enummem.cpp Outdated
Comment thread src/coreclr/debug/daccess/dacfn.cpp
@hoyosjs hoyosjs force-pushed the juhoyosa/use-heap2-8 branch from d243f0d to 7782610 Compare May 11, 2026 09:36
@hoyosjs hoyosjs marked this pull request as ready for review May 12, 2026 09:52
Copilot AI review requested due to automatic review settings May 12, 2026 09:52
Copy link
Copy Markdown
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

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

@steveisok steveisok added the Servicing-approved Approved for servicing release label May 12, 2026
@hoyosjs hoyosjs enabled auto-merge (squash) May 13, 2026 00:25
@hoyosjs
Copy link
Copy Markdown
Member Author

hoyosjs commented May 13, 2026

/ba-g the failures are known on a release branch or unrelated timeouts

@hoyosjs hoyosjs merged commit a5995cd into dotnet:release/8.0-staging May 13, 2026
118 of 122 checks passed
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.

4 participants