Skip to content

[Server] Improve SubscriptionManager throughput by removing lock on subscription dictionary lookups#3189

Merged
marcschier merged 4 commits into
OPCFoundation:masterfrom
romanett:feat/SubscriptionManagerLocking
Sep 11, 2025
Merged

[Server] Improve SubscriptionManager throughput by removing lock on subscription dictionary lookups#3189
marcschier merged 4 commits into
OPCFoundation:masterfrom
romanett:feat/SubscriptionManagerLocking

Conversation

@romanett

@romanett romanett commented Sep 7, 2025

Copy link
Copy Markdown
Contributor

Proposed changes

Improve SubscriptionManager throughput by removing lock on subscription dictionary lookups

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which adds functionality)
  • Test enhancement (non-breaking change to increase test coverage)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected, requires version increase of Nuget packages)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc.
  • I have signed the CLA.
  • I ran tests locally with my changes, all passed.
  • I fixed all failing tests in the CI pipelines.
  • I fixed all introduced issues with CodeQL and LGTM.
  • I have added tests that prove my fix is effective or that my feature works and increased code coverage.
  • I have added necessary documentation (if appropriate).
  • Any dependent changes have been merged and published in downstream modules.

Further comments

@romanett
romanett requested a review from Copilot September 7, 2025 10:46
@romanett romanett added this to the 1.5.378 Async Server Update 2 milestone Sep 7, 2025
@codecov

codecov Bot commented Sep 7, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 49.39759% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.62%. Comparing base (ca731c3) to head (05a32ec).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
.../Opc.Ua.Server/Subscription/SubscriptionManager.cs 49.39% 28 Missing and 14 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3189      +/-   ##
==========================================
- Coverage   58.03%   57.62%   -0.41%     
==========================================
  Files         357      355       -2     
  Lines       78116    78077      -39     
  Branches    13820    13822       +2     
==========================================
- Hits        45335    44993     -342     
- Misses      28607    28848     +241     
- Partials     4174     4236      +62     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This comment was marked as outdated.

@romanett
romanett requested a review from Copilot September 7, 2025 11:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 improves SubscriptionManager throughput by replacing dictionary lock-based operations with thread-safe concurrent collections, eliminating the need for explicit locking on subscription lookups and modifications.

  • Replaces Dictionary with ConcurrentDictionary for subscription storage
  • Removes lock statements around subscription dictionary operations
  • Updates dictionary operations to use thread-safe TryAdd/TryRemove methods

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread Libraries/Opc.Ua.Server/Subscription/SubscriptionManager.cs Outdated
Comment thread Libraries/Opc.Ua.Server/Subscription/SubscriptionManager.cs
Comment thread Libraries/Opc.Ua.Server/Subscription/SubscriptionManager.cs
@romanett
romanett marked this pull request as ready for review September 8, 2025 04:15
@marcschier
marcschier merged commit 487e98d into OPCFoundation:master Sep 11, 2025
75 of 77 checks passed
@romanett
romanett deleted the feat/SubscriptionManagerLocking branch September 13, 2025 12:12
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.

3 participants