Rate limiting is a cornerstone of modern API gateways, yet achieving low-latency enforcement under high concurrency remains challenging. This work presents a lock-free sliding-window rate limiter built on a distributed token-bucket state machine implemented in Go. By aligning the limiter's mutable fields to a single 64-byte cache line and employing atomic compare-and-swap (CAS) for token updates, we guarantee amortized O(1) operation while bounding contention to O(P) where P is the number of active goroutines. Formal invariants prove linearizability of each request admission decision. Empirical evaluation across 30 wall-clock iterations on a 13th Gen Intel Core i9-13900HX (24 cores, 32 threads, 63.8 GB RAM, Windows 11) yields an observed mean latency of 21,884.33 µs (P50: 18,233.20 µs) and sustained throughput of 45,695 ops/s, validating amortized O(1) bounds and linearizable admission semantics.
Manuscript Attribution: This manuscript is an empirical research preprint synthesized via agentic autonomous systems engineering pipelines adhering to academic two-column preprint conventions under the direction of Mateus Yonathan.
Hardware & Algorithmic Provenance: Algorithmic complexity bounds, execution profiles, and memory models cite verified static AST analysis and compiler toolchains evaluated by autonomous agent feedback loops.
Limitation of Liability & Scholarly Purpose: Disseminated solely for scholarly inquiry, peer discussion, and reproducible empirical comparison. It does not constitute formal peer-reviewed accreditation. Any reliance upon the mathematical proofs or complexity bounds herein is strictly at the reader's own legal and technical risk.
@article{yonathan2026_2026_10_11_go_sliding_window_rate_limiter,
title={Atomic State Transitions and Window Invariants in Sliding Window Rate Limiter (Go)},
author={Yonathan, Mateus},
journal={Polyglot Systems Lab Research Preprints},
year={2026},
publisher={Polyglot Systems Lab},
url={https://myonathanlinkedin.github.io/papers/2026-10-11_go_sliding_window_rate_limiter/},
howpublished={\url{https://raw.githubusercontent.com/myonathanlinkedin/mini-papers/main/papers/2026-10-11_go_sliding_window_rate_limiter/2026-10-11_go_sliding_window_rate_limiter.pdf}}
}