- .NET SDK 9.0 or later
- Visual Studio Code with the C# Dev Kit extension, or Visual Studio 2022 with the ASP.NET and web development workload
- Docker Desktop — required for integration tests and load tests
dotnet build --tlThe integration tests require a NATS server on localhost:4222. Start one with Docker:
docker run -p 4222:4222 -p 8222:8222 --name nats -d nats:latestThen run the tests:
dotnet testCode coverage reports are generated automatically and published to Codecov.
The load tests spin up a multi-server SignalR environment in Docker (3 SignalR servers behind a YARP proxy) and hit it with concurrent SignalR connections.
Four launch profiles are available in the Run & Debug panel:
| Profile | Backplane | Build |
|---|---|---|
| Load Test (NATS) | NATS cluster | Debug |
| Load Test (Redis) | Redis | Debug |
| Load Test Release (NATS) | NATS cluster | Release |
| Load Test Release (Redis) | Redis | Release |
Each profile automatically:
- Builds the
Stebet.SignalR.NATS.TestServerand YARP proxy Docker images viadotnet publish /t:PublishContainer - Starts the appropriate
docker-compose-nats.ymlordocker-compose-redis.ymlstack - Builds and launches the load test
- Tears down the Docker stack when the run finishes
1. Build the Docker images
dotnet publish perf/Stebet.SignalR.NATS.TestServer/Stebet.SignalR.NATS.TestServer.csproj /t:PublishContainer -p:ContainerRepository=stebet-signalr-nats-testserver -p:TargetFramework=net10.0
dotnet publish perf/Stebet.SignalR.NATS.Yarp/Stebet.SignalR.NATS.Yarp.csproj /t:PublishContainer -p:ContainerRepository=stebet-signalr-nats-yarp -p:TargetFramework=net10.02. Start the backplane stack
NATS:
docker compose -f docker-compose-nats.yml up -dRedis (for comparison):
docker compose -f docker-compose-redis.yml up -d3. Run the load test
dotnet run -c Release --project perf/Stebet.SignalR.NATS.LoadTest/Stebet.SignalR.NATS.LoadTest.csproj -f net10.04. Tear down
docker compose -f docker-compose-nats.yml down
# or
docker compose -f docker-compose-redis.yml down