Running ASP.NET applications on IIS? Do you understand how requests are processed by every component involved: IIS Native, IIS Modules, and ASP.NET?
Scaling any type of application requires you to understand the inner workings of IIS and ASP.NET so queues and pools don’t become a bottleneck in your end-to-end execution flow.
Join us for this webcast that shows you how to identify performance and scalability hotspots under different load conditions.
You'll learn:
How communication flows between browser, IIS, ASP.NET and back-end services including database
How to monitor and tweak IIS and ASP.NET queues and pools to achieve optimal performance
How to troubleshoot performance hotspots in IIS, Native and Managed Modules and ASP.NET
How to identify synchronization issues in multi-threaded applications
You will leave with specific ideas of where to start optimizing your queues, pools, and code implementation.
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Troubleshooting ASP.NET and IIS Scalability Hotspots
1. Please Standby:
Webcast to Begin Shortly
Unable to listen via your speakers?
Dial in:
Toll Free: (877) 309-2074
Access Code: 119-063-034
International: Click “telephone” in audio section,
then click “additional numbers”
Troubleshooting
ASP.NET and IIS
Scalability Hotspots
8. Online Banking: Slow Balance Check
1.69m (=101s!) To
Check Balance!
87% spent in IIS
9. Time really spent in IIS
Tip: Elapsed Time tells us WHEN a
Method was executed!
Finding: Thread 32 in IIS waited 87s to
pass control to Thread 30 in ASP.NET
Tip: Thread# gives us insight on
Thread Queues / Switches
13. Arrival Rate
• Rate at which requests are arriving in the queue
• Perfmon Counter: Http Service Request QueuesArrivalRate
• Should be >= W3WP_W3SVCRequests / sec
Confidential, Dynatrace LLC
IIS/ASP.net Metrics
14. MaxQueueItemAge
• Incoming requests are waiting at this long to be processed
• Perfmon Counter: Http Service Request
QueuesMaxQueueItemAge
Confidential, Dynatrace LLC
IIS/ASP.net Metrics
15. CLR ThreadPool Queue
• Requests are queued if all the CLR threads are busy
• Perfmon Counter: ASP.NET v4.0.30319/Requests Queued
• Symptom: ASP.net returns 503 Service Unavailable
Confidential, Dynatrace LLC
IIS/ASP.net Metrics
16. Number of Free DB Connections
• Number of free ADO.net connections available
• Perfmon Counter: .Net Data Provider for
SqlServer/NumberOfFreeConnections
• Alert: If value == 0
Confidential, Dynatrace LLC
ADO.Net Metrics
17. Number of Active DB Connections
•Number of Active ADO.net connections
•Perfmon Counter: .Net Data Provider for
SqlServer/NumberOfActiveConnections
Confidential, Dynatrace LLC
ADO.Net Metrics
29. Load vs. Memory vs Response Time vs. Threads
Confidential, Dynatrace LLC
Increasing Memory
Avg Response Time:
Increases over Time
Max Response Time
correlates with # Threads
Max Response Time
correlates with # Threads
Load: System can’t handle
constant load over time
# of Worker Threads
increase with constant load
Layer Breakdown:
Performance Problem is in
their own code (Sync Time)
30. 96% Synchronization Time
Confidential, Dynatrace LLC
Monitor.Enter: By far biggest
performance contributor
Called from GetStatus and
_GetDebugStatus. Why also
from Debug method? Bug?
31. Excessive file attribute access second hotspot
Confidential, Dynatrace LLC
Can FileExist check
be cached to reduce
File Access?
File Access next hotspots
32. • # of Threads vs # Incoming
Requests
• Time Spent in Sync
• Time Spent in I/O
Confidential, Dynatrace LLC
Tips To Apply
34. Frustrated user report bad response times
Confidential, Dynatrace LLC
Frustrated User
Slow Page Load caused by Browser JS Time
Slow Page Load caused by Server-Side Processi
35. Really slow page
Confidential, Dynatrace LLC
6.8s to deliver Default.aspx page
Involved Web Parts
Most of the Time spent
In waiting
36. WebPart uses multiple parallel threads
Confidential, Dynatrace LLC
Async Threads are busy with I/O
37. First remote call is very slow
Confidential, Dynatrace LLC
Web Service call by ContentEditorWebPart
HttpWebRequests uses ServicePoint internally
First Web Serivce Requests takes 5.8s to return
38. Thread limit lets all other threads wait!
Confidential, Dynatrace LLC
We have 10 parallel calls in our background threads
The other background threads spend their time
“waiting” in the ServicePoint
Got lot of complaints. High risk of losing customers. Always a bank around the corner.
Looking from left to right, we see …..
Http Service Request Queues\ArrivalRate" counter exceeds the"W3WP_W3SVC\Requests / sec" counter for the application pool's worker process over a period of time. This basically implies that more requests are coming into the system than are being processed, and this always eventually results in queueing.
"Http Service Request Queues\MaxQueueItemAge" performance counter increasing. This means IIS is falling behind in request processing, so all incoming requests are waiting at least this long to begin getting processed.
ASP.NET queues all incoming requests to the CLR threadpool.
Behavior: If all CLR threads are busy, requests can queue up here up to the configuredprocessModel/requestQueueLimit. When there are more than this many total requests (executing + queued), ASP.NET returns 503 Service Unavailable.
NOTE: Any async modules also re-post requests to the CLR threadpool, so requests can become “re-queued” again later in the request processing.
In Classic mode, ASP.NET will queue all incoming requests to the per-application queue when there are not enough threads.
Behavior: The threads available for request processing are determined by available threads in the CLR thread pool, minus the reserved threads set by the httpRuntime/minFreeThreads andhttpRuntime/minFreeLocalThreads attributes.
NOTE: This queue has poor performance, and does not guarantee FIFO in application pools with multiple applications (because threads are shared between multiple apps, so a single app can starve the other applications of available threads).