开发者

How can I throttle requests per minute in ASP.NET MVC?

开发者 https://www.devze.com 2023-03-28 22:01 出处:网络
I want to be able to say that if a request from the same user (for an API) starts to happen quickly enough that their requests per minute reaches a certain level, I want to start denying the requests

I want to be able to say that if a request from the same user (for an API) starts to happen quickly enough that their requests per minute reaches a certain level, I want to start denying the requests until it slows down. (Just like the guys at Zendesk did).

The question is two fold, what's an efficient way of calculating the request rate (minimal DB read/writes) and where in th开发者_开发问答e MVC hierarchy (Action filter, Controller method override?) would this code best reside?


Two words, Reactive Framework.

It has all sorts of candy and sugary syntax to get throttling and managing of events to become less and less of a head ache, while I would bet will trickle back through and kill some complexity down stream.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号