Optimization of IIS and ASP.net for Max Requests / Second

I need a web application to be able to handle a very large number of requests per second, while keeping the response time pretty low (less than ~ 70 ms).

For testing purposes, I downloaded 3 instances of c4.xlarge ec2 and placed them in an elastic load balancer.

I have a method that looks like this.

[HttpPost] [Route("api/test/rps")] public IHttpActionResult TestRequestsPerSecond(MediumSizedObject testObj) { return new StatusCodeResult(HttpStatusCode.NoContent, Request); } 

I expected one of these instances to be able to process many thousands of requests per second (since it does practically nothing). To my surprise, I had problems processing 300 requests per second without reaching the maximum CPU, and requests began to queue.

Here we consider the performance of one of the instances with a speed of about 240 requests per second.

Performance monitor

As you can see, I already have 19 requests in the queue, and the processor is 78%. (Also my context switches jump about 8-9K, which seems high).

This happens on all three servers.

Things I changed on the server

machine.config matching lines

  <processModel autoConfig="true" maxWorkerThreads="100" maxIoThreads="100" minWorkerThreads="50" minIoThreads="50" /> <httpRuntime minFreeThreads="176" minLocalRequestFreeThreads="152" /> 

production network (possibly) matching rows

 <system.web> <sessionState mode="Off" /> <authentication mode="None" /> <compilation targetFramework="4.5" /> <httpRuntime targetFramework="4.5" /> </system.web> <system.webServer> <modules> <remove name="FormsAuthentication" /> <remove name="PassportAuthentication" /> <remove name="Profile" /> <remove name="AnonymousIdentification" /> <remove name="WindowsAuthentication" /> </modules> <handlers> <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> <remove name="OPTIONSVerbHandler" /> <remove name="TRACEVerbHandler" /> <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> </handlers> </system.webServer> 

I tried using the default machine.config file, and it was a little worse.

For some reason, about 130 requests per second, we are only 30% CPU, and almost no requests are in the queue.

There must be some kind of magical setting that I'm missing. Is this grade for a course with IIS? Is it possible that WebAPI 2 is to blame? (I'm going to check out Nancy or ServiceStack if anyone thinks they will help at all).

Do I need more copies?

Any suggestions or things to look for, the setting will be great.

(I got a WebApi Action to see if this has changed, but itโ€™s not)

+6
source share
1 answer

You must set the autoconfig value in the processModel element to false before any other attributes that you change in the processModel element take effect.

0
source

Source: https://habr.com/ru/post/988964/


All Articles