Skip to content

Commit a92fc3d

Browse files
author
rhamlett_microsoft
committed
Fixes for slow request simulation and dashboard display.
1 parent 34ade1c commit a92fc3d

5 files changed

Lines changed: 110 additions & 175 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ The CPU and Memory metric tiles use dynamic color coding based on utilization pe
150150
```
151151

152152
The slow request simulator generates requests using three different sync-over-async patterns:
153-
- **SimpleSyncOverAsync**: Direct `.Wait()` blocking - look for `FetchDataAsync_BLOCKING_HERE` in traces
153+
- **SimpleSyncOverAsync**: Blocking calls - look for `FetchDataSync_BLOCKING_HERE`, `ProcessDataSync_BLOCKING_HERE`, `SaveDataSync_BLOCKING_HERE` in traces
154154
- **NestedSyncOverAsync**: Sync methods that block internally - look for `*_BLOCKS_INTERNALLY` methods
155-
- **DatabasePattern**: Realistic `GetAwaiter().GetResult()` - look for `*_SYNC_BLOCK` methods
155+
- **DatabasePattern**: Simulated database/HTTP blocking - look for `*Sync_SYNC_BLOCK` methods
156156

157157
### Admin Operations
158158

docs/azure-monitoring-guide.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,13 @@ This simulation is designed for **training developers to identify blocking calls
218218

219219
The service uses three different sync-over-async patterns with **intentionally descriptive method names**:
220220

221-
#### Scenario 1: Simple Sync-Over-Async
222-
Look for method: `FetchDataAsync_BLOCKING_HERE`
221+
#### Scenario 1: Simple Blocking
222+
Look for methods: `FetchDataSync_BLOCKING_HERE`, `ProcessDataSync_BLOCKING_HERE`, `SaveDataSync_BLOCKING_HERE`
223223
```
224-
This shows a direct .Wait() call on the async method.
225-
In the profiler, you'll see threads blocked at:
226-
→ SlowRequestService.FetchDataAsync_BLOCKING_HERE
227-
Task.Wait()
224+
These methods use Thread.Sleep to block - clearly visible in profiler.
225+
In the profiler, you'll see time spent at:
226+
→ SlowRequestService.FetchDataSync_BLOCKING_HERE
227+
Thread.Sleep
228228
```
229229

230230
#### Scenario 2: Nested Sync Methods
@@ -238,12 +238,14 @@ These are synchronous methods that internally call .Wait():
238238
```
239239

240240
#### Scenario 3: Database/HTTP Pattern
241-
Look for methods ending in: `_SYNC_BLOCK`
241+
Look for methods ending in: `Sync_SYNC_BLOCK`
242242
```
243-
Realistic patterns using GetAwaiter().GetResult():
244-
→ GetCustomerFromDatabaseAsync_SYNC_BLOCK
245-
→ CallExternalApiAsync_SYNC_BLOCK
246-
→ SaveAuditLogAsync_SYNC_BLOCK
243+
Simulated database and HTTP blocking calls:
244+
→ GetCustomerFromDatabaseSync_SYNC_BLOCK
245+
→ GetOrderHistoryFromDatabaseSync_SYNC_BLOCK
246+
→ CheckInventoryServiceSync_SYNC_BLOCK
247+
→ GetRecommendationsFromMLServiceSync_SYNC_BLOCK
248+
→ BuildResponseSync_SYNC_BLOCK
247249
```
248250

249251
### Recommended Settings for CLR Profiler (60s trace)

src/PerfProblemSimulator/Controllers/SlowRequestController.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ public IActionResult GetScenarios()
127127
{
128128
["SimpleSyncOverAsync"] = new ScenarioInfo
129129
{
130-
Name = "Simple Sync-Over-Async",
131-
Description = "Direct .Result and .Wait() calls on async methods",
132-
WhatProfilerShows = "Time blocked at Task.Result, Task.Wait(), and ManualResetEventSlim.Wait",
130+
Name = "Simple Blocking",
131+
Description = "Direct Thread.Sleep blocking calls that consume time in profiler",
132+
WhatProfilerShows = "Time spent in Thread.Sleep - clearly visible as method self-time",
133133
MethodsToLookFor = new[]
134134
{
135-
"FetchDataAsync_BLOCKING_HERE",
136-
"ProcessDataAsync_BLOCKING_HERE",
137-
"SaveDataAsync_BLOCKING_HERE"
135+
"FetchDataSync_BLOCKING_HERE",
136+
"ProcessDataSync_BLOCKING_HERE",
137+
"SaveDataSync_BLOCKING_HERE"
138138
}
139139
},
140140
["NestedSyncOverAsync"] = new ScenarioInfo
@@ -153,15 +153,15 @@ public IActionResult GetScenarios()
153153
["DatabasePattern"] = new ScenarioInfo
154154
{
155155
Name = "Database/HTTP Pattern",
156-
Description = "GetAwaiter().GetResult() pattern common in legacy code migrations",
157-
WhatProfilerShows = "Multiple GetAwaiter().GetResult() calls simulating database and HTTP calls",
156+
Description = "Simulated database and HTTP blocking calls",
157+
WhatProfilerShows = "Time spent in methods simulating database queries and HTTP calls",
158158
MethodsToLookFor = new[]
159159
{
160-
"GetCustomerFromDatabaseAsync_SYNC_BLOCK",
161-
"GetOrderHistoryFromDatabaseAsync_SYNC_BLOCK",
162-
"CheckInventoryServiceAsync_SYNC_BLOCK",
163-
"GetRecommendationsFromMLServiceAsync_SYNC_BLOCK",
164-
"BuildResponseAsync_SYNC_BLOCK"
160+
"GetCustomerFromDatabaseSync_SYNC_BLOCK",
161+
"GetOrderHistoryFromDatabaseSync_SYNC_BLOCK",
162+
"CheckInventoryServiceSync_SYNC_BLOCK",
163+
"GetRecommendationsFromMLServiceSync_SYNC_BLOCK",
164+
"BuildResponseSync_SYNC_BLOCK"
165165
}
166166
}
167167
};

0 commit comments

Comments
 (0)