Roslyn-Stone Load Tests
This project contains load tests for the Roslyn-Stone MCP server HTTP transport.
Overview
The load tests simulate concurrent requests to the MCP server to ensure it can handle multiple simultaneous clients. Tests include:
- Simple expression evaluation
- Variable assignment
- LINQ queries
- NuGet package search
Prerequisites
The load test requires the RoslynStone.Api server to be running in HTTP mode.
Start the Server
cd src/RoslynStone.Api
MCP_TRANSPORT=http dotnet run
The server will start on http://localhost:7071 by default.
Running Load Tests
Using .NET CLI
dotnet run --project tests/RoslynStone.LoadTests
Custom Configuration
# Custom base URL, concurrency, and rounds
dotnet run --project tests/RoslynStone.LoadTests -- http://localhost:8080 500 20
Arguments:
- Base URL (default:
http://localhost:7071) - Concurrency (default:
300requests per round) - Rounds (default:
10)
Using Cake Build Script
dotnet cake --target=Load-Test
Test Configuration
Default settings:
- Concurrency: 300 concurrent requests per round
- Rounds: 10 rounds per scenario
- Total Requests: 12,000 (300 × 10 × 4 scenarios)
Test Scenarios
- Simple Expression -
2 + 2 - Variable Assignment -
var x = 10; x * 2 - LINQ Query -
Enumerable.Range(1, 100).Where(x => x % 2 == 0).Sum() - NuGet Search - Search for "Newtonsoft.Json"
Metrics Reported
For each scenario:
- Average Round Time - Time to complete all concurrent requests
- Average Response Time - Per-request response time
- Success Rate - Percentage of successful requests
- Throughput - Requests per second
- Total Success/Failures - Count of successful and failed requests
Expected Results
A healthy server should achieve:
- ✅ Success rate > 99%
- ✅ Average response time < 100ms for simple operations
- ✅ Throughput > 1000 requests/second
Troubleshooting
Server Not Available
❌ Server is not available: Connection refused
Solution: Start the server first:
cd src/RoslynStone.Api
MCP_TRANSPORT=http dotnet run
High Failure Rate
If you see a success rate below 99%:
- Check server logs for errors
- Verify server has adequate resources
- Reduce concurrency level
- Check network connectivity
Timeout Errors
If requests are timing out:
- Increase the timeout in
Program.cs - Check server performance
- Reduce concurrency level
Performance Tuning
To optimize server performance:
- Run in Release configuration
- Use production-ready hosting (Kestrel optimizations)
- Enable response compression
- Configure appropriate thread pool sizes
- Monitor memory usage and GC pressure
CI Integration
Load tests are optional in CI and can be run manually:
- They require a running server instance
- Results should be monitored for performance regressions
- Consider using dedicated load testing infrastructure