Skip to content
Tech Interview Prep
Technical interview guide

Translating Requirements into Architecture

Turning a specific customer's stated needs and constraints into a concrete, deployable system design.

Minutes to read
3
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed

Scope: Azure and AWS Well-Architected guidance, Google Cloud Architecture Framework, SEI quality-attribute methods, and C4 model guidance current 2026-08-31.

Interview Q&A

Treat each question like a live interview question: answer out loud first (structure, assumptions, tradeoffs), then open the model answer to spot gaps and rehearse a tighter follow-up.

Curated: · Written: · Reviewed:

25 questions

Q&A-20

Identify architecture-significant requirements.

Answer

Core answer (first 90 seconds)

Assume a mid-size system: ~15 services, a team of 30, a two-year horizon. "Architecture-significant" is not a property of a requirement's size: it is a property of what the requirement forces. A requirement is architectural if satisfying it changes the system's structure, fixes a quality attribute other components must respect, creates a contract that crosses a team or trust boundary, or commits you to a decision that is expensive to reverse. Everything else is a feature.

The test I apply, in order:

  1. Does it change structure: a new component, a new boundary, a new data owner?
  2. Does it set a quality-attribute target others must meet (latency, availability, consistency)?
  3. Does it create a contract consumed outside the team: API, event schema, data format?
  4. Does it cross a trust or ownership boundary: authn/z, tenancy, PII?
  5. Is it expensive to reverse: a schema, a protocol, a vendor, a deployment topology?

Any yes makes it a driver. All no makes it a backlog item.

Make it concrete: a quality-attribute scenario

"The system must be fast" is not testable and therefore not a driver. Rewrite it in the six-part scenario form ATAM uses: source, stimulus, artifact, environment, response, response measure:

partvalue
sourceauthenticated tenant user
stimulussubmits a checkout request
artifactcheckout service + payment gateway
environmentnormal load, 3× peak
responseorder confirmed, receipt returned
response measurep99 ≤ 400 ms, error rate < 0.1%

Now it is a driver: it constrains the payment call to be async or cached, forces a timeout budget across the chain, and rules out a synchronous multi-hop design. That is the mechanism: a scenario with a response measure turns a wish into a constraint that propagates into structure.

Rank them: utility tree

ATAM ranks drivers by business importance and technical difficulty, each H/M/L. Worked example:

driverimportancedifficultyaction
multi-tenant data isolationHHdesign now, write an ADR
p99 ≤ 400 ms checkoutHMdesign now
audit every readMHspike, then decide
CSV exportLLbacklog

The H/H cell is where design effort goes; L/L is noise. This is "prioritize by importance and difficulty" made operational.

Failure modes

Over-classification: if every requirement is architectural, the architecture becomes a backlog and no decision gets made. Review fatigue, ADRs nobody reads. Symptom: more than roughly 20 drivers for a 15-service system.

Under-classification is the expensive one. "Audit every read" looks like a logging feature; it actually forces a data contract (what counts as an auditable event), a cross-boundary call, and a retention policy. Found after launch, retrofitting it means touching every service. Tenancy behaves the same way: adding tenant isolation after a single-tenant launch is a schema and query rewrite, not a flag.

Trade-offs and when not to use this

ATAM is heavy: days of stakeholder workshops. For a small team or a short-lived system, a one-hour session with the utility tree alone is enough; skip the full method. For a throwaway prototype, skip it entirely: nothing is expensive to reverse. The lightweight version: keep a drivers list, one ADR per H/H decision, and revisit when implementation reveals coupling or a previously local choice gains broader consequences. Link each driver to the decisions, risks and verification it implies, so the list stays a working artefact rather than a document.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-2

How do you systematically quantify qualitative non-functional requirements like 'fast', 'resilient', and 'secure' into verifiable architectural metrics?

Answer

Qualitative requirements like 'fast', 'resilient', or 'secure' cannot guide architecture decisions because they lack context, load bounds, and observation points. I systematically translate them into verifiable architectural metrics using the SEI Quality Attribute Scenario model: Source, Stimulus, Artifact, Environment, Response, and Response Measure.

1. The Scenario Deconstruction Framework

Every subjective attribute must be bound to an operational context and measurable threshold:

Quality AttributeAmbiguous TermContextual Stimulus & EnvironmentConcrete Response & Observation PointArchitecture Driver
Performance"Fast checkout"1,200 checkout submissions/sec at peak, database replica lag < 500 msServer-side p99 latency ≤ 120 ms measured at the API gateway edgeRead/write splitting, async order acceptance via queue
Resilience"High resilience"Complete loss of an AWS Availability Zone or regional database primary failoverRTO ≤ 30s, RPO = 0 for committed orders; circuit breaker opens within 3 consecutive 5xx errorsMulti-AZ deployment, synchronous read replicas, automatic lease fencing
Security"Enterprise secure"Leaked service identity token exploited from an untrusted CIDRToken revocation effective across edge proxies ≤ 60s; blast radius confined via network policy to read-only replicamTLS with 1-hour cert rotation, short-lived STS tokens, identity-based egress filters

2. Operationalizing into Architectural Decisions

Once attributes are shaped into scenarios, I map them directly into architectural constraints:

  1. Define the Measurement Surface: Never state a metric without naming the observation point. 'Response time < 100 ms' measured at the container runtime ignores 150 ms of TLS termination, gateway routing, and edge serialization. The contract must declare: metric = http_req_duration{quantile="0.99"}, sampled at external envoy proxies under baseline synthetic load.
  2. Establish Degradation Tiers: Replace boolean goals (up/down, fast/slow) with explicit degraded modes. For instance, if an inventory stock check service exceeds p99 > 250 ms or throws 5xx, the checkout system degrades to optimistic reservation with compensating sagas rather than failing customer traffic.
  3. Map Metrics to Architecture Decision Records (ADRs): Each measurable metric is tied to trade-offs in an ADR. For example: 'To meet RPO=0 across AZ outage, we select synchronous multi-AZ PostgreSQL replication, accepting a +12 ms baseline write latency overhead.'
  4. Continuous Verification in Delivery Pipeline: Convert response measures into automated harness tests: k6/Locust load suites running against staging gates (asserting p95/p99 latency under target concurrency), chaos injections (ChaosMesh/AWS FIS to verify failover RTO within SLO), and static policy gates (OPA/Trivy enforcing zero critical CVEs and no unencrypted ingress).

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-14

Prioritize quality-attribute scenarios from many stakeholders.

Answer

What I'd say first

Before ranking anything I'd ask three things: how many stakeholders are in the room and which systems they own, what decision this prioritization feeds (greenfield architecture, migration, re-platform), and when the decision has to be made. If the answer is "40 scenarios from 12 stakeholders, and we need architectural drivers for a Q3 migration," that's a QAW-shaped problem.

Assumptions I'd state out loud: scenarios have already been elicited, stakeholders span business and technical roles, and we have one facilitated session plus a follow-up.

The core answer

Refine every scenario into the six-part form (source, stimulus, environment, artifact, response, response measure) because a scenario without a response measure can't be ranked. "The system should be fast" and "p99 search latency under 200 ms at 5,000 rps" are not the same input to a prioritization decision. Then dedupe by merging scenarios that differ only in wording, keeping distinct contexts (peak vs. degraded) as separate rows.

Rank on two independent axes: business importance, voted by stakeholders, and architectural difficulty or risk, estimated by the architects. Independence matters because a scenario can be business-critical but architecturally easy (just handle it, don't design around it) or business-minor but architecturally hard (a risk to retire early). Collapsing the two into one score lets a loud stakeholder's easy scenario outrank a quiet one's hard one.

Use the 100-point method: each stakeholder distributes 100 points across the scenarios they care about. With 12 stakeholders and 40 scenarios that's 1,200 points; a scenario holding 200 is a clear driver, one holding 15 is not. Then build a utility tree, business importance and technical difficulty each rated high/medium/low, and take the union of high-business-importance and high-difficulty scenarios, plus mandatory obligations (regulatory, contractual) that no vote can override.

Target 8–12 architectural drivers. Fewer than 8 and you've dropped a quality attribute; more than 12 and the architecture can't satisfy them all: you're listing, not prioritizing.

Trade-offs

QAW (SEI's Quality Attribute Workshop, one to two facilitated days) surfaces conflicts in the room; an async survey is cheaper but hides disagreement until the architecture is already built. The 100-point method forces trade-offs but is gameable by strategic voting; simple ranking is faster but produces ties. I'd use 100 points when the decision is contested, ranking when it isn't.

Failure modes

  • Loudest stakeholder wins. Detect by comparing each stakeholder's vote share to their speaking time; if one person's scenarios take 6 of the top 10 but they cast 15% of the points, re-run the vote.
  • Averaging hides tail risk. A scenario ranked 12th by mean but #1 by two stakeholders on a safety concern. Detect by looking at max rank and vote concentration, not mean.
  • Utility tree inflation. Everyone marks everything high. Detect by counting: if more than 30% of scenarios land "high/high," the scale isn't discriminating.
  • Missing constituency. Check the stakeholder list against the affected systems; if the DBA isn't there, the data-volume scenario is missing.

Artefacts

Worked 100-point allocation:

ScenarioABCTotalDifficulty
p99 search < 200 ms at 5k rps40302090High
Failover < 30 s on region loss20401070High
Audit log retention 7 years1053045Low
Dark mode0000Low

Drivers: the first two. Audit retention is mandatory (regulatory) and kept regardless of score. Dark mode goes to the backlog with an owner.

Then map drivers to candidate decisions and validation, publish the rationale and who decided, and revisit when business priority or evidence changes.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-23

Assess an architecture requirement that says 'use best practices.'

Answer

When an architecture requirement says "use best practices," I treat it as a placeholder for a requirement that hasn't been written yet. My first move is to ask the person who wrote it: what business outcome or risk are you trying to address? Who owns that outcome? For example, if it's about security, the owner might be the CISO. If it's about performance, the owner might be the product manager. Then I work with that owner to turn the vague phrase into something testable.

Let me give a concrete example. Suppose the requirement is: "The system must use best practices for data encryption at rest." That's not testable. I would rewrite it as: "All data at rest in Amazon S3 buckets must be encrypted with AES-256 using AWS KMS customer managed keys, with automatic key rotation every 365 days. RDS instances must have encryption at rest enabled with AES-256, and all connections must use TLS 1.2 or higher. Evidence: AWS Config rules encrypted-volumes and s3-bucket-server-side-encryption-enabled must be compliant." This is based on the AWS Well-Architected Framework Security Pillar and NIST SP 800-53 Rev. 5 control SC-28. Now a team can implement it, and an auditor can verify it.

The tradeoff is between speed and precision. You could accept the vague requirement and let each team choose their own "best practice." That's fast, but it leads to inconsistent implementations. One team uses AES-256 with KMS, another uses AES-128 with a local key, a third forgets encryption entirely. When you try to share data between services, decryption fails. During a security audit, you can't demonstrate compliance because there's no evidence. Incident response is slower because you don't know what was actually implemented. Alternatively, you could mandate a full standard like OWASP ASVS Level 2 for all applications. That gives you a clear checklist, but it may be overkill for internal tools and slow down delivery. The deciding criteria are regulatory scope, team maturity, and the cost of a breach. If you're in healthcare, you need the precision. If you're building a prototype, you might accept the risk.

Failure modes when "best practices" ships unchecked: you get configuration drift. For example, a developer spins up an S3 bucket without encryption because the requirement didn't say it was mandatory. A penetration test finds it, and you have to scramble. Or a new service uses TLS 1.0 because that was "best practice" five years ago. Detection: run a compliance scan with AWS Config or Prowler. If you see non-compliant resources, you know the requirement was too vague.

To validate, write acceptance tests. For encryption, a test that tries to read an unencrypted object and expects an access denied error. Or use infrastructure as code scanning with Checkov or tfsec in your CI pipeline. That way, the requirement is enforced automatically.

Finally, assign an owner and revisit the criteria when the framework updates. The AWS Well-Architected Framework changes, NIST releases new revisions. A best-practice label without observable acceptance cannot guide a design or prove conformance. So I would never sign off on it as written.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-1

Translate an ambiguous requirement for a 'global, highly available' service.

Answer

Core answer

"Global, highly available" is two adjectives and zero requirements. Before I draw a topology I turn them into numbers, because every one of those numbers changes the architecture.

I'd state my assumptions out loud: user-facing, read-heavy, users in NA, EU and APAC, and a regulatory constraint that EU personal data stays in the EU. If any of those is wrong, the design changes.

Then I ask five things: which regions must serve traffic; what availability number we're committing to; what the latency target is and where it's measured; what RTO and RPO are for a region loss; and which data can leave its home region.

Availability is a number, and it's a budget

TargetDowntime / 30-day month
99.9%43 min 12 s
99.95%21 min 36 s
99.99%4 min 19 s

That table is the whole conversation. 99.9% is a single-region service with a good runbook. 99.99% is not: it forces you to remove serial dependencies, because availability multiplies. Three serial dependencies at 99.9% each give 0.999³ = 99.7%, about 129 minutes of downtime a month. So "highly available" usually means "fewer serial hops", not "more regions".

Regional access vs multi-region writes

Serving reads from a local region is cheap: replicate asynchronously, accept staleness, done. Active-active writes are a different problem. Two regions accepting writes to the same key means a network partition forces the CAP choice into your data model: reject writes (lose availability), or accept both and resolve later. That's why multi-region writes force conflict resolution: it isn't a design preference. You pick last-write-wins (silently loses data), CRDTs (only for commutative operations), or per-key ownership (a home region per key, which reintroduces a cross-region hop for every non-home writer).

Deciding criteria: if the write path has multi-key invariants (inventory decrement, unique username, balance transfer) active-active writes cost you coordination latency on every write. If writes are per-user and commutative, active-active is fine. Data residency pins this further: if EU data can't leave the EU, the EU home region is fixed, so an APAC user writing EU data takes a cross-region hop no matter what you build.

Failure modes, with detection

  • Zone loss: blast radius is one AZ; detect with per-AZ synthetic probes; the cost is capacity headroom (N+1).
  • Region loss: detect with cross-region health checks. Route 53 health checks at a 10 s interval with a 3-failure threshold detect in ~30 s, but DNS TTL (60 s) plus client caching means real failover is 1–5 minutes. That number has to fit inside your RTO, or DNS failover is the wrong tool.
  • Dependency failure: auth, config, or the control plane. Detect with dependency-level health checks and error-budget burn alerts: page at 2% of the monthly budget burned in 1 h, ticket at 10% burned in 3 days.
  • Normal maintenance is not a failure: deploys, cert rotation and schema migrations should be invisible. If a deploy can breach the SLO, either the SLO is wrong or the deploy process is.

Cost and validation

Cross-region replication egress is billed per GB: AWS lists roughly $0.02/GB between US regions, and it dominates the bill for write-heavy services. I'd put a number on it before promising active-active.

Finally I'd go back to the stakeholders with the table and ask which rows are mandatory and who signs off on the residual risk. The output isn't a diagram; it's a spec: regions, SLO with measurement point, consistency model, RTO/RPO, and the failure scenarios each design choice survives.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-21

Model capacity requirements before selecting components.

Answer

What I'd say first

Before picking Kafka vs SQS, Postgres vs Cassandra, I need the workload shape, not a peak number. I'd ask: arrival rate and its distribution, payload size, read/write mix, burst duration, and the response objective the business actually signed up for. Then I build a demand model, find the bottleneck, and only then choose components.

Assumptions I'd state out loud: 400M events/day, 1.5 KB each, 3× peak-hour factor, 10× burst for 60 s, 90-day retention, p99 write latency target 50 ms.

Demand model

  • Average: 400e6 / 86,400 ≈ 4,630 events/s
  • Peak hour (3×): ≈ 13,900 events/s → 20.8 MB/s
  • 60 s burst (10× average): ≈ 46,300 events/s → 69 MB/s

Little's Law gives concurrency: N = λ × W. At 13,900/s and 40 ms p99 service time, ~556 requests are in flight. That number sizes thread pools and connection pools: a 20-connection DB pool cannot serve 556 concurrent writers, so requests queue and p99 climbs.

Bottleneck

The write path is the constraint. Hypothetical numbers from our own bench: a single Postgres primary sustained ~8,000 single-row inserts/s at p99 12 ms. Peak demand of 13,900/s exceeds it. Batching 100 rows per statement drops the statement rate to 139/s and moved throughput to ~120,000 rows/s: the fix is batching, not a bigger box.

ComponentPeak demandCapacity (bench)Verdict
Ingest API13,900/s25,000/s1.8× headroom, OK
Postgres primary13,900 rows/s8,000/sbottleneck
Postgres + 100-row batch139 stmt/s~1,200 stmt/s8× headroom

Headroom: size steady-state for peak + 30–50%, not for the burst. The burst goes into a bounded queue; when the queue hits its limit you shed load rather than let latency grow unbounded.

Failure modes

Mis-size the write path and the queue backlog grows, p99 goes 40 ms → 180 ms, clients time out and retry, and retries add load: a retry storm that turns a slow system into a down one. Detect it with queue depth, DB pool wait time, and p99, not CPU. The cost of the opposite mistake is paying 3× for permanent capacity that serves a 10-minute burst.

Trade-offs

Partitioning buys write throughput but costs cross-partition queries and rebalancing ops. Caching cuts read load but adds invalidation and staleness. A queue absorbs bursts but adds at-least-once delivery and consumer lag. Scale-up is simplest until it isn't: it's the wrong answer when the bottleneck is a single-writer lock, because a bigger machine doesn't remove the lock.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-9

Turn an availability target into architecture and verification.

Answer

The first 90 seconds

Pin the target to one flow before choosing anything. Take 99.95% monthly availability for POST /checkout. A 30-day window is 43,200 minutes, so the error budget is 21.6 minutes. Eligible requests: authenticated checkout calls. Excluded: 4xx client errors, synthetic probes, and traffic shed by an explicit load-shedding policy. Success: HTTP 200 with the order durably committed, measured at the edge, not per service, because per-service SLIs hide the composition.

Then check the target is reachable. Three serial dependencies each at 99.95% compose to 0.9995³ = 0.99850, i.e. 64.8 minutes of budget per month: three times the target. That single calculation decides the architecture: either remove serial dependencies from the critical path or make each one redundant. Monitoring does not fix it.

Architecture that follows

Run three AZs with N+1 capacity so any one can be lost. Synchronous replication to a second AZ for the order store; async cross-region. Timeout chain: edge 2s, checkout service 1s, downstream calls 500ms. Each layer strictly below its caller, so a slow dependency fails fast instead of stacking. Retries only on idempotent calls, with an idempotency key on the POST, exponential backoff with jitter, max 2 attempts, and a retry budget capped at 10% of base traffic so a partial outage can't become a retry storm.

Failure modes, detection, mitigation

FailureDetectionMitigation
AZ lossALB target group unhealthy hosts; AZ-scoped 5xx spike3 AZs, N+1 headroom, sync replica in second AZ
Retry stormretry rate > 10% of baseline; queue depth p99 risingretry budget token bucket, circuit breaker, jittered backoff
Control-plane outagekube-apiserver latency/error alertpre-provisioned capacity; don't depend on autoscaling mid-incident
Bad deployerror rate correlated with rollout startcanary at 1% for 10 min, auto-rollback on SLO burn
Silent data lossreplication lag, backup verification job failingsync replication, PITR, monthly restore drill

ALB's default health check is a 30-second interval with an unhealthy threshold of 2, so a dead AZ is marked out in about 60 seconds: that's the floor on your failover time unless you shorten it.

Verification

Load test at 2× peak to find the knee, then fault-inject: kill an AZ, kill the primary DB, block the control plane. Measure end-to-end success at the edge, not pod health. Restore drill monthly from backup into a clean account and time it: that number is your real RPO/RTO, not the one in the design doc. Failover drill quarterly, unannounced.

Trade-offs and when not to

Active-active multi-region gives RTO in seconds but forces conflict resolution and global consistency on the order store, and roughly doubles cost. Active-passive with a warm standby gives RTO in minutes and near-zero RPO with synchronous replication, at the cost of cross-region write latency. If the business RTO is 4 hours and RPO 1 hour, neither is justified: backups plus a tested restore path is the right answer, and building active-active would be over-engineering.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-16

Translate security needs into architecture requirements.

Answer

Clarify, then answer. "Translate security needs into architecture requirements" only means something once the system is fixed, so I'd state the system first. Assume a multi-tenant B2B SaaS: 200 tenants, PII and cardholder data, AWS, one Postgres cluster, SOC 2 Type II and PCI DSS 4.0 in scope, 40 engineers. If it were a single-tenant internal tool, most of this collapses to network isolation and I'd say so up front.

The translation rule I'd give: a security need is not a requirement until it has a mechanism, a measurable acceptance test, a named owner, and a defined failure behavior. "Encrypt data" is a need. "AES-256-GCM with a per-tenant KMS CMK, verified by a test that a revoked key fails reads closed" is a requirement.

The translation, worked.

Security needArchitecture requirementAcceptance testFailure behavior
Tenant A cannot read tenant B's rowsEvery tenant-scoped table carries tenant_id uuid not null and FORCE ROW LEVEL SECURITY with policy USING (tenant_id = current_setting('app.tenant_id')::uuid); the pool sets that GUC per transactionCI runs each query as tenant A against tenant B's IDs and asserts 0 rowsA new table without RLS: CI asserts relrowsecurity and relforcerowsecurity are true for every table in schema app, and the build fails
Card data encrypted with keys we ownEnvelope encryption: per-tenant KMS CMK, 256-bit data key cached in memory, AES-256-GCMTest that kms:Decrypt denied makes the read fail closed, never return plaintextCMK scheduled for deletion: CloudWatch alarm on ScheduleKeyDeletion, 30-day pending window, two-person approval to schedule
Revoked access stops working15-minute access token TTL, 8-hour refresh, gateway denylist check with 60-second propagationRevoke a session, assert 401 within 60 sRedis denylist down: fail closed for admin scope, fail open for read-only

FORCE ROW LEVEL SECURITY is the load-bearing detail: a table owner bypasses RLS without it, so a migration run as owner silently opens cross-tenant reads.

The trade-off I'd actually weigh. How long a revoked credential stays exploitable, against per-request cost. Figures below are the shape you'd measure on your own cluster, not vendor claims.

OptionRevocation windowAdded p99Blast radius
15-min JWT, no denylistup to 15 min0revoked admin token valid 15 min
JWT + Redis denylist60 s~1 ms at 5k rpsRedis outage
Per-request authz service~0~8 ms, new SPOFauthz down = full outage

Deciding criterion: the exploitable window on an admin credential. 60 s is the ceiling there, so admin scope pays the denylist lookup; read-only scope accepts 15 minutes and skips it.

Failure modes, detection, cost. RLS silently off: detected by the CI assertion above, cost is a reportable cross-tenant breach. Denylist fail-open on read-only: detected by a synthetic test that revokes and polls, cost is bounded and logged. CMK deletion: detected by the alarm, cost is unrecoverable tenant data if the 30 days elapse.

What would change the decision: if tenants are regulated separately for data residency, the isolation boundary moves from the row to the AWS account, and per-tenant CMKs become per-region keys.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-12

How do you translate compliance, data residency, and privacy regulations into architectural data placement and security boundaries?

Answer

What a strong candidate says first

Clarify three things before drawing anything: which regimes actually apply (they are not interchangeable), which data elements are in scope, and where the enforcement point sits. Then the answer: residency and privacy are enforced by placement plus key custody, not by policy documents. If the data and the key that decrypts it both live in one jurisdiction, the boundary holds. If either crosses, it doesn't.

The most common mistake is treating GDPR as a residency law. It isn't. GDPR restricts transfers of personal data out of the EEA (Chapter V, Arts. 44–49) and requires a lawful mechanism: an adequacy decision, SCCs plus a transfer impact assessment, or an Art. 49 derogation. The EU–US Data Privacy Framework adequacy decision (10 July 2023) is one such mechanism. HIPAA is not a residency law at all: it governs safeguards and requires a Business Associate Agreement (45 CFR 164.502(e)) with anyone touching PHI. India's DPDP Act 2023 is a blacklist, not a localization mandate: transfers are allowed unless the government notifies a restricted country. The statutes that genuinely name geography are Russia's 152-FZ Art. 18(5) and China's PIPL Arts. 38–40 for critical information infrastructure operators and over-threshold volumes. That distinction decides the architecture: transfer law lets you keep one EEA region and paper the rest; residency law forces per-country pods.

1. Classification sets the topology

RegimeWhat it actually constrainsArchitectural consequence
GDPR (EEA)Transfers of personal data out of the EEAOne EEA region + transfer mechanism; per-subject keys for Art. 17 erasure
HIPAA (US)Safeguards and BAA chain for PHINo geography constraint; encryption, audit controls, BAA with every processor
152-FZ (RU), PIPL (CN)Local storage of citizens' dataPer-country data plane, local compute, local key custody

2. Control plane / data plane split

[ Client ] → [ Geo-DNS / Anycast ]
                    │ tenant residency tag
        ┌───────────┴───────────┐
        ▼                       ▼
[ EU enclave ]            [ US enclave ]
  API gateway               API gateway
  KMS (EU HSM)              KMS (US HSM)
  Aurora + PII              Aurora + PHI
        │  hashed IDs only        │
        └───────────┬────────────┘
                    ▼
        [ Global telemetry / SIEM ]

Global orchestration, deployment manifests and sanitized metrics stay central. Customer data planes never leave their enclave.

3. Key custody is the boundary

  • Per-subject data keys give you crypto-shredding: delete the key and the ciphertext is unrecoverable. This only works if you can enumerate every copy: replicas, backups, search indexes and analytics extracts each need the same key or their own.
  • HYOK via AWS KMS External Key Store (XKS, launched Nov 2022) keeps key material in your own HSM outside the provider. CloudHSM clusters are region-scoped and FIPS 140-2 Level 3 validated.
  • Trap: AWS KMS multi-Region keys replicate key material into the replica region. Convenient, and exactly what a residency mandate forbids.
  • Network: separate AWS accounts or Entra tenants per regulatory tier, with SCPs denying cross-region replication and cross-account role assumption by default.

4. Worked trace (hypothetical)

EU tenant request → geo-DNS to eu-west-1 → gateway resolves tenant → residency tag eu → app writes to eu-west-1 Aurora using a per-subject key from eu-west-1 KMS → emits an OpenTelemetry span with the tenant ID hashed → span exports to the global collector. The leak is in that last hop: if the span carries user.email, the global collector is a cross-border transfer. Fix: a Collector attributes processor redacts before export, and an egress scanner alerts on identifier patterns.

5. Failure modes

  • Async workers, crash reporters and tracing spans serializing PII across borders. Detect with egress inspection plus a log scanner on identifier regexes.
  • Backups and DR replication copying raw data out of the permitted boundary. Prevent with policy-as-code (OPA, Terraform Sentinel) rejecting cross-region backup targets.
  • Crypto-shredding that doesn't shred: the key is deleted but plaintext survives in a search index or a Parquet extract. Detect with a reconciliation job that checks every store holding the subject's key ID.

6. When not to do this

Per-region pods multiply cost and operational surface. For GDPR alone, one EEA region plus SCCs is cheaper and legal. Don't build per-country pods unless a statute names the country. Column-level encryption and masking cost latency: in a worked example, decrypting a 200-row result set added roughly 8 ms p50 / 35 ms p99 (hypothetical; measure your own).

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-6

How do you evaluate and select a datastore based on specific access patterns, scale, and consistency requirements?

Answer

What a strong candidate says first

Access pattern picks the engine; consistency decides whether it can be sharded; scale decides whether one node is enough. Ask in that order. A workload doing multi-row atomic transfers is a relational problem however many writes per second it takes; a workload that only reads by exact key is a key-value problem however much data it holds.

Four questions, in order:

  1. Query shape: exact-key point lookup, range scan inside a known partition, ad-hoc join/filter, or whole-aggregate fetch?
  2. Write rate, payload size, and does the working set fit in RAM?
  3. Consistency the business actually needs: serializable, read-your-writes, bounded staleness, eventual?
  4. Behaviour under partition: RPO, and is split-brain acceptable?

Then map to engine families:

  • Relational (B-tree, single leader or consensus-replicated). Read-modify-write on rows, multi-entity ACID, ad-hoc joins. A single leader on NVMe handles low tens of thousands of small transactions per second; past that you shard, and cross-shard writes pay two-phase-commit latency.
  • Wide-column / LSM (WAL + memtable → SSTable). Append-heavy writes, time-series, log sequences. Every query must supply the partition key or it becomes a cluster scan. Compaction is the hidden cost.
  • Document. Aggregate fetched and mutated in one round trip, schema varies per record. Cross-document transactions add distributed locking.
  • Key-value. Exact-key point reads and writes: sessions, idempotency keys, counters. No secondary index.

Worked trace

Workload A: order ledger. 800 writes/s peak, 2 kB payload, p99 < 50 ms, read-modify-write on a SKU balance, multi-row atomic transfer, no oversell allowed. 800 × 2 kB = 1.6 MB/s of write traffic: one Postgres primary absorbs that without breathing hard. The binding constraint is serializability, not throughput. Choose relational with row locks (SELECT ... FOR UPDATE) or a serializable engine; sharding would buy nothing and cost you cross-shard atomicity.

Workload B: device telemetry. 150,000 writes/s peak, 250 B payload, p99 write < 10 ms, append-only, queries are WHERE device_id = ? AND ts BETWEEN ? AND ?, 5 s staleness tolerable. 150,000 × 250 B = 37.5 MB/s; at 3× replication that is ~112 MB/s of network and ~3.2 TB/day before compaction. No single node takes that. Partition an LSM store by (device_id, month_bucket) with descending timestamp clustering, quorum writes, and a TTL. Bucketing matters: device_id alone gives unbounded partition growth, and a hot device then becomes a hot partition.

Decision table

RelationalWide-column (LSM)DocumentKey-value
MutationIn-place row updateAppend to WAL/memtableWhole-document replaceHash replace
Sweet spotJoins, range filters, aggregatesSlice scan within partition keyFetch aggregate by IDExact key
Worst queryDeep pagination over unindexed joinsScan omitting partition keyMulti-collection join loopPrefix/range scan
Default consistencyRead Committed (Postgres); REPEATABLE READ (InnoDB)Tunable; Cassandra defaults to ONESingle-document atomicSingle-node immediate

Failure modes to name before you commit

  • Read/write amplification. B-trees pay write amplification on random page splits; LSMs trade it for read amplification and compaction CPU/I/O spikes under sustained write pressure. Watch compaction backlog and p99 read latency, not average.
  • Secondary index fan-out. A secondary index on a partitioned store turns a point lookup into a scatter-gather across every partition; on Cassandra the index is local per node, so the query still touches all nodes.
  • Hot partition. A monotonic partition key (timestamp, sequential ID) puts all writes on one node. Detect via per-partition write metrics, not cluster averages.
  • Tombstones. Deletes in an LSM store leave tombstones that slow range scans until compaction; a delete-heavy workload can read slower than it writes.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-10

How do you systematically compare and justify architectural trade-offs between competing topologies, such as event-driven versus synchronous request-response, against latency and throughput requirements?

Answer

The 90-second answer. Two numbers decide this, and neither is "which is more scalable". First: can the caller make forward progress without the downstream result? If yes, the topology question is already answered: you are choosing where the latency lives, not whether it exists. Second: what is the fan-out depth N of the synchronous path? Tail latencies compound with N, and that usually kills sync before throughput does. Convert the SLA into a budget before arguing about either.

Step 1: budget the SLA with Little's Law. Peak 10,000 req/s, client-visible p99 ≤ 150 ms. In-flight concurrency L = λW = 10,000 × 0.135 = 1,350 requests. A servlet pool capped at 200 threads (Spring Boot's Tomcat default) doing 135 ms of work per request tops out at 200 / 0.135 ≈ 1,480 req/s: about 7× short. Utilisation is ρ = λS/c = 10,000 × 0.135 / 200 = 6.75, so the queue grows without bound and p99 tracks queue depth rather than service time. Sync at this rate means ~1,400 threads or non-blocking I/O; that is a cost line, not a footnote.

Step 2: compound the tails. Five sequential downstream calls, each p99 = 50 ms with independent tails: P(all under 50 ms) = 0.99⁵ = 0.951, so 4.9% of requests exceed 50 ms. The fan-out's p99 is roughly one call's p95. Parallelising removes the sum but not the max: the slowest of five still sets the response, and P(at least one slow) is the same 4.9%. "All our services are p99 50 ms" is not an argument that the composite is.

Step 3: the same flow, both ways. Checkout: gateway → order → inventory + payment.

Sync: 10 ms gateway + 5 ms serialisation + max(inventory 40 ms, payment 60 ms) = 75 ms typical, with the composite tail above. The client is told "confirmed" only when both downstreams commit, so payment degrading to 1 s drags the caller to 1 s unless a breaker cuts it.

Async (outbox): order service writes the order row and an outbox row in one local transaction and returns 202 with an order id. Client-visible p99 ≈ 15 ms; in-flight drops to 10,000 × 0.015 = 150, which fits the 200-thread pool with headroom. The cost is that the order is not settled when the client is told it is: assume 50 ms relay publish lag + 300 ms consumer processing, so settlement p99 ≈ 350 ms. Fine against a 2 s "order confirmed" SLA; fatal if the confirmation screen must show reserved inventory.

DimensionSync request-responseAsync outbox / event-driven
Client-visible p99composite of downstream tailslocal commit, ~15 ms
In-flight at 10k req/s1,350 → ~1,400 threads or async I/O150 → fits a 200-thread pool
Settlement p99same as the response~350 ms after ack
Failure couplingdirect; needs breakers and a DLQdecoupled; needs idempotency and reconciliation
Debuggingone trace, deterministic stateconsumer lag, out-of-order delivery, re-drive

Decision rule. Sync when the caller cannot proceed without the result, N ≤ 2, and the downstream p99 budget fits inside the client budget after subtracting gateway and serialisation. Async when the caller can proceed on an ack, arrival rate spikes well above average (queue leveling is the point), or downstream availability is below ingress availability.

Failure modes and how you see them. Sync: pool saturation. Throughput plateaus while p99 climbs linearly, so watch busy-thread count and queue depth; a breaker that opens on error rate but not on latency will not save you. Async: consumer lag, Kafka records-lag-max per consumer group; duplicates on redelivery, idempotency key on order id; a stalled relay. Age of the oldest unpublished outbox row, which is the metric that actually pages you.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-4

Resolve latency, consistency, and availability requirements that conflict.

Answer

Clarify first. "The system" doesn't have one answer: the conflict only resolves per flow. So I'd ask: which flows are reads versus writes, what's the actual latency budget and where is it measured, and what does finance mean by "correct". Exact at all times, or exact by end of day? I'll assume a global wallet: three regions, product wants p99 balance reads under 50 ms, finance wants balances that never go negative and reconcile exactly, and ops wants 99.99% write availability. Those three cannot all hold at once, and the reason is structural, not a tuning problem.

The mechanism. On the partition path this is CAP: if a network partition splits the regions, you either keep serving writes on both sides and accept divergence, or you refuse writes on one side and stay consistent. There is no third option. PACELC adds the branch that matters most of the time: else, when there's no partition, you still trade latency against consistency. Synchronous cross-region replication is the latency cost of consistency: us-east-1 to eu-west-1 is roughly 75 ms round trip, so a quorum write spanning two regions adds at least one RTT. In-region p99 write latency is ~15 ms; make it cross-region synchronous and it's ~90 ms+. That number is why the read path can't share the write path's consistency model.

The decision, per flow.

FlowChoiceMechanismWhat we give up
Balance display (read)LatencyNearest replica, bounded staleness ≤ 2 s, read-your-writes via a session token pinning the reader to their own last writeA read can be up to 2 s stale
Debit/credit (write)ConsistencySingle home region per account, synchronous quorum in-region (3 replicas, ack on 2), asynchronous cross-region replicationAccounts homed in a failed region reject writes
ReconciliationConsistencyExact sum from the primary log, run nightlyNot real-time

So the write path is PC/EC: consistent under partition, and paying latency even without one. The read path is PA/EL. Same system, two answers, because the flows have different costs of being wrong.

Failure modes and how I'd catch them.

  • Split-brain double spend. If a failover promotes a second writer without fencing the first, two debits both pass. Detect with a continuous per-account invariant, sum(debits) ≤ sum(credits), and alert on any negative balance or duplicate idempotency key. This is the one failure that costs real money, so the writer holds a lease with an epoch token and the old writer's writes are rejected on epoch mismatch.
  • Stale read. Replication lag grows under load. Detect via replication offset lag; alert above 2 s, and the UI shows an "as of" timestamp so the user isn't misled about a balance that's about to change.
  • Region loss. Writes to homed accounts fail. Detect via health check and fail fast with 503 + Retry-After rather than hanging on a timeout. Cost: during a ~90 s failover window, writes to that region's accounts are rejected; reads keep serving from replicas.

Residual risk to the owner. We accept write unavailability for region-homed accounts during a region failure in exchange for never double-spending. Reconsideration trigger: if measured write unavailability exceeds the 99.99% budget in a quarter, revisit homing. For example, move to a consensus-replicated log and accept the higher write latency.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-13

Define architecture requirements for an external dependency.

Answer

Assume the dependency is a third-party HTTP API on the checkout path, and I own the latency and success rate the user feels. I'd write requirements as a contract I can test (each one a number, a detection signal, and a named owner) not a list of topics to think about.

Four groups carry the weight.

Capacity and latency budget. End-to-end p99 target is 500 ms; I allocate the dependency 150 ms of it. That allocation decides everything downstream: the timeout (200 ms, deliberately above its p99 so I don't cut healthy calls), the retry policy (at most one retry, and only if the remaining deadline allows it), and whether the call can be synchronous at all. If the dependency's p99 is 800 ms, no timeout tuning saves the design: it goes async or gets cached.

Correctness and identity. Every mutating call carries an idempotency key. The mechanism matters: a POST that times out is ambiguous, because the server may have committed before the connection dropped. Retrying without a key creates a second charge; with a key the server dedupes on it and returns the original result. I require the key to be honored for at least 24 hours and scoped per merchant. I also require dated API versions with a deprecation window of at least six months, and schema validation on every response so a malformed body fails loudly instead of writing nulls into my database.

Failure behavior. Timeout, then bounded retry with exponential backoff and jitter: base 100 ms, cap 1 s, one retry. Jitter is not decoration: synchronized retries from many clients turn a two-second blip into a thundering herd. A circuit breaker opens at 50% errors over 20 requests in a 10 s window and half-opens with a single probe. A token bucket on my side keeps me under the contracted quota; on a 429 I honor Retry-After instead of hammering. Fallback is explicit per call type: cached last-known value for reads, queue-and-reconcile for writes, and a degraded UI that tells the user what happened.

Exit. Bulk data export in a documented format, a termination notice period, and a costed second vendor or in-house path. If the dependency is a single point of failure for revenue, that is a business risk with an owner, not an architecture footnote.

RequirementNumberDetection
p99 latency≤150 msper-endpoint histogram, alert when 1 h p99 >200 ms
Error rate<0.5% 5xx5-minute burn rate against the error budget
Quota1000 rps contracted429 count, alert at 1% of calls
Idempotency window≥24 hcontract test replaying a key
Deprecation notice≥6 monthsvendor changelog review each quarter

Failure modes and how I'd catch them. Correlated failure: the vendor runs in one region, so my multi-AZ buys nothing. I find this in a game day that fails the vendor wholesale. Quota exhaustion: 429s spike, caught by the 429 alarm, cost is dropped checkouts. Silent data drift: a nightly reconciliation job compares my order count and checksum against the vendor's; a mismatch means lost or duplicated writes. Malformed response: schema validation rejects it, the alert fires, and the breaker opens.

Trade-offs. Caching buys latency and availability but risks stale reads: fine for a catalog, not for a balance. Multi-vendor buys resilience but doubles integration and reconciliation cost, so it's worth it only when the vendor's downtime costs more than the second integration. Trusting the vendor's published SLO is reasonable until the dependency sits on the revenue path, at which point I measure it myself and hold my own budget.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-11

Handle a stakeholder mandate to use a specific vendor product.

Answer

The 90-second answer

A mandate is a preference until the organization that owns the consequences accepts them. So I don't argue about the vendor and I don't quietly design around it. I ask three things: who can sign an exception, what outcome the mandate is protecting, and what the deadline is. Then I turn "we must use X" into a decision with evidence attached, and I come back with one of three answers: comply, comply with named compensating controls, or escalate with a costed alternative.

Why the distinction matters

"Use Ledgerly" is not a constraint. "Use Ledgerly and accept that EU writes leave the region" is a constraint, because someone with authority has accepted a consequence. If nobody will accept that consequence, the mandate is a preference and the architecture should not be bent around it. That is the whole mechanism: constraints are defined by accepted consequences, not by who said it loudest.

Worked example (hypothetical figures)

A payments stakeholder mandates Ledgerly for the ledger service. Requirements I hold it against: p99 write ≤ 120 ms at 40k writes/s peak, SOC 2 Type II, EU data residency, and an exit path under 6 engineer-weeks.

CriterionLedgerly (mandated)Postgres + outboxVendor B
p99 write @ 40k/s180 ms (vendor benchmark, 3-node)95 ms measured in our spike110 ms
SOC 2 Type IIYesN/A (self-hosted)Yes
EU residencyEU region, US failoverFull controlEU only
Exit cost~9 engineer-weeks (proprietary log format)n/a~2 weeks
3-yr cost @ 40k/s$410k$180k$260k

Two hard gaps: latency misses by 60 ms, and exit is 3 weeks over budget. Everything else is closable.

Failure modes and how I catch them

  • Silent design-around. I build on Postgres and the sponsor learns at launch. Detected by diffing the ADR's constraint list against the architecture diagram, if a mandated component isn't in the diagram, one of the two is wrong. Cost: a launch slip plus the sponsor's trust.
  • Mandate treated as preference. The reverse: I assume it's soft, don't escalate, and get overruled after the build. Detected by asking "who signs the exception?" early; if the answer is nobody, treat it as hard.
  • Compensating control that doesn't compensate. "We'll encrypt at rest ourselves" does not fix a missing SOC 2 report: the control has to address the same risk. Detected by writing the risk next to the control and checking they match.
  • Exit assumed, never tested. Detected by a time-boxed export drill, not by reading the vendor's migration guide.

Accept or fight

Accept when the mandate is contractual or regulatory and the gap is closable within a bounded cost: here latency is not closable, so I'd escalate. Fight when the gap hits a hard requirement and an exception path exists. The middle path is comply-now, time-box a two-week spike, and revisit at the trigger.

What I write down

An ADR: the decision, the source of the mandate and who owns the exception, the evidence above, the accepted consequences, and a reconsideration trigger. For example, "revisit if p99 exceeds 200 ms for 7 consecutive days, or if renewal exceeds $150k/yr." That trigger is what turns a one-time argument into a standing decision.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-17

Translate cost constraints into architecture requirements.

Answer

What I'd say first

"Cost constraint" isn't an architecture requirement until it's a number with a unit and a percentile. So I convert it: what's the budget, over what period, and per what unit of demand. Per tenant, per 1k requests, per GB processed. Then I state the assumption that decides everything: the SLO and the traffic shape I have to hold while hitting it.

Say the constraint is "cut infra 40% this quarter." Illustrative numbers: current spend $60k/month across 200 tenants = $300/tenant/month. Target $250. That's the requirement. Now I decompose the bill, because the constraint only binds on lines big enough to move.

LineNowShareLever that moves it
Compute$36k60%right-size, spot for stateless, caching
Egress$9k15%co-locate chatty services, compress
Storage$6k10%tiering, retention
Observability$6k10%sampling, metric cardinality
Managed services$3k5%reserved capacity

To reach $50k I need compute down $10k: 28% fewer vCPU-hours at the same p99. That is now an architecture requirement: 28% compute reduction, p99 unchanged. Everything else is a rounding error; I don't spend a sprint on the 5% line.

The mechanism

A cost constraint becomes an architecture decision when you name the cost driver and the SLO it's allowed to trade against. Compute is driven by concurrency × instance size × hours. So the levers are fewer hours (spot, scale-to-zero), smaller instances (right-size), or fewer calls (cache). Each has a failure mode.

Failure modes and how I'd catch them

  • Right-sizing past the knee. Drop the read path from 8 vCPU to 4 and p99 goes from 40 ms to 180 ms once the connection pool saturates at 20 connections. Detected by the SLO burn-rate alert, not the bill: the bill looks great for a week.
  • Optimizing the wrong unit. If the real driver is $/GB stored and you chase $/request, you cut the small line and miss the target.
  • Step functions. Committed-use discounts and reserved capacity are cliffs: a 10% traffic drop doesn't reduce cost, so unit cost rises. Model the step, not the average.
  • Egress as the hidden top line. Cross-AZ traffic bills both directions; a chatty service turns a cheap compute tier into an expensive network bill.

Guardrails

Tag every resource for cost allocation, alert on unit cost rather than total (total hides growth), and put the SLO burn rate on the same dashboard. Set the floor: below roughly 5% of COGS, the engineering time costs more than the saving. And never trade durability or consistency for cost: that's a different decision.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-18

A contract requires tenant isolation, no noisy-neighbour impact, per-tenant scaling, and EU data residency. Walk me through how that requirement becomes architecture.

Answer

First I'd split "tenant isolation" into the four requirements hiding inside it, because they don't cost the same: data must not leak across tenants, one tenant's load must not degrade another's, tenants must scale independently, and some tenants' data must stay in a region. The binding constraint picks the model: you buy the weakest isolation that satisfies the strongest constraint, since every rung up multiplies operational cost.

So I'd ask: how many tenants now and in two years? Is isolation contractual or best-effort? Do tenant volumes differ by orders of magnitude? Which tenants need residency or their own keys? A 50,000-tenant self-serve product and a 30-tenant enterprise product get different answers from identical contract wording.

ModelIsolationNoisy neighbourPer-tenant scaleResidencyOps costFits
Shared schema + row-level securityLogical onlyNoneNoRegion-wideLowest10k+ uniform small tenants
Schema per tenantLogical + DDL blast radiusPartial (shared instance)LimitedRegion-wideLow–medium100s–1,000s
Database per tenantStrong logical + own connections/CPU shareYesYesPer-database regionMedium–high10s–1,000s, mixed tiers
Separate deploymentPhysicalFullFullPer-deploymentHighest<50 regulated tenants

For the contract above, residency plus per-tenant scaling rules out shared schema for the regulated tenants; I'd land on database-per-tenant for them and shared schema with row-level security for the long tail, with the tier recorded as tenant metadata so routing is data, not code.

Enforcement points, in request order: the tenant id comes from a verified token claim, never a client header; the routing layer maps tenant → connection or pool; the data layer carries the tenant predicate; storage keys (partition key, object prefix, index name) are tenant-scoped; the KMS key is per-tenant for the regulated tier; and cache keys, queue topics, log fields and backup tags all carry the tenant id. Miss any one and the boundary is decorative.

sql -- Postgres 16: policy plus transaction-scoped context ALTER TABLE orders ENABLE ROW LEVEL SECURITY; ALTER TABLE orders FORCE ROW LEVEL SECURITY; -- owner is not exempt CREATE POLICY tenant_isolation ON orders USING (tenant_id = current_setting('app.tenant_id')::uuid) WITH CHECK (tenant_id = current_setting('app.tenant_id')::uuid);

BEGIN; SET LOCAL app.tenant_id = '8f14e45f-...'; -- LOCAL: cannot leak via the pool SELECT * FROM orders WHERE id = $1; -- policy adds the tenant predicate COMMIT;

SET LOCAL matters: a session-level SET on a pooled connection hands the next request the previous tenant's context. The app role must not be the table owner and must not hold BYPASSRLS.

Verification is negative tests, not a diagram. For every tenant-scoped endpoint, call it with tenant A's credential and tenant B's resource id and assert 403/404 and zero rows, against the real policy in CI. Assert relrowsecurity is true for every tenant table so a migration can't silently drop it. Load one tenant to 10x baseline and assert other tenants' p99 stays inside SLO. Assert the database endpoint, replicas and snapshots are pinned to the region, and that a restore into the wrong region fails.

Failure modes I've actually seen: a migration run as table owner with RLS off; a cache key missing the tenant prefix; a shared search index; a connection pool leaking context; and the noisy-neighbour case where database-per-tenant still shares one instance's IOPS, so isolation is logical but not performance. Each has a cheap detector: schema assertion, key scan, checkout-time assertion that current_setting('app.tenant_id') is empty.

When not to climb the ladder: database-per-tenant at 50,000 tenants means 50,000 migration targets and mostly idle databases. Separate deployments are for a handful of whales, not a tier.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-15

Review whether microservices are justified by the requirements.

Answer

The 90-second answer. Microservices are justified only when a stated requirement is blocked by a single deployable, not when they are merely attractive. Ask four questions in order. (1) Do two parts need different release cadences, where one team's ship is gated by another's? (2) Do two parts need to scale at ratios far apart: as a rule of thumb, more than about 5:1? (3) Does one part need a failure or security boundary the rest must not cross? (4) Do two parts have genuinely different data ownership or consistency needs? If none holds today, the answer is a modular monolith with enforced module boundaries, plus a recorded trigger that would change it. If one holds, extract that boundary and only that boundary.

Why the cost is real. Every boundary you cut turns an in-process call into a network call, and that changes three things measurably.

  • Latency. An intra-AZ RPC is sub-millisecond at p50 and a few milliseconds at p99: take 0.5 ms / 2 ms as the working numbers for this estimate. Cheap once, expensive across a fan-out.
  • Availability. Independent services multiply. Five services at 99.9% each in one synchronous request path give 0.999^5 = 99.5%. A 43-minute monthly downtime budget becomes 3.6 hours.
  • Consistency. You give up the single ACID transaction and buy a saga with compensations, which introduces partial state: a failure mode a monolith cannot have.

Worked check. Requirements: 1,200 orders/s peak, 6 teams, one shared release train, order writes must commit atomically with payment capture, reads outnumber writes 20:1.

  • Deploy cadence: teams want weekly, the train ships monthly, so the release gate is real. Extract the two services that block each other, not eight.
  • Scaling: 20:1 read skew is a replica-count problem, not a service-boundary problem.
  • Atomicity: order and payment must commit together. Splitting them forces a saga, so keep them in one service with one schema.
  • Latency budget: against a 300 ms checkout p99, three sequential hops at ~2 ms p99 each is noise; twelve hops across a chatty call graph is not.

Result: modular monolith plus two extracted services, with the payment boundary explicitly not cut.

Failure modes and how you detect them.

Failure modeDetection signal
Distributed-transaction creepSpan count per business transaction climbs; one user action needs a saga
Chatty boundariesTrace duration plotted against span count shows p99 rising with hop count
Shared database across servicesCross-service table access in connection strings or schema grants
Unowned serviceCODEOWNERS coverage below 100% of services
On-call multiplicationPages per service per week; 8 services × 3 environments = 24 deploy targets

When not to. Fewer than roughly three teams, no independent cadence, or one strong consistency requirement spanning the domain: stay monolithic. Forecast 10× growth is not a trigger; a measured bottleneck is. Write triggers as concrete conditions: "checkout p99 above 300 ms at p95 load" or "two teams blocked on the same release for two consecutive cycles", so the decision can be revisited without re-litigating it.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-22

Define ownership boundaries from requirements.

Answer

What I'd say in the first minute. "Ownership boundary" only means something once I know which invariants must hold and what failure the business can absorb. So before drawing any line I'd ask three things: which facts must have exactly one writer, what the peak read/write rate is, and what the failure budget is. Can this path be eventually consistent, or does a user stare at the inconsistency? Then I'd answer directly: put a boundary wherever an invariant needs a single authority, and put a contract everywhere else.

Worked case. A marketplace doing 4,000 orders/min at peak (hypothetical but representative). Four capabilities: order placement, inventory, payments, notifications.

  • Order placement and inventory share the invariant "no order without reserved stock." Split them and you need a distributed transaction or a reservation saga; keep them in one service with one writer to the stock table and the invariant is a local row lock.
  • Payments has its own invariant, exactly-once capture, enforced locally with an idempotency key on the capture call. It owns its ledger.
  • Notifications has no invariant. At-least-once delivery with 30s of lag is invisible to users, so it just consumes events.
CapabilityData of recordInvariantBoundary
Order + inventorystock tableno oversellone service, single writer
Paymentsledgerexactly-once captureown service, idempotency key
Notificationsnoneat-least-onceevent consumer, eventual

What actually decides a boundary. The invariant test comes first: if two capabilities must change the same rows atomically, they are one boundary. Change cadence is second, if pricing changes weekly and catalog changes daily, coupling them means every catalog deploy drags pricing through review. Failure isolation is third: I keep the checkout path off the same runtime as batch reporting so a runaway report can't take down orders. Team ownership is last, and it's a constraint, not a criterion: a boundary nobody can staff or page on isn't a boundary, it's a gap.

Failure modes and how you see them. A shared mutable database shows up as two teams' migrations colliding and lock contention pushing write p99 up; the blast radius is both services' writes. Dual ownership of a decision, say both order and pricing compute the final price, shows up as drift, caught by a nightly reconciliation that reports the mismatch count. A synchronous chain is the quiet one: if checkout calls six services and inventory's p99 is 800ms, checkout's p99 goes from roughly 120ms to roughly 900ms, and retries multiply it.

Trade-offs. Strong consistency inside a boundary is cheap: a local transaction. Across a boundary it costs a saga plus reconciliation. Eventual consistency across a boundary costs reconciliation jobs and user-visible lag, which is fine for notifications and not fine for stock. And the decomposition itself can be the wrong call: if two capabilities change together every sprint and share most of their data, splitting them buys a network hop and a version negotiation for no independence. I'd revisit when the coupling evidence (shared deploys, cross-service transactions) contradicts the split I drew.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-7

Plan a brownfield migration architecture from requirements.

Answer

Assume a 10-year-old Java monolith on PostgreSQL, 500 req/s, and a requirement to extract billing into a separate service with zero downtime. Here's how I'd plan it.

First, map the current system's write paths and contracts. Run a dependency analysis (e.g., jdeps for Java) to find which modules touch billing tables. Identify every writer: the monolith, batch jobs, admin tools. That tells me where to intercept writes. I'd also capture the current SLOs: p99 latency 200 ms, error rate 0.1%, and the data ownership: billing tables are owned by the monolith. Check data quality: if 5% of billing rows have a null customer_id, the new service must handle that.

Next, choose a migration pattern. For this case, a strangler fig with change data capture is the default. I'd set up PostgreSQL logical replication to stream billing table changes to Kafka via Debezium. The new billing service consumes those events and writes to its own database. The monolith continues to own writes until cutover. To avoid dual writes, I'd route all billing writes through a facade that can switch between old and new implementations via a feature flag.

Tradeoffs: big-bang would be simpler (stop the monolith, migrate data, start new service) but a 2-hour maintenance window costs $100k in lost revenue. Strangler fig costs an extra $8k/month for dual infrastructure and requires reconciliation. Parallel run (shadow writes) adds another $4k/month but gives high confidence. I'd choose strangler because the requirement is zero downtime.

Failure modes: CDC lag can cause the new service to serve stale data. Monitor replication lag; if it exceeds 5 seconds, alert. Reconciliation mismatches: run a job every 5 minutes comparing row counts and checksums for the last hour. If mismatch rate > 0.1%, halt cutover. Dual writes: if the facade misroutes, both systems write. Detect via reconciliation; mitigate by making writes idempotent with a unique key.

SQL
-- Run every 5 minutes
SELECT
  (SELECT COUNT(*) FROM old.billing WHERE updated_at > now() - interval '1 hour') AS old_count,
  (SELECT COUNT(*) FROM new.billing WHERE updated_at > now() - interval '1 hour') AS new_count;

Cutover: release by cohort. Start with 1% of traffic, then 10%, 50%, 100%. At each step, check error rates, latency p99, and reconciliation. Keep rollback ready: flip the feature flag back. Decommission only after 30 days of zero mismatches and no rollbacks.

Here's a table comparing strategies:

StrategyCutover riskDual-run costRollback easeWhen to use
Big-bangHighNoneHardLow-traffic, maintenance window
Strangler figLowHigh (2x infra)Easy (route back)24/7, high-traffic
Parallel runMediumVery high (3x)EasyHigh-risk data, compliance

Arithmetic: dual-running for 6 months at $8k/month = $48k. Downtime avoided: 2 hours at $50k/hour = $100k. Net benefit $52k.

The decision point is the reconciliation gate: if it fails, you don't cut over.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-19

Manage changing requirements during implementation.

Answer

Core answer (first 90 seconds)

Assume I'm mid-sprint on a service with a published API and at least one downstream consumer. The first move isn't to accept or refuse the change: it's to classify it by blast radius, because that decides everything else.

Three classes:

  1. Additive and backward compatible: a new optional field, a new endpoint. Absorb it now.
  2. Behavioural change behind an existing contract: same shape, different semantics. Absorb only behind a flag, ship dark, then flip.
  3. Breaking contract or accepted-ADR change: a field type change, a removal, a changed ordering guarantee. Never absorb mid-sprint; schedule it as expand/contract.

The decision rule: if the change is reversible within one deploy and touches one component, absorb it. If it crosses a contract boundary or invalidates an ADR, it goes to the owner with options and a cost attached.

Mechanism

Record the change as a new row, never an edit: source, business reason, date, and the requirement ID it modifies. The baseline stays; you get a diff. That's what makes "why did this ship" answerable six months later.

For a breaking change, expand/contract: add the new field alongside the old, dual-write, migrate consumers, then remove the old field after the last consumer is off it. With Protobuf, never reuse a field number: reserve it. With Kafka and a schema registry, set FORWARD compatibility so a producer can't publish a schema that existing consumers can't read; the registry rejects the publish in CI rather than in production.

If the change invalidates an accepted ADR, write a superseding ADR that links to the one it replaces. Don't edit the old one: the history is the point.

Trade-offs

Three credible options, and the criteria that pick between them:

optionwhen it winscost
absorb nowreversible in one deploy, one component, no contract changedisplaces committed sprint work
defer behind a flagsemantics change, consumers need timeflag debt, two code paths until cleanup
reject / renegotiateinvalidates an ADR, or cost of delay < cost of reworkstakeholder friction

The deciding question is cost of delay versus cost of rework. If the change is worth less than the work it displaces, say so and renegotiate: rejecting is a legitimate answer, not a failure to be helpful.

Failure modes

  • Silent baseline drift. Someone edits the ticket, the spec and the tests diverge, and you find out at UAT. Detection: acceptance tests run against the spec in CI, not against the ticket. Cost: rework of already-merged code, typically the whole story.
  • Scope creep. Ten "one-line" additions. Detection: track committed versus delivered points per sprint; a widening gap is the signal. Cost compounds: each addition re-triggers review and test.
  • Stale ADR. The doc says one thing, the code another. Detection: a design review where a new engineer proposes the already-rejected option. Cost: re-litigating a settled decision.
  • Downstream breakage. A consumer fails on a schema change. Detection: consumer-driven contract tests (Pact) and registry compatibility checks in CI. Cost: a production incident on someone else's on-call.

Worked trace

Say a payments API adds a required currency field to a request. Additive? No: required makes it breaking for every existing caller. So: add it optional, default to the account currency, dual-read for two releases, then make it required. Three consumers, each needs a release; at a two-week cadence that's roughly six weeks of dual-path code, not the one day the request implies. That gap is the number to put in front of the owner.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-5

Review requirements for a regulated workload.

Answer

What I'd say in the first two minutes

Three things decide this review before any control is discussed: which jurisdictions the data touches, which data classes are in scope, and who the regulator is. Assume a concrete case: a B2B SaaS storing EU customer personal data and processing card payments, hosted in AWS eu-central-1 (Frankfurt), with a support team in Austin, Texas. That puts the workload under GDPR and PCI DSS v4.0, and makes US support access a Chapter V transfer question, not an afterthought.

My answer: I don't review a requirements document. I convert each obligation into a test that passes or fails against the running system, and I retain the evidence that it passed. A requirement I can't test is a preference, and I label it as one.

Obligation → test → evidence

ObligationTestable requirementEvidence
GDPR Art 5(1)(e) storage limitationEach data class has a stated retention period; deletion runs at expiryRetention config, deletion job logs
GDPR Art 33Breach notified to the supervisory authority within 72 hours of awarenessIncident timeline, on-call runbook
GDPR Ch VNo EU personal data leaves EU/EEA without SCCs plus a transfer impact assessmentS3 bucket policies, CloudTrail, region config
PCI DSS 10.5.1Audit logs retained 12 months, most recent 3 months immediately searchableLog retention policy, SIEM query
PCI DSS 3.3.1Sensitive authentication data not stored after authorisationSchema review, tokenisation design
PCI DSS v4.0 (future-dated items mandatory 31 Mar 2025)Quarterly ASV scans, annual internal and external penetration testScan reports, pen test report

Where the design choices actually are

Scope reduction is the highest-leverage decision. Tokenising the PAN so the CDE holds only tokens keeps the cardholder data environment small; field-level encryption keeps the PAN in the database and drags every replica, backup and analytics job into scope. Segmentation with a documented, tested boundary is the middle path. I'd pick tokenisation when the business doesn't need the PAN, encryption when it does, and I'd require a segmentation test, not a network diagram, before trusting a boundary.

How this fails in practice

  • Scope creep through support. An engineer in Austin pulls a production dump to a laptop; the corporate network is now arguably in PCI scope. Detected by data-flow review and DLP alerts on database exports, not by the annual assessment.
  • Silent cross-region replication. A DR policy replicates eu-central-1 to us-east-1. GDPR Chapter V breach; detected by config drift checks against an approved-region allowlist.
  • Log retention in both directions. CloudWatch Logs defaults to never expiring: a storage-limitation problem. Teams that "fix" it with 30-day retention then fail PCI DSS 10.5.1's 12-month requirement. The correct setting is 12 months with 3 months hot.
  • Soft deletes. An Art 17 erasure request clears the row but leaves the record in backups and the analytics warehouse. Detected only by a deletion test that queries backups, not the primary.

Reassessment triggers

Re-run the review when data purpose, vendor, region, threat model or regulation changes, and treat a certification as evidence about a period, not about your design. A SOC 2 Type II report covers a tested window, commonly 12 months; it does not tell you whether this workload's data flows are lawful. GDPR penalties reach €20M or 4% of global annual turnover, whichever is higher, so the cost of a wrong assumption is not abstract.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-3

Build a traceability model from business outcome to production evidence.

Answer

The 90-second answer

Model it as a typed graph, not a document tree. Nodes are things with an owner and a lifecycle; edges are typed claims that carry evidence and the version they were asserted against. The model only earns its keep if it answers three queries: what breaks if this changes, is this release ready, and what has rotted. Everything else is bookkeeping.

Assumptions I'd state up front: roughly 200 services, Jira for requirements, ADRs in the repo, OTel for signals, OPA for policy checks, SLOs in Prometheus. If you're one team with ten services, stop: a spreadsheet with a link column is cheaper and you'll actually maintain it.

Nodes and edges

prefixnodemandatory outgoing edge
OUT-business outcomerealized_by → CAP
CAP-capability / flowdecomposed_into → REQ
REQ-requirementverified_by → VER
ADR-decisionconstrains → REQ, supersedes → ADR
CMP-componentimplements → REQ
VER-verification (test, drill, policy check)—
SIG-operational signal (SLO, alert)observes → REQ

Every edge carries type, source, updated_at, and the node version it was asserted against. That last field is what makes rot detectable rather than a matter of opinion.

Rot detection

SQL
-- edges asserted against an older version of their target
SELECT e.src, e.dst, e.type, e.updated_at, n.version
FROM edge e JOIN node n ON n.id = e.dst
WHERE e.updated_at < n.updated_at
  AND e.type IN ('verified_by', 'observes');

-- mandatory requirement with no verification
SELECT r.id, r.owner FROM node r
WHERE r.type = 'REQ' AND r.mandatory
  AND NOT EXISTS (SELECT 1 FROM edge e
                  WHERE e.src = r.id AND e.type = 'verified_by');

Worked trace: change impact

ADR-31 supersedes ADR-12. ADR-12 ("authorize synchronously against the issuer") constrains REQ-2041 ("authorize a card in ≤ 400 ms p99 at 1,200 rps"). REQ-2041 is verified by VER-889 (load test, 1,200 rps, p99 ≤ 400 ms) and observed by SIG-12 (SLO: auth p99 ≤ 400 ms, 99.5% over 28 days).

Traverse supersedes → constrains → verified_by / observes and you get REQ-2041, VER-889, SIG-12, CAP-77, OUT-142. The actionable part: VER-889's threshold was derived from issuer round-trip latency, so under ADR-31's local risk cache it no longer tests the same thing. The release gate becomes re-baseline VER-889 before trusting SIG-12. Without the edge version field you'd see a green load test and ship.

Trade-offs

Three ways to model this, and the deciding number is edges per node.

  • Document tree (Jira epics → stories): cheap, but a requirement spanning three components gets duplicated three times and the copies drift.
  • Tags and labels: cheap, but verified_by and related_to look identical, so impact queries over-return. You get 400 nodes back and stop reading.
  • Typed graph: queryable and precise, but every edge is a maintenance liability. As a planning estimate rather than a measured figure, budget about one owner-hour per 50 edges per quarter for pruning.

Pick the graph when a typical requirement touches more than two components or more than one team. Below that, the tree wins.

Failure modes

  • Edge inflation: everything links to everything. Detect with a fan-out alert: any node with more than 25 outgoing edges gets reviewed.
  • Stale verification: the test passes but the requirement moved. Detect with the version query above.
  • Green-dashboard rot: the trace is complete but VER- is a unit test asserting a mock. Detect by requiring every VER- edge to name an environment and a data set.

What would change my answer: if the org can't staff the pruning, I'd cut to outcomes → requirements → SLOs, three node types, and accept losing decision traceability.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-24

Decide whether to accept an unmet architecture requirement at launch.

Answer

Short answer: I don't accept it myself. I either remove the feature from launch, delay, or get the accountable authority to sign a time-boxed exception with a compensating control and monitoring. I only recommend the exception when the gap is internal, the blast radius is bounded, and the cost of delay is real.

Assumptions: I'm the architect, not the risk owner. The requirement is an internal architecture standard, not a regulatory obligation. If it's PCI DSS, HIPAA, or a contractual security term, I stop: no project owner can waive it.

Architecture requirements are invariants. An unmet one means the system can enter a state you said it must never enter. So the decision is not "is the feature good?" It's "what state are we allowing, for how long, and who can detect and stop it?"

Hypothetical: launch gate says all public endpoints sit behind WAF with OWASP CRS. One admin export endpoint /admin/export is not. It's SSO + MFA, IP allowlist, internal only. 12 users, 3 exports/day, 10k rows each. 6-week gap. Arithmetic: 12 × 3 × 42 = 1,512 calls; 1,512 × 10k = 15.1M rows. If security estimates 2% credential compromise over 6 weeks, expected exposure = 302k rows. That's not a rounding error.

OptionShipsResidual riskCostChoose when
Delaynothingnone2 weeks, $180k committed spend, 3 teams idlemandatory or auth bypass
Feature flag offall but exportnone20 manual requests/weekexport not launch-critical
Accept with controlall302k rows expected1 day eng: IP allowlist + alert >1 export/user/dayinternal, MFA, 6-week expiry
Scope reductionexport capped 100 rows3k rows expected2 dayspartial value

I'd choose feature flag off if export isn't launch-critical. If it is, I'd recommend accept with control only if security agrees the 2% is conservative and the alert is wired to PagerDuty. Otherwise delay.

Failure modes. The exception outlives its expiry: ADR says "accepted until 2025-06-30", but nobody removes it. Detection: weekly query for exceptions past expiry; cost one staff-week per quarter. Compensating control drifts: IP allowlist becomes 0.0.0.0/0 during an incident. Detection: config drift alert on the security group; runbook reverts in 15 min. Monitoring blind spot: no WAF logs, so if attacker stays under 1 export/user/day, you never see it. That's why I prefer feature isolation over a control that only logs.

The record has: requirement, gap, affected users/flows, owner, accountable authority, expiry, trigger, compensating control, detection, rollback, due date. Readiness status says "launch with accepted exception" not "green". Revalidate before expiry or after incidents; close only with evidence, not a changed label.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-8

Decide how much diagram detail an architecture needs.

Answer

The 60-second answer

Detail is a cost, not a quality axis. Every box you draw has to be maintained, and a stale diagram is worse than no diagram because people trust it. So decide detail from the decision the diagram has to support: name the question, name the reader, then stop at the first level where one more level of detail would not change anyone's answer.

In practice that maps to: scope and external dependencies → system context; deployable/runtime units and their technology → container; internal structure of a single container → component, and only for the containers that carry the risk; sequences, especially async and failure paths → dynamic; nodes, zones and networks → deployment. Add data-ownership and trust-boundary views when a security review or a data-protection question is actually on the table, not by default.

The stopping test is blunt: if you cannot name the decision a box or arrow changes, delete it. A diagram that survives that test is usually smaller than the author wanted.

Worked example (hypothetical figures)

Payments platform, 60 services, 4 teams, two candidate diagrams for the same container:

diagramelementsredraw costconsulted per quartercost per answer
component view, hand-maintained343 h630 min, and roughly half the answers are stale
system context, hand-maintained920 min4030 s

The component view is not wrong to exist: it is wrong to be the default. Spend detail where consultation frequency times decision cost is high. Here the context view earns its upkeep 60× over; the component view earns it only for the two containers where a wrong internal boundary would cost a migration.

Failure modes and how you catch them

  • Abstraction mismatch. A component view that shows private helpers and local variables. Detected when readers ask "what is this box?" or when a box has no owning team.
  • Sprawl. Forty diagrams, none updated. Detected in git: the last commit to the diagram source predates the last change to the system it describes. With diagrams-as-code this is a CI check: fail the build when a service's declared dependencies change without a model update.
  • Stale truth. The diagram contradicts the ADR or the OpenAPI contract. Detected in review; the fix is to make the model the source and render the diagram from it.
  • Happy-path-only dynamic views. Detected in the postmortem: did the diagram help during the last outage? If nobody opened it, it is decorative.
  • One diagram for everyone. Execs, new hires and on-call engineers need different levels. Detected when nobody can say who the diagram is for.

Alternatives and when to pick them

Hand-drawn versus diagrams-as-code: Structurizr DSL or C4-PlantUML keeps one model and renders context, container, component and deployment views from it, so consistency is mechanical rather than a review habit. The cost is learning the DSL and keeping the model in the repo; it pays off above roughly ten services or three teams. Below that, a hand-drawn context view plus an ADR is cheaper.

Diagram versus ADR versus contract: a diagram carries structure, not rationale and not schema. Link out to the ADR and the spec rather than redrawing them: duplicated detail is the detail that goes stale first. C4 gives you the levels; arc42 gives you the document sections. Pick one vocabulary and stay inside it, and version and date every view with its scope and legend.

If the interviewer pushes on "how do you know it's right?"

A diagram is right when a named reader answers a named question without you in the room. Test it: hand the context view to a new hire and ask what sits outside the boundary; hand the dynamic view to the on-call engineer and ask which hop fails first. If they cannot, the detail is in the wrong place, not insufficient.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-25

Keep architecture documentation useful after launch.

Answer

What I'd say first

"Useful after launch" is the wrong frame if it means "keep the docs accurate." Accuracy is a byproduct. What keeps architecture docs alive is that each one has a consumer who will notice when it's wrong, and a trigger that fires when the system changes. A doc with no consumer and no trigger is already dead; it just hasn't been read yet.

Assumptions I'd state up front: the system is in production, changes go through pull requests, and there's at least one recurring event (an incident, a migration, a dependency bump) that forces a re-read.

The mechanism

Docs rot for one reason: the source of truth and the doc live in different places, so a change updates one and not the other. Two moves fix most of it.

  1. Put the doc where the change happens. ADRs, runbooks and diagrams live in the same repo as the code and are reviewed in the same PR. If a change to a service boundary doesn't touch the diagram, the reviewer asks why.
  2. Where a source of truth already exists, generate from it and never hand-edit. Service catalog, dependency graph and API surface can come from code or config. Hand-written prose that duplicates a generated fact is exactly the part that drifts.

Then attach an owner and a trigger to everything that can't be generated. The trigger is the important half: "review annually" never fires; "review when this service's SLO breaches or its upstream dependency changes major version" does.

Trade-offs

Docs-as-code (Markdown in the repo, reviewed in PRs) buys the trigger for free and costs discoverability: engineers who don't know the repo exists won't find it. A wiki buys discoverability and loses the trigger. The usual answer is docs-as-code plus a generated index (Backstage TechDocs, Structurizr for C4 diagrams) so the catalog is searchable but the content stays versioned.

Auto-generation isn't free either: a generated diagram nobody reads is still noise, and a generator that silently fails produces a stale diagram that looks current. Worse than no diagram. So generate, alert on generation failure, and keep a human on the semantics.

When not to document: anything with no decision behind it and no operational use. A component diagram of a service you're deleting next quarter isn't worth the review time.

Failure modes and how you catch them

  • Stale diagram used in an incident: on-call follows a box that no longer exists. Catch it by making the diagram part of the runbook and having the incident review ask "did the diagram match?"
  • ADR that contradicts the code: two ADRs both "accepted" for the same decision. Catch it by superseding rather than editing: an ADR is immutable; a reversal is a new ADR that links back.
  • Runbook step that no longer works: catch it by running it in a game day or recovery drill, not by reading it.
  • Orphaned doc: no owner, no inbound links. Catch it with a link checker and a "last verified" field; anything unverified past its trigger window shows up in a report.

Artefacts

ArtifactSource of truthTrigger to re-readHow you detect rot
ADRthe decision, in the reporeversal or superseding decisiontwo accepted ADRs on the same topic
C4 context/container diagramStructurizr DSL or codeservice boundary or dependency changediagram missing from the PR diff
Runbookthe operational stepsincident, SLO breach, dependency bumpgame-day drill fails
Service catalog entrycode/configdeploygeneration job fails

Worked example (hypothetical): a payments service splits into two. The PR touches 40 files and no diagram. CI runs a check that maps changed service names to diagrams referencing them; the diagram is flagged stale. The reviewer either updates it or records why the split doesn't change the boundary. That check is the whole mechanism: it turns "someone should update the docs" into a failing build.

What would change my answer

If the team is small and the system is one deployable, a heavyweight doc process costs more than it saves; a README and a runbook are enough. If the org has a compliance driver (SOC 2, PCI), the trigger set is dictated externally and you document to the auditor's questions, not the team's.

Curated: · Written: · Reviewed:

Difficulty: Medium