LoadSurge 3.1.0
dotnet add package LoadSurge --version 3.1.0
NuGet\Install-Package LoadSurge -Version 3.1.0
<PackageReference Include="LoadSurge" Version="3.1.0" />
<PackageVersion Include="LoadSurge" Version="3.1.0" />
<PackageReference Include="LoadSurge" />
paket add LoadSurge --version 3.1.0
#r "nuget: LoadSurge, 3.1.0"
#:package LoadSurge@3.1.0
#addin nuget:?package=LoadSurge&version=3.1.0
#tool nuget:?package=LoadSurge&version=3.1.0
LoadSurge
High-performance, actor-based load testing framework for .NET.
Installation
dotnet add package LoadSurge
Quick Start
using LoadSurge.Models;
using LoadSurge.Runner;
var plan = new LoadExecutionPlan
{
Name = "API_Load_Test",
Settings = new LoadSettings
{
Concurrency = 50,
Duration = TimeSpan.FromSeconds(30),
Interval = TimeSpan.FromMilliseconds(100)
},
Action = async () =>
{
var response = await httpClient.GetAsync("https://api.example.com/health");
return response.IsSuccessStatusCode;
}
};
var result = await LoadRunner.Run(plan);
Console.WriteLine($"Total: {result.Total}, Success: {result.Success}, Failed: {result.Failure}");
Console.WriteLine($"RPS: {result.RequestsPerSecond:F1}, Avg: {result.AverageLatency:F1}ms, P95: {result.Percentile95Latency:F1}ms");
Examples
Fixed Iteration Count
var plan = new LoadExecutionPlan
{
Name = "Fixed_100_Requests",
Settings = new LoadSettings
{
Concurrency = 10,
Duration = TimeSpan.FromMinutes(5),
Interval = TimeSpan.FromMilliseconds(100),
MaxIterations = 100 // Stop after exactly 100 requests
},
Action = async () => { /* your test */ return true; }
};
Database Testing
var plan = new LoadExecutionPlan
{
Name = "DB_Pool_Test",
Settings = new LoadSettings
{
Concurrency = 100,
Duration = TimeSpan.FromMinutes(2),
Interval = TimeSpan.FromMilliseconds(50)
},
Action = async () =>
{
using var conn = new SqlConnection(connectionString);
await conn.OpenAsync();
using var cmd = conn.CreateCommand();
cmd.CommandText = "SELECT 1";
return await cmd.ExecuteScalarAsync() != null;
}
};
Configuration
Settings
| Property | Description |
|---|---|
Concurrency |
Number of parallel operations per interval |
Duration |
Total test duration |
Interval |
Time between batches |
MaxIterations |
Optional max request count |
TerminationMode |
How test stops (Duration, CompleteCurrentInterval, StrictDuration) |
GracefulStopTimeout |
Time to wait for in-flight requests (default: 30% of duration) |
RequestTimeout |
Optional per-request timeout; hung requests counted as failures |
Workload Model
LoadSurge uses an open workload model (constant arrival rate, like NBomber Inject / k6 constant-arrival-rate): iterations are injected on schedule regardless of response times. If the system under test slows down, in-flight requests accumulate — which is exactly what a load test must measure.
var config = new LoadWorkerConfiguration
{
MaxInFlight = 10_000 // optional safety cap; excess iterations are dropped and counted
};
var result = await LoadRunner.Run(plan, config);
Per-request timeout and cancellation-aware actions:
var plan = new LoadExecutionPlan
{
Name = "API_Test",
Settings = new LoadSettings
{
// ...
RequestTimeout = TimeSpan.FromSeconds(5) // hung requests counted as failures
},
// Preferred over Action: the token fires on RequestTimeout and run cancellation,
// so timed-out work is truly aborted instead of leaking in the background.
ActionWithCancellation = async token =>
{
var response = await httpClient.GetAsync(url, token);
return response.IsSuccessStatusCode;
}
};
// Cancelling returns partial results collected so far (no exception).
var result = await LoadRunner.Run(plan, config, cancellationToken);
Live progress (long runs are not a black box):
var config = new LoadWorkerConfiguration
{
Progress = new Progress<LoadProgress>(p =>
Console.WriteLine($"[{p.ElapsedSeconds:F0}s] started={p.RequestsStarted} ok={p.Success} " +
$"fail={p.Failure} inflight={p.InFlight} dropped={p.Dropped} rps={p.RequestsPerSecond:F0}")),
ProgressInterval = TimeSpan.FromSeconds(1) // default
};
Results
result.Total // Total completed requests
result.Success // Successful requests
result.Failure // Failed requests (incl. timeouts)
result.Dropped // Iterations dropped by MaxInFlight cap
result.RequestsInFlight // Still executing when the test ended
result.RequestsPerSecond // Throughput
result.AverageLatency // Mean latency (ms)
result.Percentile95Latency // P95 latency (ms)
result.Percentile99Latency // P99 latency (ms)
Samples
Runnable offline examples: dotnet run --project samples/LoadSurge.Samples
Requirements
- .NET Standard 2.0+ (.NET Framework 4.7.2+, .NET 6/8/9+)
- The
net8.0build is Native-AOT-compatible and trimmable - Zero external dependencies
Related
- xUnitV3LoadFramework - xUnit v3 integration with
[Load]attribute
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.SourceLink.GitHub (>= 10.0.300)
-
net8.0
- Microsoft.SourceLink.GitHub (>= 10.0.300)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on LoadSurge:
| Package | Downloads |
|---|---|
|
xUnitV3LoadFramework
A powerful load testing framework for .NET applications that seamlessly integrates with xUnit v3. Features actor-based architecture using Akka.NET, fluent API for test configuration, comprehensive performance metrics, and production-ready error handling. Perfect for testing APIs, databases, and web applications under load. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.1.0 | 33 | 7/12/2026 |
| 1.0.0.65 | 151 | 6/27/2026 |
| 1.0.0.63 | 159 | 6/15/2026 |
| 1.0.0.61 | 155 | 6/7/2026 |
| 1.0.0.60 | 250 | 5/4/2026 |
| 1.0.0.59 | 118 | 4/27/2026 |
| 1.0.0.58 | 161 | 4/14/2026 |
| 1.0.0.57 | 210 | 4/2/2026 |
| 1.0.0.56 | 214 | 3/14/2026 |
| 1.0.0.55 | 150 | 3/5/2026 |
| 1.0.0.54 | 121 | 3/1/2026 |
| 1.0.0.52 | 258 | 2/1/2026 |
| 1.0.0.51 | 186 | 1/18/2026 |
| 1.0.0.50 | 327 | 12/25/2025 |
| 1.0.0.49 | 537 | 12/15/2025 |
| 1.0.0.48 | 299 | 12/15/2025 |
| 1.0.0.47 | 308 | 12/15/2025 |
| 1.0.0.46 | 281 | 12/15/2025 |
| 1.0.0.45 | 353 | 12/5/2025 |
| 1.0.0.44 | 658 | 12/1/2025 |
Version 3.1.0: Removed Akka.NET - zero external dependencies. Open-workload-model engine (constant arrival rate): task-per-arrival, lock-striped metrics, allocation-free hot path. New: CancellationToken support (returns partial results), ActionWithCancellation, RequestTimeout, MaxInFlight + LoadResult.Dropped, live progress via IProgress<LoadProgress>, input validation. Multi-targets netstandard2.0 and net8.0 (AOT-compatible, trimmable). Obsolete (ignored): Mode, MaxWorkerThreads, ChannelCapacity. See CHANGELOG for details.