CMS

CMS with edge control, rate limiting, and feature management.

Requirements

Functional Requirements

  • Evaluate flags
  • Check limits
  • Push updates

Non-functional Requirements

  • Low-latency checks at edge
  • High availability

High-Level Design

  • Control plane → distribute policies
  • Edge evaluate requests

Capacity & Sizing

  • Checks/sec, policy size, propagation latency

Key Components

  • Policy store, Edge cache, Evaluators

Architecture

High-level components and data flow

Data Model

Core entities and relationships

  • policies (id PK, rules_json)
  • counters (key PK, value, window)
  • flags (flag PK, rules_json, variants)

APIs

  • POST /api/flags { name, rules }
  • GET /api/flags
  • POST /api/ratelimits/check

Hot Path

  1. Edge check → allow/deny

Caching & TTL

  • Cache flags/policies at edge with short TTL and push invalidations

Scaling

  • Sharded counters
  • Eventually consistent policy caches
  • Bloom filters for fast checks

Trade-offs

  • Global consistency vs latency
  • Push vs pull updates
  • Precision vs memory in counters

Failure Modes & Mitigations

  • Counter store outage → fail-open/closed
  • Policy corruption → rollbacks
  • Skew → per-key limits

Observability

  • Limit hit rates
  • Flag evaluation latency
  • Edge error budgets