Implement Deterministic Percentage Rollouts for a Config Flag Service
Last updated: November 29, 2026
Quick Overview
Implement the evaluation function for a feature flag service that supports a kill switch, allow and deny lists, attribute-targeted rules, and a percentage rollout that is stable per user and only grows the exposed set when the percentage increases.
Nextdoor
November 29, 20260
0
0 solved
Implement the evaluation function for a feature flag service that supports a kill switch, allow and deny lists, attribute-targeted rules, and a percentage rollout that is stable per user and only grows the exposed set when the percentage increases.
Nextdoor ships through a large monolith and many services, and engineers rely on an internal runtime configuration system to change behavior in production without a deploy. This question checks hashing for stable bucketing, rule precedence, and the operational properties that make a gradual rollout safe.
What the Interviewer Expects
- Use a stable hash of flag name and user id, not a language's randomized hash()
- Explain why salting with the flag name avoids the same users being first for every flag
- Define precedence: kill switch, deny, allow, targeted rules, default
- Show that raising the percentage only adds users (monotonic ramp)
- Discuss evaluation latency and how configs reach every process
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- How do you propagate config changes to thousands of processes within seconds and fall back if the config store is down?
- How would you bucket by household or neighborhood instead of user, and when would you want that?
- How do you keep an experiment's assignment stable if someone edits the rule order?
- How would you audit who changed a flag and roll it back?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
is_enabled(flag_cfg, user_id, attrs) returns a bool. Config contains name, killed, deny, allow, ordered rules as (attribute, value, percent), and default_pct. Same input must always gi...
High-Level Design
Bucket each user into one of 10,000 slots with SHA-256 of flag:user_id, then a user is on if bucket < pct * 100. Precedence is checked in a fixed order so a kill switch always wins and QA allowlis...