neo112
neo112

Reputation: 1773

IIS not handling WebApi requests asynchonously

I have this endpoint defined in ApiController:

 public async Task<IHttpActionResult> GetAsync()
 {
     await Task.Delay(1000);
     return Ok("getasync");
 }

I'm running Apache Benchmark to run 50 concurrent requests on it like this:

ab -c50 -n50 http://localhost/api/hello/getasync

Requests completed in IIS:        5050ms
Requests completed in IISExpress: 1080ms  

It seems that on IIS these requests are not handled asynchonously, but rather like there is only 10 threads serving requests synchonously.

I've also tested this by proxying http requests through WebApi (using HttpClient) to a nodejs endpoint that responds after a 1000ms delay. I see similar results, the code seems to run async in IISExpress but synchronously in IIS.

I've also disable session state in IIS, but this had no effect.

Both tests are run on Windows 8.1. IIS version is 8.5.

Can anyone point out why IIS is not handling these requests asynchonously?

Upvotes: 2

Views: 173

Answers (1)

usr
usr

Reputation: 171178

only 10 threads

Indeed, on non-server editions of Windows IIS is limited to 10 concurrent requests.

Besides that you have done everything right and should see nearly arbitrary throughput if you increase the number of concurrent requests.

Upvotes: 3

Related Questions