0

I've got an ASP.NET web API serving REST requests. One of the methods (accessing external resources) takes between 8 and 10 seconds to complete. When I test on my development machine, with IISExpress, with 3 requests in parallel, each one of those takes between 8 and 10 seconds to complete. Perfect.

But, as soon as I deploy the web service in IIS 8.5 (Windows Server 2012 R2), when I do the same test, the third request always takes 16 seconds, waiting for the other 2 to finish first. In fact, IIS does not invoke the method before a "slot" is available.

How can I increase this "limit" (if this is one)? I've read a lot of discussions about thread and worker processes here and there, I've tried some but with no success.

UPDATE I've tried increasing the Maximum Worker Processes option in IIS from 1 to 10 without any success.

  • I'm driving card printers, and those 8 seconds is the time the printer takes to process a card. This is almost purely "mechanical" time. – Laurent PerrucheJ Jan 04 '19 at 10:46
  • can you take a look at this answer, and see if you have the same ? : https://stackoverflow.com/questions/12284530/asp-net-server-does-not-process-pages-asynchronously/12285168#12285168 – Aristos Jan 04 '19 at 11:12
  • @aristos I don't manage any sessions, and the method does not access any common resources that would be lock by another other methods. This is purely self contained method. – Laurent PerrucheJ Jan 04 '19 at 11:24
  • `And I'm testing with a specific application I've designed to simulate multiple concurrent calls` What language is that application written in? Is there a particular reason you aren't using a pre-existing load testing tool like JMeter? – mjwills Jan 04 '19 at 11:29
  • @mjwills C# WPF .NET 4.7.2, using Task.Factory.StartNew. I also logs the time at which each REST request is send to IIS from this side, and I see a clear 8 seconds delay between the sending of the request and the first line of log in the method. – Laurent PerrucheJ Jan 04 '19 at 11:33
  • The issue is likely in your `specific application`. By default, .NET apps will do only 2 concurrent web requests to a given web server. My duplicate shows how to increase that value. – mjwills Jan 04 '19 at 11:35
  • @mjwills Thanks a million times man, you saved my week ! :) That was it :) – Laurent PerrucheJ Jan 04 '19 at 12:30
  • @LaurentPerrucheJ I'm also facing the same issue, I have one service class which is making 15 web request parallelly and taking longer time than expected. It's taking around 30 seconds to complete it. Would you please help me how can I fix it. Thanks – Vikas Jan 07 '20 at 08:12
  • @Vikas My issue was with the client application, not with the web service. Once I set the ServicePointManager.DefaultConnectionLimit to another number X, I was able to send X requests in parallel to the web service without any issue. Hope it helps. – Laurent PerrucheJ Jan 08 '20 at 09:46

0 Answers0