[release/9.0-staging] Remove thread contention from Activity Start/Stop by github-actions[bot] · Pull Request #109359 · dotnet/runtime (original) (raw)

Fixes #109060

Backport of #107333 to release/9.0-staging

/cc @tarekgh @AlgorithmsAreCool

Customer Impact

Users running tracing in high-throughput scenarios may experience lock contention, which can lead to performance degradation in their applications or services.

Regression

While this isn't a regression, it appears that users have started enabling scenarios that lead to this issue. We may expect this get reported more in the near future if we don't service this fix.

Testing

Manual testing, #107333 (comment) has some numbers before and after fix. Also, we have provided a private built package to the customer who reported the issue, and they have confirmed the fix resolve their issue. #109060 (comment)

Risk

Medium to low risk. The whole change is touching the type we use for caching which was causing the lock contention. The fix didn't change any actual functional behavior more than avoiding the lock when notifying the listeners.

IMPORTANT: If this backport is for a servicing release, please verify that: