GCRA: a simple and elegant rate-limiting algorithm
A clear walkthrough of the Generic Cell Rate Algorithm (GCRA), the mechanism behind the leaky-bucket rate limiter. Instead of tracking a counter that has to be refilled on a timer, GCRA stores a single timestamp — the theoretical arrival time of the next conforming request — and decides admission with a bit of arithmetic. The post builds the intuition step by step and shows why this is both memory-cheap and pleasant to implement.