A rate limiting package for .NET

Two new interesting packages are coming to .Net: System.Threading.RateLimiting and Microsoft.AspNetCore.RateLimiting.

A very good introductory article can be found here: https://devblogs.microsoft.com/dotnet/announcing-rate-limiting-for-dotnet/.

Even if this package is announced as a new feature of version 7.0, System.Threading.RateLimiting is a .Net runtime package targeting :

  • .Net Framework 4.6.1,
  • .Net Standard 2.0,
  • .Net 6.0,
  • .Net 7.0

making it a solution for all needs (It’s use is not restricted to http requests handling). The aforementioned article shows how to use it in DelegatingHandler to limit outgoing http requests but it an edge case.

Main use is obviously for processing incoming http requests. For this usage, a .Net 7.0 Microsoft.AspNetCore.RateLimiting package is also provided by Microsoft. It’s mainly a rate limiting middleware hiden behind policies. Policies are named configurations of rate limiters usable in http pipeline branches.

The design of the API seems extensible and clean, it will have to be seen in use. The only regret is that Middleware is only available for .Net 7, a non-LTS release.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s