Ruvio.AspNetCore.RateLimiting
0.1.1
dotnet add package Ruvio.AspNetCore.RateLimiting --version 0.1.1
NuGet\Install-Package Ruvio.AspNetCore.RateLimiting -Version 0.1.1
<PackageReference Include="Ruvio.AspNetCore.RateLimiting" Version="0.1.1" />
<PackageVersion Include="Ruvio.AspNetCore.RateLimiting" Version="0.1.1" />
<PackageReference Include="Ruvio.AspNetCore.RateLimiting" />
paket add Ruvio.AspNetCore.RateLimiting --version 0.1.1
#r "nuget: Ruvio.AspNetCore.RateLimiting, 0.1.1"
#:package Ruvio.AspNetCore.RateLimiting@0.1.1
#addin nuget:?package=Ruvio.AspNetCore.RateLimiting&version=0.1.1
#tool nuget:?package=Ruvio.AspNetCore.RateLimiting&version=0.1.1
Ruvio.AspNetCore.RateLimiting
Opt-in distributed, first-request-anchored fixed-window HTTP budgets using
Ruvio's atomic LIMIT. This is middleware, not an implementation of the
in-process ASP.NET Core RateLimiter. There is no waiting queue or background task.
using Ruvio.AspNetCore.RateLimiting;
using Ruvio.Client.AspNetCore;
builder.Services.AddRuvioClient(builder.Configuration.GetSection("Ruvio"));
builder.Services.AddRuvioRateLimiting(options =>
{
options.KeyPrefix = "orders:rate:v1:";
options.PartitionKey = context =>
context.User.FindFirst("tenant_id")?.Value
?? throw new InvalidOperationException("An authenticated tenant is required.");
});
// After building the application:
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseRuvioRateLimiting();
app.MapPost("/orders", HandleOrder)
.RequireAuthorization()
.WithMetadata(new RuvioRateLimitAttribute("create-order", 100, 60));
AddRuvioClient registers the connection owner and the shared database-scoped
IRuvioClient. This middleware does not own or dispose the connection. A missing
partition is a configuration error, not an anonymous shared bucket. Configure an explicit constant for global
limits. Partition values must be trusted and bounded, not arbitrary client headers.
The partition and policy are hashed; raw identifiers are not stored in keys or
telemetry. Every application should have its own prefix.
Only opted-in endpoints resolve services or call Ruvio. Other endpoints return the next delegate's task directly: no async state machine, hashing, timers, network requests, or per-request heap allocation in the bypass path. On an opted-in endpoint there is one atomic command, no client-side counter and no extra deadline lookup. There is no change to the server's ordinary GET/SET/INCR paths.
Use the same permit count and window for every endpoint/instance sharing a policy.
Changing settings during a live window does not reset its stored state. Rejected
requests return 429 and a conservative full-window Retry-After, not an exact reset
time. Backend failures propagate to the application's exception handler; configure
that handler to return an appropriate 503. The middleware never silently fails open
or retries a possibly-applied LIMIT.
Eviction, data loss, deletion and failover can reset a budget. Use suitable memory and durability policies; this is not a billing/quota ledger. Fixed windows allow bursts around window boundaries.
Optional OpenTelemetry subscriptions: ActivitySource and Meter
Ruvio.AspNetCore.RateLimiting. Counters are accepted, rejected and errors; no
user/key tags. No exporters or telemetry worker are installed by this package.
Build/package with dotnet pack -c Release. Targets .NET 8; requires the client
and server LIMIT command. The package is versioned separately from the server.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Ruvio.Client (>= 0.3.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.