Skip to content

Support 500 server sessions: load test, default MaxSessionCount=500, bottleneck analysis#3922

Draft
Copilot wants to merge 4 commits into
masterfrom
copilot/add-load-test-for-500-sessions
Draft

Support 500 server sessions: load test, default MaxSessionCount=500, bottleneck analysis#3922
Copilot wants to merge 4 commits into
masterfrom
copilot/add-load-test-for-500-sessions

Conversation

Copilot AI commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a 500-session server load test, raises the default session limit to 500, and documents the bottlenecks found while profiling the server at that scale.

  • Default config: ServerConfiguration.MaxSessionCount default changed 100 → 500 (ApplicationConfiguration.cs). Updated the default-value round-trip tests accordingly.
  • Load test: new [Explicit] ServerManySessionsLoadTestAsync in LoadTest.cs — 500 sessions, each a ManagedSession with one slow-publishing (1000 ms) subscription (added via ManagedSession.AddSubscription on the V2 SubscriptionManager) on a shared value node; a writer drives changes for 60 s; asserts every session receives notifications under load. Session count and duration are fixed defaults (500 sessions, 60 s). Connect is throttled (~ProcessorCount × 4), reuses a single resolved endpoint instead of per-session discovery, and retries transient connect timeouts, and the fixture runs at Warning log level to avoid per-publish logging overhead.
  • Test framework: ClientTestFramework gains a settable MaxSessionCount (applied to the server config) so fixtures can host 500+ sessions.
  • Docs: Docs/SessionScalability.md (linked from Docs/README.md) covers the new default and the profiling findings.

Bottlenecks found (ordered by impact):

  • Connection establishment dominates and is CPU-boundBasic256Sha256 RSA handshakes serialize on cores; bulk connect throughput scales with core count, and bursts surface as BadRequestTimeout. Mitigated client-side via throttling, single-endpoint reuse, and retries.
  • Request-thread-pool starvation during connect storms causes transient Publish timeouts (shared MaxRequestThreadCount pool).
  • Debug-level per-request logging measurably amplifies load.

Related Issues

Checklist

Put an x in the boxes that apply. You can complete these step by step after opening the PR.

  • ] I have signed the [CLA and read the CONTRIBUTING doc.
  • I have added tests that prove my fix is effective or that my feature works and increased code coverage.
  • I have added all necessary documentation.
  • I have verified that my changes do not introduce (new) build or analyzer warnings.
  • I ran all tests locally using the UA.slnx solution against at least .net framework and .net 10, and all passed.
  • I fixed all failing and flaky tests in the CI pipelines and all CodeQL warnings.
  • I have addressed all PR feedback received.

@CLAassistant

CLAassistant commented Jun 27, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ marcschier
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Add load test for 500 sessions with slow publishing subscription Support 500 server sessions: load test, default MaxSessionCount=500, bottleneck analysis Jun 27, 2026
Copilot AI requested a review from romanett June 27, 2026 22:11
@@ -0,0 +1,117 @@
# Server session scalability and the 500-session load test

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am not sure this is a good place for this doc, it would be better to add something to benchmarks.md or sessions.md, but not in its verbosity, ideally more "This implementation has been tested to achieve x concurrent sessions (client/server) with n subscription x m items with x config. (maybe some matrix) with the following CPU and memory usage. Then in addition to the base line test here, we create a macro benchmark and produce some numbers. What do you think?

Comment thread Tests/Opc.Ua.Sessions.Tests/LoadTest.cs
Copilot AI requested a review from romanett June 28, 2026 14:52
@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.78%. Comparing base (ba027ae) to head (a488a64).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3922      +/-   ##
==========================================
- Coverage   72.79%   72.78%   -0.01%     
==========================================
  Files         917      917              
  Lines      149563   149563              
  Branches    25918    25918              
==========================================
- Hits       108875   108861      -14     
- Misses      31236    31243       +7     
- Partials     9452     9459       +7     

see 13 files with indirect coverage changes

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

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.

4 participants