PERFORMANCE

CSharpLoadC# load testing and CI performance gates

Load testing that feels like .NET.

CSharpLoad is a C#-first load and performance testing framework for .NET 10. Scenarios, arrival-rate or virtual-user workloads, thresholds and baselines live with the service. A passed gate exits 0. A failed threshold or regression exits 1.

checkout-load.cs
LoadTest.Create("checkout")
  .WithLoad(Load.ConstantRate(250, duration))
  .WithThresholds(thresholds)
  .ReportHtml("report.html");
24.8kREQUESTS124msP950.02%ERRORSPASS
01

C# scenarios

Write scenarios in ordinary C#. Step names are unique inside a scenario, and ScenarioContext carries state between steps. Think time, setup and teardown sit outside the measured steps.

02

HTTP, gRPC & messaging

Exercise HTTP, gRPC unary calls, WebSockets, SignalR, RabbitMQ, Kafka, ADO.NET SQL and Redis through the matching packages.

03

P95/P99 thresholds

Enforce p95, p99, error-rate and throughput thresholds in CI. A failed threshold fails the performance gate.

04

HTML & CI reports

Write JSON, Markdown, HTML and JUnit reports. GitHub Actions annotations mark failed thresholds. With no reporter configured, the run writes a console report.

05

Baselines

Compare the current run with a baseline of p95, p99, throughput and error rate. The baseline file is saved only when the complete gate passes.

06

Distributed load

Coordinate agents for a larger campaign. The coordinator probes agents, partitions the load, starts them together and merges successful nodes. Studio ingests the merged JSON report.

WHERE TEAMS USE IT

From a C# scenario to a pull-request gate

Fail the build on a real threshold

Each scenario is checked against p95, p99, error rate and throughput. The process exit code is the gate: 0 when it passes, 1 when a threshold or regression fails. JSON, JUnit and GitHub Actions annotations stay with the job, including when the gate fails.

Call the same protocols as the service

Separate packages cover HTTP, gRPC unary calls, WebSockets, SignalR, RabbitMQ, Kafka, ADO.NET and Redis. Open workloads use a constant or ramped arrival rate. Closed workloads hold or ramp a virtual-user count. WithMaxConcurrency bounds local concurrency.

Keep a baseline from a known-good run

A baseline stores p95, p99, requests per second and error rate per scenario, plus branch, commit and source. SaveBaseline writes that file only when the full gate passes. Later runs, and the CSharpLoad CLI, compare against it.

Questions about CSharpLoad

What does a failing performance gate look like in CI?

The test process returns 0 when the gate passes and 1 when a threshold or regression check fails. The CLI returns 2 when the input or a file is invalid. Archive the report even when the exit code is 1.

Which load models are supported?

Open models schedule an arrival rate, either constant or ramped. Closed models keep a virtual-user population, either fixed or ramped. WithMaxConcurrency limits local concurrency and should match the requested population on a closed workload.

Which reports can a run produce?

JSON, Markdown, HTML, JUnit XML and GitHub Actions annotations. JSON is the versioned report CSharpLoad Studio ingests. Schemas 1.0, 1.1 and 1.2 are accepted by Studio.

Can one run be spread across machines?

Yes. CSharpLoad.Distributed supplies the coordinator, and CSharpLoad.Distributed.AspNetCore hosts agents. Distributed tests should publish the merged JSON report. The distributed JSON file keeps the optional per-node detail.

PERFORMANCE

Put a C# performance gate on the next pull request.