Q&A-1Choose the right abstraction boundary for a platform capability.
Answer
Core answer
Assume the capability is a managed Postgres offering on an internal Kubernetes platform, and the consumer is a product team whose SLO is p99 read latency under 200 ms and 99.95% availability. My rule: expose a knob when the consumer's own SLO, data model, security posture, or cost line moves when they change it; hide it when only the platform's internals move.
So I expose Postgres major version (16), instance class, storage size and IOPS, backup retention in days, and the maintenance window. I hide the connection pooler, the failover mechanism, the node pool, and the storage backend.
Why the boundary holds or leaks
A boundary holds when the hidden layer cannot be observed through the consumer's contract. It leaks the moment the consumer's failure modes depend on the hidden layer. Concretely: I hide PgBouncer, but its defaults are pool_mode = session, default_pool_size = 20, max_client_conn = 100. A consumer whose app opens 300 connections gets FATAL: no more connections allowed (max_client_conn): a failure caused entirely by a layer I told them not to think about. That is a leak, and it is my fault, not theirs.
Two fixes, both legitimate:
- Raise
max_client_connand keep the pooler hidden, accepting that a connection storm now costs me memory on the pooler host. - Expose a
max_connectionsfield that maps tomax_client_conn, so the consumer owns the number that decides their failure.
I pick the second when consumers have wildly different connection counts, a 4-replica API at 25 connections each versus a 200-worker batch fleet, because then no single hidden default is right.
The test I actually run
For each candidate knob, ask: if the consumer sets it wrong, whose SLO breaks? If theirs, expose it. If only mine, hide it and pick a default that survives their worst case.
| Candidate | Consumer SLO moves? | Decision |
|---|---|---|
| Postgres major version | Yes: extension and query compatibility | Expose |
| Backup retention (days) | Yes: RPO | Expose |
pool_mode | No, unless they hold session state | Hide, default transaction |
| Node pool / AZ placement | No | Hide |
max_connections | Yes: connection storms | Expose as max_client_conn |
Failure modes and detection
- Hidden default too low:
no more connections allowedin app logs. Alert on PgBouncercl_waiting > 0sustained for 60 s. - Exposed knob with no guardrail: consumer sets
max_connections = 5000, exhausts Postgresmax_connections(default 100) on the primary. Detect viapg_stat_activitycount and enforce a hard cap in the API. - Boundary change without versioning: renaming a field silently breaks Terraform state. Detect via plan diff in CI before apply.
Alternatives and when not to
If the capability is single-tenant with one consumer, do not build a boundary at all: hand them the raw resource. A boundary is a compatibility surface you now maintain forever; only pay for it when you have three or more consumers with divergent needs. When you do change the boundary, add the new field alongside the old, mark the old deprecated, and remove it only after a migration window you have actually measured.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.