---
title: "Comment by Parsa Aftabi on \"One Window, N Requests: Building a Rate Limiter from Scratch in Go\" | Hashnode"
description: "Nice walkthrough. Two things worth adding for anyone taking this to production. Fixed-window counters have a boundary stampede problem: a burst at the end of on"
url: "https://hashnode.com/posts/one-window-n-requests-building-a-rate-limiter-from-scratch-in-go/6ac69aa870f3f5d264eaee1c/comment/6ac96474954062902cbd3110"
---

[Discussion](https://hashnode.com/posts/one-window-n-requests-building-a-rate-limiter-from-scratch-in-go/6ac69aa870f3f5d264eaee1c)

Comment [One Window, N Requests: Building a Rate Limiter from Scratch in Go](https://hashnode.com/posts/one-window-n-requests-building-a-rate-limiter-from-scratch-in-go/6ac69aa870f3f5d264eaee1c)

[Parsa Aftabi](https://hashnode.com/@parsaaftabi)

[Oct 9](https://hashnode.com/posts/one-window-n-requests-building-a-rate-limiter-from-scratch-in-go/6ac69aa870f3f5d264eaee1c/comment/6ac96474954062902cbd3110)

Nice walkthrough. Two things worth adding for anyone taking this to production. Fixed-window counters have a boundary stampede problem: a burst at the end of one window plus a burst at the start of the next can double the intended rate. Sliding-window log or token bucket fixes it. The in-memory approach breaks the moment you run more than one replica, each instance gets its own budget. The standard production answer is a Redis-backed token bucket (a small Lua script keeps the check-and-decrement atomic). Happy to sketch it if useful.

[Utkarsh Kumar Singh](https://hashnode.com/@utkarshkrsingh)

[Oct 14](https://hashnode.com/posts/one-window-n-requests-building-a-rate-limiter-from-scratch-in-go/6ac69aa870f3f5d264eaee1c/comment/6ac96474954062902cbd3110#reply-6acfd0911bd63c6bf23bf1bc)

Thank you for pointing these out! I'm still learning about rate limiting, so this was mainly an exercise to understand the basics and implement it from scratch. I hadn't thought much about the boundary issue. Redis-backed token bucket sounds like a good next step to explore. Appreciate the suggestions!

[Parsa Aftabi](https://hashnode.com/@parsaaftabi)

[Oct 16](https://hashnode.com/posts/one-window-n-requests-building-a-rate-limiter-from-scratch-in-go/6ac69aa870f3f5d264eaee1c/comment/6ac96474954062902cbd3110#reply-6ad17b050bf62d3523e37f26)

anytime. when you get to the redis bucket, the refill side is where it gets interesting. happy to look at your sketch.
