Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS7 and ASP.NET how to throttle user requests

I am using ASP.NET with IIS7 and today a bug in one of my pages caused the server to go down. The script was using ajax to query a resource at a rate of ~1000 requests per second. The requests are authenticated, so I know what user requested what page.

My question is, either via IHttpModule or otherwise, how do I limit at the server-level, the max number of requests per second (or per minute) a client is allowed to make and then introduce a delay so that their requests are throttled?

like image 589
Mohamed Nuur Avatar asked Dec 12 '12 09:12

Mohamed Nuur


People also ask

How many requests per second can IIS handle?

By default IIS 8.5 can handle 5000 concurrent requests as per MaxConcurrentRequestsPerCPU settings in aspnet. config.

How are HTTP requests handled by IIS?

Protocol listeners receive protocol-specific requests, send them to IIS for processing, and then return responses to requestors. For example, when a client browser requests a Web page from the Internet, the HTTP listener, HTTP. sys, picks up the request and sends it to IIS for processing.

How does IIS process an ASP Net request?

If the response is not cached, Inetinfo.exe or DLLHost.exe processes the request, evaluating the URL to determine if the request is for static content (HTML), or dynamic content (ASP, ASP.NET or ISAPI). The response is sent back to the client and the request is logged, if IIS is configured to do so.


1 Answers

If anyone finds their way back here, you can throttle requests per user in IIS 8 and up. The setting is denyRequestByRate. The documentation is here.

like image 141
bbsimonbb Avatar answered Nov 08 '22 21:11

bbsimonbb