System Design: Configuration Service with Subscriptions
Context
Design a multi-tenant configuration service that stores key–value configuration and lets applications subscribe to changes for specific keys or namespaces (prefixes). When a value changes, subscribers must be notified promptly and reliably.
Requirements
-
API surface
-
set
-
get
-
subscribe
-
unsubscribe
-
Notification semantics
-
Delivery guarantees (at-least-once vs at-most-once)
-
Ordering guarantees
-
Debouncing/coalescing
-
Versioning and change management
-
Versioning of keys
-
Rollbacks
-
Handling partial failures
-
Correctness
-
Thread safety (client library and server)
-
Concurrency control for writes
-
Durability and recovery
-
Security
-
Access control and auditing
-
Scale and performance
-
Scale to thousands of clients
-
Fan-out strategy
-
Caching strategy
-
Protocol choice: long polling vs WebSocket (and/or SSE)
-
Time/space complexity of core operations
Assume namespaces are path-like prefixes (for example, /env/prod/serviceA/). Specify assumptions as needed.