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.
UML, C4 or informal boxes and arrows: how do you choose a notation for a given audience and system? Give the choice you would make for a product review versus an engineering design discussion.
Sample Answer
Direct answer
I choose the notation from three things: who is reading, what question they need answered, and how long the diagram has to live. For a product review I use C4 context and container views (C4: four zoom levels called Context, Container, Component, Code) in plain language, or clean informal boxes with a legend, and no UML. For an engineering design discussion I use C4 container and component views plus a sequence diagram of the key flow (UML style, Unified Modeling Language, a formal notation set; a sequence diagram shows calls in time order, participants across the top), written as text in the repository so it can be reviewed like code. Notation is a tool for the audience, not an identity.
How the options compare
| Option | Strength | Limit | Where it wins |
|---|---|---|---|
| Informal boxes and arrows | Fast, no learning curve | Ambiguous unless a legend exists | Whiteboard exploration, early ideas |
| C4 | Few concepts, zoom levels, non-technical friendly | Does not model behaviour or detailed design | Mixed audience, onboarding a new engineer |
| UML (sequence, state, class) | Precise for behaviour and lifecycle | Heavy, readers need to know it | Payment state machine (the states a thing can be in and the events that move it), protocol detail, library design |
| Cloud-icon diagrams | Shows real services, familiar to customers | Turns into an icon wall, ties to a vendor | Network and security review, procurement (buying decisions) or client documents |
| Diagrams as code (Mermaid, PlantUML, Structurizr) | Text, versioned, diffable in pull requests | Less layout control | Architecture docs living with the codebase |
Tools for client-facing documents, judged on versioning and reviewability
If you are starting out, use Mermaid for diagrams in the repository and a whiteboard tool for workshops; the rest are optional.
- Drawing tools such as diagrams.net (draw.io): fine if the file is stored in the repository (an SVG, a vector image file, with the editable source embedded keeps it editable); a diff, the line-by-line comparison of two versions, is not readable for it.
- Whiteboard and collaboration tools (Miro, Lucidchart): excellent for workshops, weak on history and review; export a dated copy into the docs.
- Slide software: familiar to clients, hardest to review and keep current.
- Mermaid or PlantUML (text languages that render into diagrams): diffs are readable and reviewed in a pull request (a proposed change other engineers approve before it merges); Mermaid renders directly in many Git hosting pages. Layout is automatic, so complex diagrams can look untidy.
- Structurizr: one model produces several C4 views, which keeps them consistent.
Choice for each meeting
- Product review: one context diagram (users, external systems), one container diagram with plain names ("Customer app", "Order service"), a legend, and the business flow narrated. Keep out class-level detail.
- Engineering design discussion: container plus one component diagram of the risky service, a sequence diagram for the flow under debate (with timeouts and failure), and a state diagram if an entity has a lifecycle. All as Mermaid in the design document.
Worked example. The same order service. The product review sees three boxes:
flowchart LR
C[Customer] -->|places order| O[Order system]
O -->|takes payment| P[Payment provider]
The engineering discussion sees the order lifecycle as a state machine:
stateDiagram-v2
[*] --> Created
Created --> Paid: payment ok
Created --> Cancelled: payment times out
Paid --> Shipped
Paid --> Cancelled: refund
plus a sequence showing what happens if payment times out.
Trade-offs and pitfalls
- Choosing UML because it feels rigorous when nobody in the room reads it.
- Mixing notations in one diagram without a legend.
- Optimising for beauty over reviewability: a diagram nobody can update will be wrong within months.
Here is a one-line architecture description for an analytics ingestion pipeline: 'Clients -> API -> Load Balancer -> Ingest Service -> Batch Processor -> Data Warehouse'. What is missing or misleading, and how would you redraw and narrate it for a design review?
Sample Answer
Direct answer
The one-liner is misleading because it draws a straight chain of boxes, which reads as "every hop is a synchronous call between single instances". In reality this pipeline has a real-time front half (clients, load balancer, ingest) and a scheduled back half (batch, warehouse), and the interesting design decision, the durable buffer between them, is missing entirely. I would redraw it as labeled layers (a durable queue holds messages until consumed and is built for replay; object storage holds files cheaply for later batch reads; stateless means any instance can serve any request because none keeps user state), show the buffer, label every arrow with protocol and sync/async, and narrate it in about a minute: request path, then storage, then batch path, then failure path.
What is missing or misleading
- Order is wrong or ambiguous. "Clients -> API -> Load Balancer" puts the API before its own load balancer. Usually the load balancer sits in front and spreads traffic across several API/ingest instances.
- API and Ingest Service are two boxes with no stated difference. Is one an authentication gateway and the other a validator? Name the responsibility.
- No buffer between Ingest and Batch Processor. How does data cross? A queue, files in object storage, a stream? This decides durability and replay.
- The batch trigger is unstated. Hourly schedule, or event-driven when files land?
- Arrows carry no meaning. No protocol, no payload format, no sync/async, no volumes.
- Failure paths are absent. Bad records (dead-letter queue, DLQ), retries, duplicates from client retries, and late-arriving events.
- Missing artefacts: trust boundary (a line on the diagram where traffic passes from untrusted, such as the internet, to trusted internal systems), ownership, freshness target (how old warehouse data may be), and data retention. The DLQ (dead-letter queue) is where events that repeatedly fail validation are parked for inspection instead of blocking the rest.
Redrawn version
flowchart LR
C[Clients] -->|HTTPS, JSON events| LB[Load balancer]
LB --> I[Ingest service, N stateless instances]
I -->|async append| Q[(Durable queue)]
Q --> R[(Raw files in object storage, hourly partitions)]
R -->|scheduled hourly| B[Batch processor]
B -->|bulk load| W[(Data warehouse)]
I -.->|invalid events| D[(DLQ)]
Worked example: narration for the review (about 60 seconds)
"Clients send JSON events over HTTPS. The load balancer spreads them across stateless ingest instances, which validate the schema and acknowledge only after the event is appended to a durable queue. Bad events go to a DLQ. The queue is drained into raw files in object storage partitioned by hour, so we can replay. Every hour a batch processor reads a partition, deduplicates on event ID (drops any event whose ID it has already loaded, since clients retry) and bulk-loads the warehouse (inserts a whole partition in one operation rather than row by row). Freshness target is about one hour plus load time. The risk I want feedback on: what happens when the batch job overruns its hour."
Variant 1: an event-driven pipeline ("Producer -> Kafka topic -> OrderService -> BillingService"). Kafka is a distributed log; producers append events to a named topic and consumers read at their own pace. Three documentation improvements: (1) name the topic, its key (events with the same key go to the same partition, and order is guaranteed only within a partition) and the event schema; for example topic orders.placed, key orderId, so all events for order 1042 stay in order; (2) state delivery semantics (at-least-once: a message may be delivered more than once) and that OrderService and BillingService consumers are idempotent (processing the same event twice has the same effect as once); (3) show the failure path: retry topic and DLQ, and who owns replay (re-reading old events to rebuild or repair downstream data). Interviewers ask about the main pipeline redraw far more often than this variant.
Variant 2: critiquing vague prose. Take the sentence "The system ingests events and processes them reliably at scale." Edits: replace "reliably" and "at scale" with mechanisms and numbers you can defend (durable append before ack; target events per second); name components; and add missing artefacts (diagram legend, sequence of the failure path, ownership, data-retention statement). Rewritten: "Ingest instances validate each event and acknowledge it only after it is appended to a durable queue; a batch job loads the warehouse hourly, so data is at most about 65 minutes old (TBD, owner: data platform)."
Trade-offs and pitfalls
- Do not turn the redraw into a full inventory; a review diagram shows the decisions to debate.
- Never invent volumes in the diagram; mark unknowns as "TBD, owner named".
You need to communicate a capacity plan for an inference service to leadership. Which diagrams and tables convey current utilisation, growth, headroom and autoscaling policy in one page?
Sample Answer
Direct answer
Build one landscape page with four panels and a one-line decision at the top. Each panel answers one question a leader will ask: how busy are we now, how fast is demand growing, how much room is left before users notice, and what happens automatically when load rises. An inference service is the API that serves predictions from a trained machine learning (ML) model. Headroom is the spare capacity left before the service misses its latency target. Autoscaling means the platform adds or removes replicas (identical copies of the model server, each usually holding one GPU) on its own.
The four panels
| Panel | What to draw | Question it answers |
|---|---|---|
| 1. Utilisation | Line chart, last 30 days: daily peak requests per second (RPS) and GPU utilisation, with two horizontal lines for the safe ceiling (the load we plan to stay under, defined in the worked example) and the hard ceiling (the most the system can serve at all) | Are we near the limit right now? |
| 2. Growth | Weekly peak RPS with a fitted projection: low, base and high curves for 12 months, launches annotated | When does demand cross the ceiling? |
| 3. Headroom table | Capacity, current peak, spare room, months until exhaustion, with how each figure is derived | How much room is left, in numbers a reader can check? |
| 4. Autoscaling policy table | Scaling signal, target, min and max replicas, scale-out and scale-in rules, hard limits | What protects us between reviews, and where does it stop? |
Worked example (illustrative service)
Load tests show one replica holds 50 RPS while keeping 95th-percentile (P95) latency under the 300 ms objective (95 of every 100 requests finish within 300 ms; this kind of target is often called a service-level objective). Quota is the maximum number of replicas the cloud account is allowed to run; here it is 30.
| Measure | Value | Derivation |
|---|---|---|
| Hard ceiling | 1,500 RPS | 50 x 30 |
| Safe ceiling (70%) | 1,050 RPS | 0.7 x 1,500, leaving a buffer for spikes and slow model start-up |
| Current weekly peak | 620 RPS | measured |
| Spare room to safe ceiling | 430 RPS (41%) | 1,050 - 620; 430 / 1,050 |
| Growth assumption | 8% per month, compounding | from the last quarter's trend |
| Months to safe ceiling | about 6.8 | ln(1,050 / 620) / ln(1.08) |
| Months to hard ceiling | about 11.5 | ln(1,500 / 620) / ln(1.08) |
Where the months come from. Growing 8% a month means multiplying by 1.08 each month, so after n months the peak is 620 x 1.08^n. We want the n where that reaches 1,050. Taking logarithms (ln, the function that answers "what power gives this number?") turns the power into a multiplication: n = ln(1,050 / 620) / ln(1.08) = 0.527 / 0.077 = about 6.8. Check by hand: 620 x 1.08^6 = 984 and 620 x 1.08^7 = 1,063, so the line crosses 1,050 during month 7. For another service, swap in its own current peak, ceiling and growth rate.
Sizing the ask. The decision line needs a number. At 8% a month the peak reaches 620 x 1.08^12 = about 1,561 RPS at month 12, which is already above today's 1,500 RPS hard ceiling. To stay under 70% at that point the fleet needs 1,561 / 0.7 = about 2,230 RPS of safe-plus-buffer capacity, that is 2,230 / 50 = about 45 replicas, so the request is for roughly 15 more replicas than the current quota of 30 (about 45 in total). Print that figure beside the decision line, and price it in one line.
Projected peak: 781 RPS at month 3, 984 at month 6, 1,063 at month 7. If more GPU capacity takes about 3 months to obtain (an assumption to confirm), the request for it must land by roughly month 4. That gives the top-of-page decision line: "Approve additional GPU quota by month 4 to stay under 70% of capacity through month 12."
Autoscaling policy panel (settings, not measurements)
- Signal: RPS per replica. Target 35 (70% of 50). Scale out (add replicas) when the average stays above 35 for 3 minutes.
- Scale in (remove replicas) only after the average stays below 25 for 15 minutes, so the fleet does not flap (repeatedly add and remove replicas as load wobbles around the threshold).
- Minimum 8 replicas so one failure or a slow model load does not hit users. Maximum 30 (the quota).
- State the limit plainly: autoscaling cannot exceed the quota, so beyond 1,500 RPS the service degrades.
Trade-offs and pitfalls
- Show peaks, not averages. An average hides the hour that breaks the objective.
- GPU utilisation alone is misleading. 90% can be healthy or on fire; tie every utilisation line to the latency objective.
- Compounding growth looks flat early and steep late. A straight-line projection understates the date.
- Show a range for growth, not one line, and print the assumption next to it.
- Put the cost of the ask in one line. Do not add more charts to prove a point already made.
How do you keep architecture documentation and diagrams accurate as the system changes? Describe ownership, where the docs live, and what happens in the pull-request flow.
Sample Answer
Direct answer
I make docs part of the change itself: they live in the same repository as the code (docs-as-code, meaning documentation written as plain text files that go through the same version control and review as source), each doc has a named owner, and the pull-request flow prompts and checks for doc updates. Docs that are separate from the code drift; docs that must be touched to merge do not.
Ownership
- Each service team owns its own docs and diagrams, listed in the repo's
CODEOWNERSfile (a file that maps folders to the people who must review changes there). - A named architect or platform group owns the system-level view: the landscape diagram (one picture of all services and how they connect), cross-service flows, and standards.
- Each doc carries a "last reviewed" date and an owner in its header.
Where docs live
- Diagrams as code (Mermaid, a text syntax many Git hosts render as diagrams, or the Structurizr DSL, a text language for describing C4 models, shown in the worked example below) in
docs/architecture/, so a diagram change shows as a readable text diff, not a binary image. - Decision rationale in ADRs (Architecture Decision Records) in
docs/adr/. - A rendered site built from those folders, so readers never browse raw files.
The pull-request flow
- The PR template asks: "Does this change a service boundary, a dependency, a data flow or a deployed component? If yes, link the doc/ADR update or say why not."
CODEOWNERSautomatically requests review from the docs owner when architecture-relevant paths change (for example/infra/or/api/).- CI (continuous integration, the automated checks run on every PR) renders the diagrams, checks for broken links and lints the API spec (runs an automatic checker on the file that describes the API, flagging mistakes and style problems), failing the build on errors.
- A scheduled job opens an issue for any doc whose "last reviewed" date is older than six months.
Worked example
A PR makes Orders call the new Inventory service. The diff includes one added line in the Structurizr model:
orders -> inventory "Reserves stock before payment" "gRPC"
Read it left to right: source element (orders), arrow, target element (inventory), a description of why they talk ("Reserves stock before payment"), and the technology used ("gRPC", a fast request protocol between services). Structurizr is a tool that turns one such text model into several C4 diagrams (zoom levels: context, container, component, code).
The template checkbox is ticked, CI re-renders the container diagram, and CODEOWNERS pulls in the Inventory team, who notice the call happens before payment and raise the failure-handling question in review, before merge instead of after an incident.
Polyrepo angle (each service in its own repository)
- Each repo keeps its own
docs/and a small metadata file (name, owner, tier, links; tier means how critical the service is, for example tier 1 for customer-facing payments). A CI job publishes every repo's docs to one central docs portal or service catalog (a searchable directory of every service with its owner and docs), so discoverability does not depend on knowing which repo to open. - System-level diagrams live in a dedicated architecture repo. A change to a cross-repo contract (an API or event schema) requires a linked PR or issue in that repo, opened automatically by the provider's CI.
- Versioning: docs travel with the code and are tagged with each release, so "how did version 2.3 work?" has an answer.
Trade-offs and pitfalls
- Over-automation: generating diagrams from code is great for dependencies but produces noise; the "why" still needs humans.
- Checklists nobody reads become theatre. Sample PRs monthly and check that ticked boxes are true.
- Enforcement must be proportionate: block on broken builds, nudge on judgement calls.
Draw the runtime behaviour of a flow where a client calls an API, which calls one service synchronously and enqueues work for another. Where do timeouts, retries, backoff and idempotency show up, and how do you make partial failure visible?
Sample Answer
Direct answer
I draw a sequence diagram (participants across the top, time flowing down) with the synchronous call and the asynchronous enqueue shown as different arrow styles. Timeouts and retries are annotated on the calls they govern; idempotency shows at the API entry (a stored key) and at the worker (a dedupe check); and partial failure is made visible by returning 202 Accepted with a status resource, plus a dead-letter queue and an alert on the age of the oldest message. Idempotent means safe to repeat: doing it twice has the same effect as doing it once. The outbox pattern means the API writes the "fulfil" message into its own database in the same transaction as the order, and a separate process publishes it to the queue, so a crash cannot save the order but lose the message. 202 Accepted is the HTTP status meaning "received, not finished yet", and the status URL is a page the client polls to see progress.
sequenceDiagram
participant C as Client
participant A as API
participant S as Service A
participant Q as Queue
participant W as Worker B
C->>A: POST /orders (Idempotency-Key k1), timeout 10s
A->>A: key k1 seen? return stored result
A->>S: reserve stock, timeout 2s, up to 2 retries
S-->>A: ok
A->>Q: enqueue fulfil(k1) via outbox (event saved with the order)
A-->>C: 202 Accepted + status URL
Q-)W: deliver (at-least-once)
W->>W: dedupe on k1
alt worker fails 5 times
W-->>Q: to dead-letter queue, alert
end
Worked example: where each concern shows up
- Timeouts: every outbound call gets one, and they nest: the inner calls with all their retries must finish before the outer timeout. If the API waits 2 s per attempt, and 2 retries means 3 attempts in all, with backoff waits of 0.2 s and 0.4 s between them, the worst case is 2 + 0.2 + 2 + 0.4 + 2 = 6.6 s. That must stay under the client's 10 s timeout, which it does with 3.4 s to spare.
- Retries and backoff: retry only idempotent calls; use exponential backoff (doubling waits) with jitter (random offsets so clients do not retry together); cap attempts.
- Idempotency: the key is generated by the client and stored with the response.
- Partial failure: stock is reserved but fulfilment failed. The status resource shows
stock_reserved, fulfilment_pendingorfailed, so the customer and support can see it, and a compensating step (an action that undoes an earlier one, here releasing the reserved stock) is documented. For example, after 5 failed deliveries offulfil(k1), the DLQ alert fires, support seesfulfilment_pending, and the documented step callsrelease-stock(k1)and sets the status tofailed.
Related patterns and backpressure (secondary; the sequence above is the core answer)
| Pattern | Good for | Cost |
|---|---|---|
| Synchronous call (REST or gRPC, a fast binary request protocol) | Needs an answer now | Caller inherits callee's failures and latency |
| Queue | Work that can be delayed; smooths bursts | Eventual consistency (results appear a little later), duplicates possible |
| Event stream (an ordered log that many consumers can read and re-read) | Many consumers, replay | Ordering per key only, more operations |
Backpressure (letting an overloaded component slow its senders) means bounded queues, limited consumer concurrency, and shedding load (deliberately rejecting some work) with HTTP 429 ("too many requests") and a Retry-After header (either a number of seconds to wait, such as 120, or an HTTP date after which to retry, such as Wed, 21 Oct 2015 07:28:00 GMT) instead of accepting work that will be lost.
Documenting an idempotency contract (as for a payment endpoint)
- Key design: client-generated random ID in an
Idempotency-Keyheader, scoped to the account and endpoint. - Same key, same body: return the stored response. Same key, different body: reject as a conflict. Same key while the first is still running: return conflict and let the client retry.
- Dedup window: how long keys are kept (state a number, such as 24 hours, and why); after that a repeat is treated as new.
- Retry policy for clients, written next to the key rules.
Trade-offs and pitfalls
- Retrying at every layer multiplies traffic: with 3 attempts at each of two layers it is 3 x 3 = 9 calls, and with three layers 27; pick one retrying layer.
- Enqueueing after the database commit without an outbox can lose the message on a crash.
Unlock Full Question Bank
Get access to all Architecture Documentation and Communication interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.