Skip to content

Commit aead0d7

Browse files
author
rhamlett_microsoft
committed
Update documentation and add events for simulation tracking
1 parent 2c43acb commit aead0d7

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ The application includes a real-time dashboard at the root URL that shows:
5858
- **CPU usage** - Current processor utilization
5959
- **Memory** - Working set and GC heap sizes
6060
- **Thread pool** - Active threads and queue length
61+
- **Request latency** - Real-time probe response time (shows impact of thread pool starvation)
6162
- **Active simulations** - Currently running problem simulations
6263

6364
The dashboard uses SignalR for real-time updates and includes controls to trigger each type of simulation.
@@ -70,6 +71,7 @@ The dashboard uses SignalR for real-time updates and includes controls to trigge
7071
|----------|--------|-------------|
7172
| `/api/health` | GET | Basic health check |
7273
| `/api/health/status` | GET | Detailed health with active simulations |
74+
| `/api/health/probe` | GET | Lightweight probe for latency measurement |
7375
| `/api/metrics/current` | GET | Latest metrics snapshot |
7476
| `/api/metrics/health` | GET | Detailed health status with warnings |
7577
| `/api/admin/stats` | GET | Simulation and resource statistics |
@@ -97,7 +99,7 @@ The dashboard uses SignalR for real-time updates and includes controls to trigge
9799
**Request body (allocate):**
98100
```json
99101
{
100-
"sizeInMegabytes": 100
102+
"sizeMegabytes": 100
101103
}
102104
```
103105

@@ -221,7 +223,8 @@ src/PerfProblemSimulator/
221223
│ ├── ThreadBlockService.cs
222224
│ ├── SimulationTracker.cs
223225
│ ├── MetricsCollector.cs
224-
│ └── MetricsBroadcastService.cs
226+
│ ├── MetricsBroadcastService.cs
227+
│ └── LatencyProbeService.cs
225228
├── Hubs/ # SignalR for real-time updates
226229
│ └── MetricsHub.cs
227230
├── Models/ # Data transfer objects

docs/azure-monitoring-guide.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,46 @@ Task.Run(async () =>
188188

189189
---
190190

191+
## ⏱️ Using the Request Latency Monitor
192+
193+
The dashboard includes a **Request Latency Monitor** that demonstrates how thread pool starvation affects request processing time.
194+
195+
### How It Works
196+
197+
1. A dedicated background thread (not from the thread pool) continuously sends probe requests to `/api/health/probe`
198+
2. The probe endpoint is lightweight - it simply returns a timestamp
199+
3. Latency is measured from request start to response received
200+
4. Results are broadcast via SignalR to the dashboard
201+
202+
### What to Observe
203+
204+
| Scenario | Expected Latency | What's Happening |
205+
|----------|-----------------|------------------|
206+
| Normal operation | < 50ms | Thread pool threads are available |
207+
| Thread pool starvation | 100ms - 30s+ | Requests queued waiting for threads |
208+
| Timeout | 30s | No thread available within timeout |
209+
210+
### Key Insight
211+
212+
The probe runs on a **dedicated thread** (not from the thread pool), so it can always send requests. However, the ASP.NET Core server uses the thread pool to process incoming requests. During starvation:
213+
214+
1. The probe request is sent immediately
215+
2. The request sits in the ASP.NET Core queue
216+
3. It waits for a thread pool thread to become available
217+
4. Latency = time spent waiting + processing time
218+
219+
This directly demonstrates how sync-over-async anti-patterns impact end-user response times.
220+
221+
### Correlating with Azure Metrics
222+
223+
Compare the dashboard's latency chart with:
224+
225+
- **Application Insights** > Live Metrics > Request Duration
226+
- **App Service Metrics** > Response Time
227+
- **Thread Pool** section showing blocked threads
228+
229+
---
230+
191231
## 🛠️ Recommended Monitoring Setup
192232

193233
### 1. Enable Application Insights

0 commit comments

Comments
 (0)