Skip to content

[FEATURE]: Implement automatic rate limiting when all KV router workers are busy #2165

@jorgeantonio21

Description

@jorgeantonio21

Feature request

Description

Currently, when all KV router workers are busy, the system continues to accept requests which can lead to:

  • Increased latency for all requests
  • Potential system overload
  • Poor user experience during high load

Describe the problem you're encountering

Problem Statement

The HTTP service lacks automatic rate limiting mechanisms when the underlying KV router workers are at capacity. This results in no feedback to clients about service overload, with poor overall experience.

Proposed Solution

Implement a comprehensive rate limiting system that:

Queue Management: Add a configurable queue depth in the KV router scheduler
NATS Event System: Publish events when queue reaches maximum depth
HTTP Service Integration: Subscribe to "all workers busy" events and activate rate limiting
Automatic Recovery: Clear rate limits after configurable duration
Graceful Degradation: Service continues operating even if rate limiting fails

Describe alternatives you've tried

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions