Skip to content

System.Threading.RateLimiting Sliding vs Fix windows implementation #76510

@AliKhalili

Description

@AliKhalili

Sliding window is quite similar to the fixed window approach but different in that it also has a segment per window option. Technically, we can consider fix window algorithm as a special case of sliding window algorithm for resource rate limiting. So, regarding DRY and have a more clear code base, I would suggest remove fix window internal implementation and inherit it from the sliding window class.
The only needed change is on the fix window constructor initialize base class(sliding window instance) with SegmentsPerWindow = 1.

We can also expect not remarkable performance to degrade with using an array with a segment for fix window.
I am keen to know your thoughts. Thanks
cc: @BrennanConroy

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions