Skip to content

feat: As a gateway user, I want adaptive rate limiting per consumer, so that abnormal traffic spikes can be automatically controlled #13027

@MadhuTiwari-345

Description

@MadhuTiwari-345

Description


Problem

Current rate limiting plugins such as limit-req, limit-count, and limit-concurrency use static thresholds. These limits work well for predictable traffic, but they do not adapt when a specific consumer suddenly changes behavior.

In real-world scenarios, abuse or misconfiguration often appears as sudden traffic spikes from an otherwise normal consumer. With static limits, operators must manually adjust configurations or rely on external monitoring systems.


Proposed Feature

As a gateway user, I want an optional adaptive rate limiting mode per consumer, so that the gateway can automatically respond to abnormal traffic patterns without constant manual intervention.

This could work at a high level as follows:

  • Track a rolling request baseline for each consumer (e.g., average over a recent time window).

  • Detect abnormal spikes compared to the historical baseline.

  • Temporarily tighten rate limits when abnormal behavior is detected.

  • Gradually relax limits once traffic returns to normal patterns.


Why This Is Useful

  • Improves security by mitigating sudden abuse patterns.

  • Reduces operational overhead for gateway operators.

  • Adds intelligent traffic control at the gateway level.

  • Enhances production-grade resilience without external systems.


Possible Direction

  • This could potentially be implemented:

  • As an extension to existing rate limit plugins, or

  • As a separate plugin (e.g., adaptive-limit)

  • Using shared memory or Redis to maintain rolling consumer metrics.


This is a feature proposal and not a duplicate of existing static rate limiting discussions. I would appreciate feedback on feasibility and design considerations and if any suggestions and guidance regarding this please guide me.


Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions