Sliding Window Algorithm Setup

video locked
Enroll to watch

7 mins

In this video, Gaurav Sen discusses the implementation of a rate limiter algorithm.

He defines the algorithm as an abstract class with a sliding window implementation. The client sets the algorithm and can customize for back pressure.

The algorithm is used in the "should accept" function, which decides whether a resource should be rate-limited based on the sliding window timestamps. The sliding window implementation is a list of timestamps with maximum requests per second and a service config as inputs.

The service config needs to be extracted by the client and passed to the Constructor. Finally, Gaurav discusses how to allow the service to call the method for extracting the service config.