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.
There must be something wrong with your tests.