38 lines
2.3 KiB
Markdown
38 lines
2.3 KiB
Markdown
# Router Back-Pressure Middleware (Dual-Window Rate Limiting + Circuit Breaker)
|
|
|
|
## Module
|
|
Gateway
|
|
|
|
## Status
|
|
IMPLEMENTED
|
|
|
|
## Description
|
|
Rate limiting is present in the Gateway and Graph API services. The advisory's highly detailed dual-window rate limiter with Redis/Valkey-backed environment limiter, ring counter, and custom circuit breaker pattern is not implemented as described. Standard ASP.NET rate limiting is used instead.
|
|
|
|
## What's Implemented
|
|
- Gateway middleware pipeline with request routing: `src/Gateway/StellaOps.Gateway.WebService/Middleware/RequestRoutingMiddleware.cs`
|
|
- Sender constraint middleware: `src/Gateway/StellaOps.Gateway.WebService/Middleware/SenderConstraintMiddleware.cs`
|
|
- Gateway options with configurable limits: `src/Gateway/StellaOps.Gateway.WebService/Configuration/GatewayOptions.cs`
|
|
- Gateway metrics: `src/Gateway/StellaOps.Gateway.WebService/Services/GatewayMetrics.cs`
|
|
- Standard ASP.NET rate limiting via middleware pipeline
|
|
- **Router module has advanced rate limiting** (separate from Gateway):
|
|
- `src/Router/__Libraries/StellaOps.Router.Gateway/RateLimit/EnvironmentRateLimiter.cs` -- Valkey-backed environment rate limiter with circuit breaker
|
|
- `src/Router/__Libraries/StellaOps.Router.Gateway/RateLimit/InstanceRateLimiter.cs` -- per-instance rate limiting
|
|
- `src/Router/__Libraries/StellaOps.Router.Gateway/RateLimit/RateLimitService.cs` -- rate limit service orchestrator
|
|
- `src/Router/__Libraries/StellaOps.Messaging.Transport.Valkey/ValkeyRateLimiter.cs` -- Valkey-backed distributed rate limiter
|
|
- Source: Feature matrix scan
|
|
|
|
## What's Missing
|
|
- **Gateway integration with Router rate limiting**: The Router module has Valkey-backed rate limiting and circuit breaker, but the Gateway module does not consume these services. The Gateway still uses standard ASP.NET rate limiting.
|
|
- Dual-window rate limiter with sliding window algorithm in the Gateway
|
|
- Ring counter implementation for rate tracking in the Gateway
|
|
- Unified rate limit configuration across Gateway and Router modules
|
|
|
|
## Implementation Plan
|
|
- Evaluate whether standard ASP.NET rate limiting is sufficient for current scale
|
|
- If needed, implement Redis/Valkey-backed rate limiting for distributed deployment
|
|
- Add circuit breaker pattern for downstream service protection
|
|
|
|
## Related Documentation
|
|
- Source: See feature catalog
|