How agnivesh13/aegis-distributed-limiter works
Aegis is a distributed rate-limiting HTTP gateway, with memory, exact Redis, and approximate gossip backends. A client request enters a gateway, whose proxy matches a route, identifies the client, asks the configured limiter, then proxies permitted traffic upstream. Separately, load generation records request outcomes; analysis compares a run with a reference limiter and reports accuracy and latency. The graph preserves the documented backend and measurement branches. Some internal gossip wiring is not shown in the excerpts, so those relationships are omitted.
Main entry points: main.go Gateway startup · proxy.go Proxy and middleware · node.go Gossip node · limiter.go Limiter contract
Components 21
Gateway request path
- Gateway startup
cmd/gateway/main.go - Configuration
internal/config/config.go - Proxy and middleware
internal/proxy/proxy.go
Limiter backends
- Limiter contract
internal/limiter/limiter.go - Memory backend
internal/limiter/memory/memory.go - Redis backend
internal/limiter/redis/redis.go - Gossip node
internal/limiter/gossip/node.go - Gossip state store
internal/limiter/gossip/store.go - Gossip codec
internal/limiter/gossip/codec.go - Memberlist transport
internal/limiter/gossip/memberlist.go - State merge
internal/limiter/gossip/merge.go - Transport interface
internal/limiter/gossip/transport.go
Load and analysis
- Load generator
cmd/loadgen/main.go - Request scheduling
internal/loadgen/schedule.go - Analysis command
cmd/analyze/main.go - Run analysis
internal/analyze/analyze.go
Service operations
- Gateway metrics
internal/metrics/metrics.go - Admin endpoints
internal/admin/admin.go - Echo upstream
cmd/upstream/main.go
Other components
- HTTP client
- Redis
Connections 21
- HTTP client → Gateway startup: sends requests
README.md - Gateway startup → Configuration: loads settings
cmd/gateway/main.go - Gateway startup → Proxy and middleware: serves requests
cmd/gateway/main.go - Gateway startup → Admin endpoints: serves admin
cmd/gateway/main.go - Gateway startup → Gateway metrics: configures metrics
cmd/gateway/main.go - Gateway startup → Memory backend: selects backend
cmd/gateway/main.go - Gateway startup → Redis backend: selects backend
cmd/gateway/main.go - Gateway startup → Gossip node: starts gossip
cmd/gateway/main.go - Proxy and middleware → Limiter contract: checks limits
internal/proxy/proxy.go - Proxy and middleware → Gateway metrics: records requests
internal/proxy/proxy.go - Proxy and middleware → Echo upstream: proxies allowed traffic
- Memory backend → Limiter contract: implements
internal/limiter/memory/memory.go - Redis backend → Limiter contract: implements
internal/limiter/redis/redis.go - Redis backend → Redis: runs atomic scripts
internal/limiter/redis/redis.go - Gossip node → Limiter contract: implements
internal/limiter/gossip/node.go - Gossip node → Gossip state store: decides from local state
internal/limiter/gossip/node.go - Gossip node → Memberlist transport: attaches transport
- Load generator → Request scheduling: schedules requests
cmd/loadgen/main.go - Load generator → Gateway startup: sends load
README.md - Analysis command → Run analysis: analyzes CSV
cmd/analyze/main.go - Run analysis → Memory backend: replays reference
internal/analyze/analyze.go