Skip to content

Commit 849d4f0

Browse files
author
rhamlett_microsoft
committed
Updated documentation, added Procdump info, cleaned up code block displays
1 parent c01fd97 commit 849d4f0

File tree

5 files changed

+260
-0
lines changed

5 files changed

+260
-0
lines changed

.vscode/launch.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Launch PerfProblemSimulator",
6+
"type": "coreclr",
7+
"request": "launch",
8+
"preLaunchTask": "build",
9+
"program": "${workspaceFolder}/src/PerfProblemSimulator/bin/Debug/net10.0/PerfProblemSimulator.dll",
10+
"args": [],
11+
"cwd": "${workspaceFolder}/src/PerfProblemSimulator",
12+
"stopAtEntry": false,
13+
"serverReadyAction": {
14+
"action": "openExternally",
15+
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
16+
},
17+
"env": {
18+
"ASPNETCORE_ENVIRONMENT": "Development"
19+
}
20+
}
21+
]
22+
}

.vscode/tasks.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/src/PerfProblemSimulator/PerfProblemSimulator.csproj",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary;ForceNoAlign"
13+
],
14+
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"label": "watch",
18+
"command": "dotnet",
19+
"type": "process",
20+
"args": [
21+
"watch",
22+
"run",
23+
"--project",
24+
"${workspaceFolder}/src/PerfProblemSimulator/PerfProblemSimulator.csproj"
25+
],
26+
"problemMatcher": "$msCompile"
27+
}
28+
]
29+
}

docs/azure-monitoring-guide.md

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

189189
---
190190

191+
## 💥 Diagnosing Application Crashes
192+
193+
### Symptoms
194+
195+
- Application suddenly becomes unavailable
196+
- HTTP 502/503 errors returned to clients
197+
- Azure auto-restarts the application
198+
- Event logs show process termination
199+
200+
### Azure Crash Monitoring
201+
202+
Azure App Service includes built-in Crash Monitoring that can automatically capture memory dumps when your application crashes.
203+
204+
#### Enabling Crash Monitoring
205+
206+
1. Navigate to your App Service in the Azure Portal
207+
2. Go to **Diagnose and solve problems**
208+
3. Search for "Crash Monitoring"
209+
4. Enable crash dump collection
210+
211+
> **⚠️ Important: Storage Account Restrictions**
212+
>
213+
> In some Azure environments, Crash Monitoring may not work due to security restrictions on storage accounts. If you cannot use Crash Monitoring, you can collect memory dumps manually using **ProcDump** from the Kudu console.
214+
215+
### Using ProcDump for Manual Dump Collection
216+
217+
[ProcDump](https://learn.microsoft.com/en-us/sysinternals/downloads/procdump) is a Sysinternals command-line utility that can monitor applications and generate crash dumps. It's available on Azure App Service through the Kudu console.
218+
219+
#### Accessing the Kudu Console
220+
221+
1. Navigate to your App Service
222+
2. Go to **Development Tools** > **Advanced Tools**
223+
3. Click **Go** to open Kudu
224+
4. Select **Debug console** > **CMD** or **PowerShell**
225+
226+
#### Common ProcDump Commands
227+
228+
```bash
229+
# Write a full memory dump of a process by name
230+
procdump -ma w3wp.exe
231+
232+
# Write a full dump when an unhandled exception occurs
233+
procdump -ma -e w3wp.exe
234+
235+
# Write a full dump on 1st or 2nd chance exception
236+
procdump -ma -e 1 w3wp.exe
237+
238+
# Write up to 10 dumps, one per exception
239+
procdump -ma -n 10 -e 1 w3wp.exe
240+
241+
# Write a dump when CPU exceeds 80% for 10 seconds
242+
procdump -ma -c 80 -s 10 w3wp.exe
243+
244+
# Write a dump when memory exceeds 1GB
245+
procdump -ma -m 1024 w3wp.exe
246+
247+
# Write a dump when a hung window is detected
248+
procdump -ma -h w3wp.exe
249+
```
250+
251+
#### ProcDump Options Reference
252+
253+
| Option | Description |
254+
|--------|-------------|
255+
| `-ma` | Full dump (all memory) |
256+
| `-mm` | Mini dump (default, smaller size) |
257+
| `-mp` | MiniPlus dump (detailed but 10-75% smaller than full) |
258+
| `-e` | Dump on unhandled exception (add `1` for first-chance) |
259+
| `-c` | CPU threshold percentage |
260+
| `-m` | Memory commit threshold in MB |
261+
| `-n` | Number of dumps to write before exiting |
262+
| `-s` | Consecutive seconds before dump (default 10) |
263+
| `-h` | Dump on hung window |
264+
| `-t` | Dump on process termination |
265+
266+
#### Downloading the Dump File
267+
268+
1. In Kudu, navigate to the folder where the dump was created
269+
2. Click the download icon next to the `.dmp` file
270+
3. Open the dump in Visual Studio, WinDbg, or another debugger
271+
272+
---
273+
191274
## ⏱️ Using the Request Latency Monitor
192275

193276
The dashboard includes a **Request Latency Monitor** that demonstrates how thread pool starvation affects request processing time.

src/PerfProblemSimulator/wwwroot/azure-monitoring-guide.html

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
font-family: 'Cascadia Code', 'Consolas', monospace;
108108
font-size: 0.875rem;
109109
line-height: 1.6;
110+
white-space: pre;
110111
}
111112

112113
.code-block .comment { color: #6a9955; }
@@ -291,6 +292,7 @@ <h1>☁️ Azure Monitoring Guide</h1>
291292
<li><a href="#cpu">Diagnosing High CPU</a></li>
292293
<li><a href="#memory">Diagnosing Memory Pressure</a></li>
293294
<li><a href="#threads">Diagnosing Thread Pool Starvation</a></li>
295+
<li><a href="#crash">Diagnosing Application Crashes</a></li>
294296
<li><a href="#latency">Latency Monitor</a></li>
295297
<li><a href="#setup">Monitoring Setup</a></li>
296298
<li><a href="#best-practices">Best Practices</a></li>
@@ -495,6 +497,129 @@ <h3>Code Pattern (What's Wrong)</h3>
495497
</div>
496498
</section>
497499

500+
<!-- Diagnosing Application Crashes Section -->
501+
<section id="crash" class="doc-section">
502+
<h2>💥 Diagnosing Application Crashes</h2>
503+
504+
<h3>Symptoms</h3>
505+
<ul>
506+
<li>Application suddenly becomes unavailable</li>
507+
<li>HTTP 502/503 errors returned to clients</li>
508+
<li>Azure auto-restarts the application</li>
509+
<li>Event logs show process termination</li>
510+
</ul>
511+
512+
<h3>Azure Crash Monitoring</h3>
513+
<p>Azure App Service includes built-in Crash Monitoring that can automatically capture memory dumps when your application crashes.</p>
514+
515+
<h4>Enabling Crash Monitoring</h4>
516+
<ol>
517+
<li>Navigate to your App Service in the Azure Portal</li>
518+
<li>Go to <strong>Diagnose and solve problems</strong></li>
519+
<li>Search for "Crash Monitoring"</li>
520+
<li>Enable crash dump collection</li>
521+
</ol>
522+
523+
<div class="info-box">
524+
<h4>⚠️ Important: Storage Account Restrictions</h4>
525+
<p>In some Azure environments, Crash Monitoring may not work due to security restrictions on storage accounts. If you cannot use Crash Monitoring, you can collect memory dumps manually using <strong>ProcDump</strong> from the Kudu console.</p>
526+
</div>
527+
528+
<h3>Using ProcDump for Manual Dump Collection</h3>
529+
<p><a href="https://learn.microsoft.com/en-us/sysinternals/downloads/procdump" target="_blank">ProcDump</a> is a Sysinternals command-line utility that can monitor applications and generate crash dumps. It's available on Azure App Service through the Kudu console.</p>
530+
531+
<h4>Accessing the Kudu Console</h4>
532+
<ol>
533+
<li>Navigate to your App Service</li>
534+
<li>Go to <strong>Development Tools</strong> &gt; <strong>Advanced Tools</strong></li>
535+
<li>Click <strong>Go</strong> to open Kudu</li>
536+
<li>Select <strong>Debug console</strong> &gt; <strong>CMD</strong> or <strong>PowerShell</strong></li>
537+
</ol>
538+
539+
<h4>Common ProcDump Commands</h4>
540+
<div class="code-block">
541+
<span class="comment"># Write a full memory dump of a process by name</span>
542+
procdump -ma w3wp.exe
543+
544+
<span class="comment"># Write a full dump when an unhandled exception occurs</span>
545+
procdump -ma -e w3wp.exe
546+
547+
<span class="comment"># Write a full dump on 1st or 2nd chance exception</span>
548+
procdump -ma -e 1 w3wp.exe
549+
550+
<span class="comment"># Write up to 10 dumps, one per exception</span>
551+
procdump -ma -n 10 -e 1 w3wp.exe
552+
553+
<span class="comment"># Write a dump when CPU exceeds 80% for 10 seconds</span>
554+
procdump -ma -c 80 -s 10 w3wp.exe
555+
556+
<span class="comment"># Write a dump when memory exceeds 1GB</span>
557+
procdump -ma -m 1024 w3wp.exe
558+
559+
<span class="comment"># Write a dump when a hung window is detected</span>
560+
procdump -ma -h w3wp.exe
561+
</div>
562+
563+
<h4>ProcDump Options Reference</h4>
564+
<table class="latency-table">
565+
<thead>
566+
<tr>
567+
<th>Option</th>
568+
<th>Description</th>
569+
</tr>
570+
</thead>
571+
<tbody>
572+
<tr>
573+
<td><code>-ma</code></td>
574+
<td>Full dump (all memory)</td>
575+
</tr>
576+
<tr>
577+
<td><code>-mm</code></td>
578+
<td>Mini dump (default, smaller size)</td>
579+
</tr>
580+
<tr>
581+
<td><code>-mp</code></td>
582+
<td>MiniPlus dump (detailed but 10-75% smaller than full)</td>
583+
</tr>
584+
<tr>
585+
<td><code>-e</code></td>
586+
<td>Dump on unhandled exception (add <code>1</code> for first-chance)</td>
587+
</tr>
588+
<tr>
589+
<td><code>-c</code></td>
590+
<td>CPU threshold percentage</td>
591+
</tr>
592+
<tr>
593+
<td><code>-m</code></td>
594+
<td>Memory commit threshold in MB</td>
595+
</tr>
596+
<tr>
597+
<td><code>-n</code></td>
598+
<td>Number of dumps to write before exiting</td>
599+
</tr>
600+
<tr>
601+
<td><code>-s</code></td>
602+
<td>Consecutive seconds before dump (default 10)</td>
603+
</tr>
604+
<tr>
605+
<td><code>-h</code></td>
606+
<td>Dump on hung window</td>
607+
</tr>
608+
<tr>
609+
<td><code>-t</code></td>
610+
<td>Dump on process termination</td>
611+
</tr>
612+
</tbody>
613+
</table>
614+
615+
<h4>Downloading the Dump File</h4>
616+
<ol>
617+
<li>In Kudu, navigate to the folder where the dump was created</li>
618+
<li>Click the download icon next to the <code>.dmp</code> file</li>
619+
<li>Open the dump in Visual Studio, WinDbg, or another debugger</li>
620+
</ol>
621+
</section>
622+
498623
<!-- Using the Request Latency Monitor Section -->
499624
<section id="latency" class="doc-section">
500625
<h2>⏱️ Using the Request Latency Monitor</h2>

src/PerfProblemSimulator/wwwroot/documentation.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
font-family: 'Cascadia Code', 'Consolas', monospace;
103103
font-size: 0.875rem;
104104
line-height: 1.6;
105+
white-space: pre;
105106
}
106107

107108
.code-block .comment { color: #6a9955; }

0 commit comments

Comments
 (0)