KatInterview

Design a Scalable Feature Toggling and Targeting Platform

System DesignModel answer
HardModel answerSystem Designsystem-designdistributed-systemscaching

Last updated

Design a feature flag service enabling dynamic percentage rollouts, user targeted overrides, and ultra-low latency evaluation across distributed microservices.

Design a dynamic feature toggling and user targeting system for a large-scale microservice architecture.

The system allows engineering and product teams to manage feature rollouts safely in real time. It must support:

  • Global on/off switches.
  • Explicit target lists (allow/block overrides for specific user IDs).
  • Percentage-based gradual rollouts.
  • Multi-variant experiment assignment.

System Requirements & Scale Constraints

  • Read Traffic: 2,000,000 evaluation requests per second across hundreds of downstream services.
  • Latency Budget: Evaluation must complete in under 1 ms at the $p_{99}$ level, without adding remote network round-trips to the critical path of individual service calls.
  • Consistency: User assignment must be deterministic and sticky across devices/requests for a given rollout percentage.
  • Propagation Speed: Flag updates made in the management console must propagate to all evaluation engines in under 2 seconds globally (and under 500 ms for emergency kill-switches).
  • Availability: High availability ($99.999%$). Evaluation failure must fall back safely to local defaults without throwing runtime exceptions or blocking core user traffic.

Walk through your architecture, covering the control plane, execution/evaluation model, data model, hash-bucketing algorithm, propagation mechanism, and resilience strategies.

Hints

Hint 1

Think carefully about the trade-off between evaluating flags via a centralized REST/gRPC RPC service versus evaluating in-process using an SDK with locally cached configurations.

Hint 2

How do you guarantee sticky percentage bucketing using deterministic hashing without storing every user's assigned state in a database?

Hint 3

How can you push configuration changes to thousands of application instances with sub-second latency while keeping control plane load manageable?