
Imagine an online store introducing a new checkout experience to 5% of customers. If payment errors rise, engineers must disable the feature without redeploying the application. A distributed feature flag system separates deployment from release.
Requirements and architecture
A control plane stores versioned flag definitions, targeting rules, audit history and access controls. A data plane distributes snapshots to SDKs through streaming or polling. SDKs evaluate locally using cached rules, avoiding a network call on every request. Use a durable database as the source of truth and publish versioned changes through an outbox.

Progressive rollout
Assign users to stable buckets using a deterministic hash of the flag key and user identifier. Enable buckets below the rollout threshold. Increase from 5% to 25%, 50% and 100% only when error rate, latency and business metrics remain acceptable. Keep the hash salt stable to avoid reshuffling users.

Safe rollback and failure modes
Disable the flag in the control plane and distribute a new version. Rollback is bounded by propagation delay, not instantaneous across disconnected clients. SDKs retain the last known good snapshot, enforce a maximum staleness policy and use a documented safe default when necessary. Reject out-of-order versions and monitor propagation lag.
Capacity planning
For 10,000 SDK instances polling every 30 seconds, expect roughly 333 configuration requests per second before jitter and caching. Local evaluation avoids multiplying that load by application request volume. Use regional caches, jittered refresh and exponential backoff.
Implementation example
import hashlib
def enabled(flag, user_id, percent):
key = f"{flag}:{user_id}".encode()
bucket = int.from_bytes(hashlib.sha256(key).digest()[:8], "big") % 10000
return bucket < percent * 100Testing and observability
Test deterministic bucketing, targeting precedence, stale snapshots, malformed rules, concurrent updates and rollback under network partitions. Track configuration age, evaluation errors, version adoption and business outcomes. Use role-based access, approval for sensitive flags and immutable audit records.
Interview questions and FAQs
Why evaluate locally? Lower latency and resilience to control-plane outages. Are flags authorization controls? No; enforce authorization independently on the server. When should flags be removed? After the rollout is stable, remove obsolete branches and flag configuration to reduce technical debt.
Further reading
See the OpenFeature evaluation specification and evaluation context.