Back to Projects
Case StudyOffice project

API Gateway & Rate Limiting Layer

Implemented tenant-aware token-bucket rate limiting with Redis Lua atomics and graceful degradation when Redis is unavailable.

NginxRedisOpenTelemetry

Impact

30K+ req/day · multi-tenant

Source

Private code

Repos

3 linked services

Repository Shape

Gateway Middleware
Private
Config API
Private
Tracing Dashboards
Private

Private repositories are represented through architecture notes, impact, and design tradeoffs instead of source links.

Role

Designed the rate-limit algorithm, failure behavior, and tracing signals for a multi-tenant API gateway.

Architecture

  • Gateway replicas call a Redis Lua script that refills and consumes tokens in one atomic operation.
  • Tenant limits are cached locally and refreshed periodically from PostgreSQL-backed configuration.
  • OpenTelemetry spans expose allow/reject decisions, remaining tokens, and Redis latency.

Highlights

  • Sub-5ms overhead on the request path.
  • Per-tenant controls prevent a single client from degrading shared API capacity.
  • Circuit-breaker fallback keeps the platform available during rate-limiter dependency failures.

Constraints

Source Availability

Source code is owned by the employer and cannot be shared. The public detail page focuses on system design and production lessons.