Architecture Documentation and Communication Questions
Making an architecture legible to others: architecture decision records (templates, alternatives and consequences, lifecycle, supersession, tagging and discoverability), diagramming and visualization (C4, sequence, deployment, data-flow and trust-boundary diagrams, notation conventions), and communicating designs to technical and non-technical stakeholders. Covers capturing rationale, documenting what a system does under failure, load and consistency trade-offs, recording observability, SLO and security content, running design reviews, keeping docs and diagrams current, and presenting a system clearly under time pressure. The communication skill that separates a good design from an understood one.
You depend on external systems for tax calculation, identity verification and analytics. How do you document each integration point so the failure behaviour and ownership are clear to someone on call?
Sample Answer
Direct answer
For each external dependency I keep one short "integration card" in the repo of the service that calls it, written for the person on call: what the dependency does for us, who owns it on both sides, how it fails, what our system then does, what the user sees, and where to look first. The failure behaviour must be decided and written down per dependency, because "the tax API is down" needs a different response from "the analytics API is down".
The card (fields)
- Purpose and criticality: what breaks for users if it is gone (blocks checkout, degrades, invisible).
- Owner: our owning team and on-call channel, plus the vendor's support route, account or contract reference, and status page.
- Call details: endpoint, timeout, retry policy, circuit breaker (a switch that stops calling a failing dependency for a while so it can recover and so we do not pile on).
- Failure behaviour: fail closed (refuse the action) or fail open (proceed without it), any fallback, and what the user sees.
- Data sent: especially personal data, which affects vendor risk and incident duty.
- Signals: dashboard link, the alert, and what "unhealthy" means.
- Runbook link (a step-by-step operating guide) with first three steps, and the credential rotation procedure.
Worked example: the three dependencies (timeouts and thresholds are illustrative values to be tuned)
| Tax calculation | Identity verification | Analytics | |
|---|---|---|---|
| Criticality | High: needed to price an order | High for new high-risk accounts, none for existing users | Low: no user impact |
| Timeout / retry | 2 s, one retry | 5 s, no automatic retry (the vendor step is not safe to repeat blindly) | 500 ms, none |
| On failure | Fail closed for checkout by default; finance may approve a fallback to last known rates per region, with orders flagged for reconciliation | Fail closed: put the account in "pending review" and queue for later retry or manual review | Fail open: drop or buffer events, never block the request |
| User sees | "We cannot calculate tax right now, try again shortly" | "Verification is taking longer than usual, we will email you" | Nothing |
| Page the on-call? | Yes when error rate stays high for 5 minutes | Yes when the pending queue keeps growing | No, ticket only |
| Vendor-side owner | Vendor support plus account manager | Vendor support | Vendor support |
Notice that the fallback for tax is a business and legal decision, so the card names who approved it, rather than an engineer guessing at 3 a.m.
How the card helps at 3 a.m.
The on-call engineer reads the page from the alert, sees "fail closed, checkout blocked, check vendor status page, then the circuit breaker dashboard", and knows within a minute whether the problem is theirs, the vendor's, or a bad credential.
Trade-offs and pitfalls
- Documenting only the happy-path API contract is the common miss; the failure column is the valuable one.
- Cards rot. Put them next to the code, require a card in the pull request that adds a new integration, and review them when the vendor contract renews or an incident involves that vendor.
- Do not copy the vendor's docs into the card; link to them and record only our decisions and our numbers.
A cross-region system can lose connectivity between regions or lose its primary database. How do you show those scenarios on architecture diagrams and in operational docs so that both the user-visible degradation and the recovery path are clear?
Sample Answer
Direct answer
I would draw the normal state once, then give each failure its own diagram overlay and its own runbook page, with the same four headings every time: what the user sees, what data is at risk, how we recover, and who decides. A single "resilient architecture" picture hides the difference between losing the link between regions and losing the primary database, and those are different problems with different recoveries.
The diagram (deployment view: which software runs where, in which region, with the two scenarios marked)
flowchart LR
U[Users] --> G[Global traffic routing]
G --> A[Region A: app tier]
G -.->|"only if A is declared down"| B[Region B: app tier]
A --> P[(Primary database)]
P ==>|"async replication, lag shown on dashboard"| R[(Replica in Region B)]
B -.-> R
X1{{"Scenario 1: link between regions is cut (strikes the replication path)"}} -.-> R
X2{{"Scenario 2: primary database is lost"}} -.-> P
How to read it: solid arrows are the normal path; the dotted arrow from global routing to Region B is used only after Region A is declared down (a named person or an agreed rule, for example health checks failing for 3 minutes, formally decides A is out); the thick arrow is data replication; each hexagon marks where a scenario strikes: scenario 1 touches the replica end of the thick replication arrow (Mermaid cannot point at an arrow itself), scenario 2 touches the primary. Alert on lag during scenario 1, because the lag is the data you would lose.
Beside the picture, always state: the consistency model (what readers are promised to see after a write; here replication is asynchronous, meaning the primary confirms a write before the replica has it, so the replica trails), the RPO (recovery point objective: the most data we accept losing, measured in time) and the RTO (recovery time objective: how long recovery may take). Put real values on the page, for example RPO 5 seconds and RTO 15 minutes. Measured lag of 4 seconds fits inside the 5 second RPO; lag of 30 seconds would not, and the dashboard should alert before that.
Scenario pages
| 1. Link between regions is cut | 2. Primary database is lost | |
|---|---|---|
| User-visible | Region A keeps serving. Data that changed in A is not visible in B. Any users or jobs already reading from B (for example a reporting job or users pinned to B) see older data; global routing does not send new traffic to B while A is healthy. | Writes fail or queue until a new primary is promoted. Reads may continue from the replica. |
| Data at risk | Nothing lost yet, but replication lag grows for as long as the link is cut, so the RPO clock is running: if Region A is then lost before the link returns, everything written since the cut is gone. Also divergence risk if both sides accept writes. | Writes not yet replicated. Worst case equals the replication lag at the moment of failure (if lag was 4 seconds, up to 4 seconds of committed writes). |
| Recovery | Wait and let replication catch up; do not promote B. | Promote the replica after the decision rule is met; repoint the app; rebuild a new replica. |
| Decision | On-call, no failover needed. | Named authority, using the rule on the page. |
A runbook is the step-by-step operating procedure an on-call engineer follows during an incident. A filled scenario 2 page, for example: User sees: checkout fails for up to 15 minutes. Data at risk: up to 4 seconds of orders (current lag). Recover: confirm the primary is truly gone, promote the Region B replica, repoint the app, build a new replica. Decides: the incident commander (the person in charge during the incident), after 3 minutes of failed health checks.
Split-brain and flapping
Split-brain means two regions both believe they are the primary and both accept writes, so their data diverges. The docs must state the single-writer rule: only the holder of the current write lease (an expiring right to write) may accept writes, and each promotion increments an epoch number (a counter that only goes up) so an old primary is rejected when it returns. Traced: Region A is primary in epoch 7. A goes dark and B's replica is promoted in epoch 8. When A returns it still thinks it is epoch 7, but the storage layer and gateway only accept writes stamped epoch 8 or higher, so A's writes are rejected and A must resync as a replica. Flapping means leadership bouncing back and forth on a shaky link. The runbook adds a hold-down time (a minimum wait before another promotion) and forbids automatic promotion on a partition alone.
Make lag visible
The topology diagram links to a live dashboard showing replication lag, because the recovery decision ("how much would we lose?") is answered by that number.
Trade-offs and pitfalls
- Drawn failovers that skip fail-back (returning to the original primary after the outage) leave teams stuck with the wrong primary. Document the return path.
- Do not promise a zero RPO with asynchronous replication.
How would you show latency budgets, throughput, error rates, contracts and owners directly on service diagrams, and what conventions would you standardise so the annotations stay readable?
Sample Answer
Direct answer
I annotate the diagram with a small, fixed set of fields on a fixed place: owner as a badge on each box, contract as a link ID on each arrow, and the numbers (latency budget, throughput, error rate) as a short one-line label per arrow. Anything beyond that goes in a table under the diagram, and the numbers are generated from monitoring and contract files so they carry an "as of" date and do not rot.
The conventions I would standardise
- Node (a service box): name from the service catalog, plus a badge with the owning team, for example
pricing-api | team: pricing. - Edge (an arrow): one line, always in the same order:
contract | p95 budget | rate | error-rate target, for examplepricing-v2 | p95 150 ms | 300 rps | err < 0.1%. (p95 means the 95th percentile: 95 percent of requests are faster than this. rps means requests per second. The last field is the highest acceptable share of failed requests, 0.1 percent here. It is a per-request target, not the SRE "error budget", which is the total failure allowance over a period, derived from a reliability target.) - Colour is reserved for one meaning, health against target (green, amber, red), never for teams.
- A legend on every diagram, and an "as of" date.
- Limit: about 12 boxes and one annotation line per arrow; more goes into a table or a separate diagram.
- Contract means a link to the API specification (for example an OpenAPI document, a machine-readable description of an HTTP API's endpoints and message shapes) and its version, not prose.
Component-diagram tutorial box
pricing-api (owner: pricing team, contract: pricing-v2 OpenAPI spec, p95 budget 150 ms). Someone reading the box knows what it is, whom to page, which interface to read, and how slow it is allowed to be.
Latency budgets on the critical path
The critical path is the longest chain of calls the user waits for. Steps that run in parallel count as the slowest of them. Illustrative checkout with an end-to-end p95 target of 800 ms:
| Step | Budget (ms) |
|---|---|
| Gateway | 50 |
| checkout-service own work | 100 |
| pricing (150) in parallel with inventory (120) | 150 (the larger of the two) |
| payments | 300 |
| Total on the critical path | 600 |
50 + 100 + 150 + 300 = 600 ms, leaving 200 ms (25 percent) of headroom under 800 ms. Adding percentiles is an allocation rule, not exact statistics, and it is conservative only for calls in series. For the parallel pair the larger budget slightly understates the risk: if pricing and inventory were independent and each met its own p95, both would be within budget only about 90 percent of the time (0.95 x 0.95 = 0.9025), and reaching 95 percent for the pair would need each side at about its 97.5th percentile (0.95 ** 0.5 = 0.9747). That is one more reason to keep the 200 ms of headroom. The p95 of a chain is not the sum of each step's p95: a request is rarely unlucky in every step at once, so the true combined p95 is usually lower than the sum, but correlated slowness (for example a busy database slowing several steps together) can break that. So I treat the sum as a budget to allocate and keep headroom instead of budgeting to the last millisecond.
Instrumentation placement
Put a trace span (a timed record of one operation, from distributed tracing) at each service entry and around each outbound client call, on the critical path only. Then the diagram's numbers come from the measured span durations, and the difference between a caller's client span and the callee's server span reveals network or queueing time. For example, if checkout's client span around the call to payments lasts 340 ms but payments' own server span lasts 290 ms, the other 50 ms went to the network, connection setup or waiting in a queue before payments started work, and that 50 ms is invisible if only one side is measured.
Trade-offs and pitfalls
- Hand-typed numbers go stale; generate annotations from the monitoring configuration and contracts, or show them with a date.
- Annotating every arrow makes the diagram unreadable: annotate the critical path and the arrows that have a service-level objective, and leave the rest. (A service-level objective, SLO, is the reliability target a team commits to, such as 99.9 percent of requests succeeding.)
- Throughput and error rate are observed values, while budgets are targets. Label which is which, otherwise readers cannot tell "allowed" from "actual".
You are reviewing an architecture diagram of a payments platform that mixes synchronous authorisation with asynchronous settlement, and the diagram has no reliability annotations. What do you ask the author to add, and which gaps worry you most?
Sample Answer
Direct answer
I would ask the author for four things before I approve: (1) per-arrow reliability annotations (timeout, retry policy, idempotency, and what the caller does on failure); (2) an explicit state machine for a payment (a diagram of every state it can be in and which events move it between them), including an "unknown outcome" state; (3) the reconciliation path that proves money and records agree; (4) trust boundaries and ownership. The gap that worries me most is a synchronous authorisation call that times out with no defined way to find out what actually happened, because that is how you get double charges or lost payments.
What to ask the author to add, grouped by the two halves
Synchronous authorisation (customer waiting)
- Latency budget: if checkout must answer within 5 s, each hop gets a share and timeouts must nest, each outer timeout longer than the inner one plus its retries. For example client 5 s, gateway 4 s, acquirer call 3 s with no retry, so the acquirer times out first and the gateway can still report the outcome. If the acquirer call is retried once, the inner total is 3 + 3 = 6 s, which already exceeds the gateway's 4 s, so the budget must change: for example 1.5 s per attempt with one retry (3 s worst case, ignoring the backoff wait), or no retry at this hop and rely on the status inquiry instead.
- Idempotency (repeat-safe requests): an idempotency key from the client, stored with the result, so a retried request returns the original outcome instead of charging again.
- Behaviour when the acquirer (the bank-side card processor) is slow or down: decline, retry a second processor, or queue? Pick one and draw it.
Asynchronous settlement (money movement later)
- Delivery guarantee on the queue (at-least-once) and consumers that dedupe on payment ID.
- Dead-letter queue (DLQ, where repeatedly failing messages are parked), with an owner and an alert on its depth.
- Reconciliation: a scheduled comparison of our ledger (our record of every payment and amount) against the processor's settlement file (the daily report of what money it actually moved), with an alert on any mismatch. Without it, drift is silent.
- The outbox pattern (write the event and the state change in one database transaction, publish afterwards) so events are never lost between the database and the queue.
Across both
- SLOs (service-level objectives) per path: authorisation availability and latency; settlement completeness within a stated window.
- Trust boundaries and PCI DSS scope (the card-industry security standard): where card data lives, and that only tokens travel elsewhere.
- Ownership per component, runbook links, and RTO/RPO (recovery time objective, how fast we recover, and recovery point objective, how much data we may lose).
The payment state machine I would insist on
stateDiagram-v2
[*] --> Received
Received --> Authorized: acquirer approves
Received --> Declined: acquirer declines
Received --> Unknown: timeout
Unknown --> Authorized: status inquiry says approved
Unknown --> Declined: status inquiry says none
Authorized --> Settled: settlement file matches
Authorized --> Mismatch: settlement file differs
Mismatch --> Settled: manual correction
Worked example: the timeout
The acquirer call has a 3 second timeout and it fires. Without the Unknown state, the service either retries (risking a second authorisation) or fails the payment (risking a hold on the customer's card with no order). With it, the service records Unknown, asks the acquirer "what happened to reference k1?" (a status inquiry), and moves the payment to Authorized or Declined. If the inquiry also fails, a background job keeps asking, and reconciliation is the safety net.
Which gaps worry me most (in order)
- Ambiguous timeout outcome (above).
- No idempotency on settlement events, so duplicates double-post the ledger.
- No reconciliation, so errors are found by customers.
- Unmarked card-data boundary.
My rule for what blocks approval: a gap blocks if, when it happens, money is wrongly moved or nobody can tell. The first three each meet that test (double charge, double posting, silent drift); the card-data boundary is a compliance blocker. Everything else can be fixed after launch.
Extra check, service mesh (less commonly asked). If the diagram includes a service mesh (sidecar proxies handling service-to-service traffic), it must also show: whether retries are configured in the mesh AND in application code (retries multiply), timeouts per route, circuit-breaking settings, whether traffic is encrypted between services (mutual TLS: both sides prove their identity with certificates), and which calls bypass the mesh.
Extra check, shared cache (less commonly asked). If a shared Redis cache sits in a model-serving path, ask: what happens on a cache miss or Redis outage (fallback and load on the backing store)? Time-to-live (TTL, how long an entry lives) versus staleness of features; a stampede (many simultaneous misses all hitting the backing store together); eviction policy (which entries are dropped when memory is full); who owns the keyspace; and whether a single shared instance is a single point of failure (one component whose loss takes everything down). Example: a 60 s TTL on a feature means predictions may use values up to 60 s old, which the model owner must accept in writing.
Trade-offs and pitfalls
- Asking for everything makes the review unusable; mark which asks block approval (timeout outcome, idempotency, reconciliation) and which are follow-ups.
- Adding a second acquirer improves availability but adds routing complexity and reconciliation for two files.
You are documenting a message-bus-based ingestion pipeline. What must the documentation tell producers, consumers and operators, and how would you diagram it so delivery guarantees and failure behaviour are unambiguous?
Sample Answer
Direct answer
A message-bus pipeline document is a contract with three audiences. Producers need to know what to send and what is promised on publish. Consumers need the delivery, ordering and duplicate rules, and what happens to a message that fails. Operators need retention, partition, capacity, alerts and replay steps. The diagram must show partitions, retries and the dead-letter path explicitly, because those are where delivery guarantees are decided.
Vocabulary first
- Broker: the server that receives messages and holds them until consumers read them.
- Topic: a named log of messages on the broker, like one labelled mailbox stream (here
model-updates). - Partition: one slice of a topic's log; messages with the same key always land in the same partition, which is why order is kept per key. The key is hashed to a number and mapped to a partition (for example hash 17 on 6 partitions is 17 mod 6 = partition 5).
- Consumer group: a set of consumers that share a topic, each partition going to exactly one member. With 6 partitions, at most 6 consumers in a group do useful work.
- Offset: a message's position number in its partition. Commit offset (acknowledge) means the consumer tells the broker "I have finished everything up to here", so a restart resumes after it.
- Retry with backoff: try again after a growing wait (for example 1 s, 4 s, 16 s) rather than hammering a failing system.
- Dead-letter topic: a separate topic where messages that keep failing are parked for a human, so they do not block the rest.
- Consumer lag: how many messages a consumer is behind the newest one in its partition.
- Retention: how long the broker keeps messages (here 7 days), which also limits how far back you can replay.
- Local outbox: a table in the producer's own database where the event is saved first, then sent to the broker later, so a broker outage cannot lose it.
What the document must tell each audience
| Audience | Must know |
|---|---|
| Producers | Topic name and owner; the message key and why (ordering scope); schema and version; when a publish counts as done; behaviour when the broker is down; size and rate limits |
| Consumers | Delivery guarantee (at-least-once); ordering scope; the idempotency key; retry policy and dead-letter behaviour; how far back they can replay; consumer group naming; schema deprecation policy |
| Operators | Retention and partition count; consumer lag and dead-letter depth alerts; replay and dead-letter runbooks; capacity and quotas; who is on call |
Delivery semantics in plain terms
- At-least-once: a message is redelivered if the consumer does not acknowledge it, so duplicates are possible. It is the honest default: consumers acknowledge after processing succeeds.
- Exactly-once: across a network you cannot generally guarantee a message is delivered once. Some brokers offer transactional exactly-once inside the broker boundary, but side effects outside it (a database write, an email) still need protection. The practical claim to document is "at-least-once delivery plus an idempotent consumer", meaning processing the same message twice has the same effect as once, achieved by recording processed event ids.
- Ordering: guaranteed only within one partition (a subset of the topic's log). Choosing the key decides what stays ordered.
Diagram: partitioning, consumer groups, retry and dead-letter
flowchart LR
P[Producer] -->|key = model_name| T
subgraph T[Topic model-updates: 6 partitions, retention 7 days]
P0[Partition 0]
P1[Partition 1]
P5[Partition 5]
end
P0 --> C1[Consumer A in group scorer]
P1 --> C2[Consumer B in group scorer]
P5 --> C2
C1 -->|success: commit offset| OK[Acknowledged]
C1 -->|failure: up to 3 retries with backoff| R[Retry topic]
R --> C1
R -->|still failing| D[Dead-letter topic, 14 days]
D --> O[Alert and replay runbook]
Reading the diagram: partitions 2 to 4 are left out for readability. Trace one failing message: it arrives on partition 0, Consumer A fails to process it, so it is sent to the retry topic and comes back to Consumer A after a wait; after 3 failed retries it moves to the dead-letter topic, an alert fires, and an operator follows the replay runbook. On success the consumer commits the offset and the message is done.
Example: model-update publisher and its versioned event contract
A publisher announces each new machine-learning model version. Key by model_name so version 7 is never processed before version 6 for the same model. Consumers ignore any event whose version is not newer than the one they hold, which also makes duplicates harmless. Trace: a consumer holds version 13. Event version 14 arrives, it is newer, so the consumer applies it and now holds 14. The same event is redelivered because the acknowledgement was lost (a duplicate): 14 is not newer than 14, so it is ignored. A late version 13 arriving afterwards is also ignored.
{
"event_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"event_type": "model.updated",
"schema_version": "1.2",
"occurred_at": "2026-09-28T09:15:00Z",
"model_name": "fraud-scorer",
"model_version": 14,
"artifact_uri": "registry://models/fraud-scorer/14"
}
Schema evolution rules
- Adding an optional field is safe: old consumers ignore it.
- Removing, renaming or changing the type of a field is breaking: publish to a new versioned topic (for example
model-updates.v2) and run both for a deprecation window. - Never reuse a field name with a new meaning.
- Every event carries
schema_version; consumers must tolerate unknown fields.
Failure behaviour, stated unambiguously
| Situation | What happens |
|---|---|
| Consumer crashes mid-message | Offset not committed, message redelivered (duplicate possible) |
| Message keeps failing | Three retries with backoff, then dead-letter topic and an alert |
| Broker unavailable to producer | Publish fails and is retried by the producer; document whether the caller is blocked or the event is queued in a local outbox |
| Partition count increased | Key-to-partition mapping changes (the key is hashed then reduced by the partition count: hash 17 goes to partition 5 of 6 but partition 1 of 8), so events for one key can end up in a different partition than earlier ones and ordering can briefly break; do it in a planned window |
Pitfalls: saying "exactly-once" without saying where; a diagram with a single arrow labelled "queue"; forgetting that the dead-letter topic needs an owner and an alert, or it becomes a silent graveyard.
Unlock Full Question Bank
Get access to all 27 Architecture Documentation and Communication interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.