Skip to content

Latest commit

 

History

History
46 lines (29 loc) · 753 Bytes

README.md

File metadata and controls

46 lines (29 loc) · 753 Bytes

Rate Limiter

A generic rate limiter implementation in Go.

Design

There are a few main concepts:

  • Identifier: Provides a way to identify the request (e.g. IPIdentifier, TokenIdentifier)
  • Store: Stores the counter (e.g. MemoryStore, FileStore, RedisStore)
  • Limiter: Decides if a call is allowed (e.g. FixedWindowLimiter, SlidingWindowLog)

I've used Fixed Window Counter algorithm for this implementation as it's space efficient and easy to implement.

Requirements

Running

In Docker

make run

Locally

make run-local

Testing

In Docker

make test

Locally

make test-local