Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Web Application Tuning : PerformWaitCallback

I am using dotTrace Performance 4.5 to profile a .NET 3.5 C# web application. When I record one "user request" (load of page), I see 11 threads with approximately the same timing, 7644 ms.

  • Most of the thread descriptions only contain: 100% [Native or optimized code] - 7644 ms
  • One says: 100% Microsoft.VisualStudio.WebServer.WebServerApp.Main(String[])
  • Last one reads:
    • 86% System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object)
    • 14% PerformWaitCallback (1094 ms) >> 12% = ProcessRequest

Can you tell me:

  • Why are there so many threads? (images resources, AJAX, JavaScript)
  • What is PerformWaitCallback?
  • Why 7644 ms for only 1094 ms of work?
like image 906
Francois Avatar asked Nov 21 '11 14:11

Francois


1 Answers

Why are there so many threads? (images resources, AJAX, JavaScript)

The web server creates a thread pool to manage incoming requests, and there are a number of threads in the pool.

What is PerformWaitCallback?

Don't know for sure, but it looks like the code that waits for a thread pool thread to complete its task.

Why 7644 ms for only 1094 ms of work?

It looks like the profiler is counting the time that some threads are spending waiting for new work. I haven't used dotTrace, but most profilers have a way to configure them so they can identify when threads are waiting vs. working -- based on the info you posted, I suspect the profiler isn't configured quite right.

like image 171
RickNZ Avatar answered Oct 08 '22 00:10

RickNZ