A small ASP.NET Core diagnostics lab showing common production-style problems, how to detect them, and how to improve reliability, performance, and observability.
This repository is a hands-on lab, not a production template and not an architecture showcase.
- Slow data access caused by inefficient queries
- N+1 / chatty data access caused by per-row database calls
- Missing cancellation and timeout behavior
- Sync-over-async / blocking request handling
- Poor observability and weak logging
- Reliability issues caused by unsafe external dependency calls
- Retry storms caused by uncontrolled retries
- Memory pressure caused by building large responses in memory
- Configuration problems detected too late instead of at startup
- Missing health checks for operational visibility
- Startup work that fails silently instead of failing fast
- Logging or audit sink failures leaking into business operations
- Request body memory pressure caused by buffering large uploads
dotnet restore
dotnet run --project src/DiagnosticsLab.ApiThe API uses SQLite and creates local seed data automatically.
- Problem:
GET /api/orders/slow?customerId=42 - Improved:
GET /api/orders/improved?customerId=42
2. Cancellation
- Problem:
GET /api/reports/slow - Improved:
GET /api/reports/cancellable
- Problem:
POST /api/payments/problem - Improved:
POST /api/payments/observable
- Problem:
GET /api/shipping/problem?country=CZ - Improved:
GET /api/shipping/resilient?country=CZ
- Problem:
GET /api/customers/problem?take=25 - Improved:
GET /api/customers/improved?take=25
- Problem:
GET /api/blocking/problem?delayMs=500 - Improved:
GET /api/blocking/improved?delayMs=500
- Problem:
GET /api/inventory/problem?sku=FAIL - Improved:
GET /api/inventory/improved?sku=FAIL
- Problem:
GET /api/exports/problem?rows=1000 - Improved:
GET /api/exports/improved?rows=1000
- Problem:
GET /api/config/problem - Improved: application startup validates
ExternalServices:BillingApiBaseUrl
10. Health checks
- Improved:
GET /health/liveandGET /health/ready
- Problem:
GET /api/startup/problem - Improved:
GET /api/startup/improved
- Problem:
POST /api/audit/problem - Improved:
POST /api/audit/improved
- Problem:
POST /api/uploads/problem - Improved:
POST /api/uploads/improved
dotnet testThe tests include smoke checks, scenario checks, startup validation checks, and endpoint behavior checks.
The examples are intentionally small. The goal is to make production-style problems easy to see, explain, and improve.