Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion perf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ perf/ServerLoadHarness/bin/Release/net10.0/ServerLoadHarness.exe run --scenario
| `--nodes` | 100 | Values per Read/Write request, or monitored items per subscription. |
| `--inflight` | 1 | Outstanding requests per session (closed loop). |
| `--security` | `none` | `none`, `sign` or `encrypt` (Basic256Sha256). |
| `--client` | `classic` | `classic`: `Session` with the classic subscription engine. `managed`: `ManagedSession` with the V2 subscription engine (`DefaultSubscriptionEngineFactory`). |
| `--client` | `classic` | `classic`: `Session` with the classic subscription engine. `managed`: `ManagedSession` with the V2 subscription engine (`DefaultSubscriptionEngineFactory`). `shared`: classic sessions on secure channels shared through one `ClientChannelManager`, created one at a time (`--connect-parallel`). |
| `--callback` | `fast` | Classic data changes through `Subscription.FastDataChangeCallback` (`fast`) or the per-item `MonitoredItem.Notification` event (`item`). |
| `--subs`, `--pub`, `--write-interval` | 5, 100, 100 | Subscriptions per session, publishing interval and writer interval in ms (`sub`). |
| `--duration`, `--warmup` | 20, 10 | Measurement window and warm-up in seconds. |
Expand Down
30 changes: 22 additions & 8 deletions perf/ServerLoadHarness/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -301,25 +302,38 @@ await client

// classic: Session from the default session factory (classic subscription engine).
// managed: ManagedSession with the default V2 subscription engine.
// shared: classic Sessions whose secure channels come from one ClientChannelManager.
string clientKind = Arg("client", "classic");
ConfiguredEndpoint? managedEndpoint = clientKind == "managed"
ConfiguredEndpoint? endpointForBuilder = clientKind is "managed" or "shared"
? await client.GetEndpointAsync(new Uri(url), policy, selected).ConfigureAwait(false)
: null;
var channelManager = new ClientChannelManager(client.Config, telemetry);
await using ConfiguredAsyncDisposable disposeChannelManager = channelManager.ConfigureAwait(false);
var sessions = new ISession[sessionCount];
var connectTime = Stopwatch.StartNew();
await Parallel.ForAsync(
0,
sessionCount,
new ParallelOptions { MaxDegreeOfParallelism = 32 },
async (i, ct) => sessions[i] = managedEndpoint != null
? await new ManagedSessionBuilder(client.Config, telemetry)
.UseEndpoint(managedEndpoint)
new ParallelOptions { MaxDegreeOfParallelism = clientKind == "shared" ? ArgInt("connect-parallel", 1) : 32 },
Comment thread
romanett marked this conversation as resolved.
Resolved
async (i, ct) => sessions[i] = clientKind switch
{
"managed" => await new ManagedSessionBuilder(client.Config, telemetry)
.UseEndpoint(endpointForBuilder!)
.WithSessionTimeout(TimeSpan.FromSeconds(60))
.ConnectAsync(ct)
.ConfigureAwait(false)
: await client
.ConfigureAwait(false),
"shared" => await Session.CreateAsync(
channelManager,
client.Config,
endpointForBuilder!,
updateBeforeConnect: false,
sessionName: "PerfShared",
ct: ct)
.ConfigureAwait(false),
_ => await client
.ConnectAsync(new Uri(url), policy, selected)
.ConfigureAwait(false))
.ConfigureAwait(false)
})
.ConfigureAwait(false);
Console.WriteLine(FormattableString.Invariant(
$"connected {sessionCount} {clientKind} sessions ({security}) in {connectTime.ElapsedMilliseconds} ms"));
Expand Down
3 changes: 2 additions & 1 deletion perf/ab.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash
# Paired A/B runs: alternates a baseline and a candidate harness build per scenario and round.
# BASELINE: harness built in a second worktree of the commit to compare against.
# CANDIDATE: harness to compare (default: the build in this worktree).
# SCENARIOS: file with one scenario per line (default: server-scenarios.txt).
# ROUNDS: rounds per scenario (default 3). OUT: result file (default ab-results.txt).
A=${BASELINE:-C:/uabase/perf/ServerLoadHarness/bin/Release/net10.0/ServerLoadHarness.exe}
B=./ServerLoadHarness/bin/Release/net10.0/ServerLoadHarness.exe
B=${CANDIDATE:-./ServerLoadHarness/bin/Release/net10.0/ServerLoadHarness.exe}
O=${OUT:-ab-results.txt}; rm -f "$O"
ROUNDS=${ROUNDS:-3}
SCENARIOS=${SCENARIOS:-server-scenarios.txt}
Expand Down
Loading
Loading