Archetype 11 — Control Plane + Local Snapshot #
What this archetype is #
One central config truth publishes versioned snapshots that many local evaluators apply and serve from memory.
Examples: feature flags, config rollout, policy distribution.
We will use feature flags as the running example.
Layer 1: Entities and Postgres table design #
ConfigState
SnapshotState
AppliedVersionState
create table flag_configs (
flag_key text primary key,
config jsonb not null,
version bigint not null,
updated_at timestamptz not null default now()
);
create table config_snapshots (
snapshot_id bigserial primary key,
version bigint not null unique,
payload jsonb not null,
created_at timestamptz not null default now()
);
Layer 2: Write path mechanics #
Update config #
begin;
update flag_configs
set config = $2,
version = version + 1,
updated_at = now()
where flag_key = $1;
insert into config_snapshots (version, payload)
values ($3, $4);
commit;
Agents then:
- poll latest version
- or watch a notification channel
- fetch snapshot
- atomically swap local snapshot if version is newer
Layer 3: Fault tolerance #
- stale snapshot
- out-of-order apply
- partial rollout
- old config still serving locally
Controls:
- monotonic version checks
- full snapshot fallback
- atomic local apply
Layer 4: Scale #
Default hotspots:
- rollout fanout to many agents
- snapshot distribution bursts
- hot tenant config
- snapshot size
Common mitigations:
- push-version / pull-snapshot
- regional cache/distributor layer
- delta snapshots only when safe