Microsoft IIS BUG!!! , HTTP Service Request Queues Performance counter

aspx 6 Reputation points
2022-01-04T10:29:30.457+00:00

Microsoft IIS BUG!!! , HTTP Service Request Queues Performance counter

Why do I say there are bug,look at the pictures below, RejectedRequests has values from the monitor. Why CurrentQueueSize the queue have no values?

HTTP Service Request Queues (All instances):
CurrentQueueSize: Allows you to see the size if the HTTP Kernel side queue and thus to see if a huge number of requests are getting queued without being handled by the User Mode side
RejectedRequests: Allows you to see if requests are rejected from Kernel side without being handled by the User Mode side

Related topics: https://learn.microsoft.com/en-us/answers/questions/676010/about-the-iis-site-request-queue-length.html

Ask an expert to explain, please
thank you very much...

162202-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE-20220104181355.png
162221-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE-16412910652536.png

Internet Information Services
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,253 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,237 questions
ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
294 questions
{count} votes

3 answers

Sort by: Most helpful
  1. AgaveJoe 26,201 Reputation points
    2022-01-04T15:54:17.423+00:00

    I created a very simple test to exercise the CurrentQueueSize. As far as I can tell CurrentQueueSize works exactly as documented. The application pool Queue Length is set to the default 1000.

    The test consists of two pieces. A Web API application with an action that has a 2 second delay.

    [HttpGet]  
    public IActionResult Get()  
    {  
        System.Threading.Thread.Sleep(2* 1000);  
        return Ok(new { message = "Hello World!" });  
    }  
    

    And a client that starts 2000 threads.

    class Program  
        {  
            // HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.  
            static readonly HttpClient client = new HttpClient();  
      
            static async Task Main()  
            {  
                Console.WriteLine("********************");  
                Console.WriteLine("Start");  
      
                int concurentTasks = 2000;  
                Task[] tasks = new Task[concurentTasks];  
                for (int i = 0; i < concurentTasks; i++)  
                {  
                    int j = i;  
                    tasks[i] = StressTest();  
                }  
      
                await Task.WhenAll(tasks);  
      
                Console.WriteLine("********************");  
                Console.WriteLine("Done");  
            }  
      
            static async Task StressTest()  
            {  
                // Call asynchronous network methods in a try/catch block to handle exceptions.  
                try  
                {  
                    HttpResponseMessage response = await client.GetAsync("https://localhost:8443/api/values/");  
                    response.EnsureSuccessStatusCode();  
                    string responseBody = await response.Content.ReadAsStringAsync();  
                    // Above three lines can be replaced with new helper method below  
                    // string responseBody = await client.GetStringAsync(uri);  
      
                    Console.WriteLine(responseBody);  
                    //break;  
                }  
                catch (HttpRequestException e)  
                {  
                    Console.WriteLine("\nException Caught!");  
                    Console.WriteLine("Message :{0} ", e.Message);  
                }  
            }  
        }  
    

    Performance Monitor clearly shows the CurrentQueueSize has 1000 items.

    162266-capture.png

    There must be something wrong with your tests.


  2. Bruce Zhang-MSFT 3,736 Reputation points
    2022-01-05T03:30:12.427+00:00

    Hi @aspx ,

    I'm not sure how you send these requests at once and what monitor tool you use, but there's no bug of IIS queue size. @AgaveJoe 's answer has proved that performance monitor can show all requests in the queue, though he didnot change app pool queue size but use default value. Now I follow your setting, change the default queue size in app pool.

    I set application pool queue size to 20. I didnot set it to 10 for avoiding mix it with handling requests. (app pool handles 10 requests at same time by default)
    162314-1.jpg

    Then I used another tool send 205 requests at once. IIS got 1-10 request and handled them, then 11-30 request waited in the queue. The rest requests didnot handle and got error from IIS. When the 1-10 requests have been handled, 11-20 request will be handle, 21-30 request still wait in the queue. At last, 11-20 request have been handled, 21-30 request will be handle. No requests in the queue. The green line also shows the change of queue size.
    162337-2.jpg

    The tool shows that first 30 requests handled successfully but rest requests all get error.
    162386-3.jpg
    162387-4.jpg

    I think all of these prove that there's no bug of IIS.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Bruce Zhang


  3. AgaveJoe 26,201 Reputation points
    2022-01-05T13:17:26.907+00:00

    CurrentQueueLength is a real-time counter and contains values only when there are items in the queue.

    162506-capture.png

    0 comments No comments