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.
Which testing and resilience artifacts belong in architecture documentation so teams can validate the system, and how would you document a failover test plan with hypothesis, steps and expected outcomes?
Sample Answer
Direct answer
Architecture documentation should include the artifacts that let a team prove the design behaves as claimed: a test strategy, a list of failure modes with the expected behaviour, capacity and performance targets with load-test results, recovery objectives with backup-restore evidence, and resilience experiment plans. A failover test plan is written as a hypothesis, a controlled set of steps, expected outcomes with pass and fail criteria, and an abort and rollback path.
Artifacts that belong
| Artifact | Purpose |
|---|---|
| Failure-mode table | For each dependency: what if it fails, expected system behaviour, detection |
| Recovery targets | RTO (recovery time objective: how long an outage may last) and RPO (recovery point objective: how much data loss is tolerable), with the last measured result |
| Load and capacity test plan | Expected peak, headroom, and how it was validated |
| Backup restore test | Date, result, restore time |
| Failover and chaos plans | Below |
| Staging-parity notes | How the test environment differs from production, so results are read with the right caution |
Failover test plan (worked example, illustrative)
Terms used below: the primary is the database instance currently taking writes; a replica is a continuously updated copy that can take over; promoting the replica makes it the new primary; replica lag is how far behind the primary the copy is, in seconds of writes; staging is the production-like test environment; synthetic load is fake but realistic traffic generated by a tool; steady state is the normal measurable behaviour (for example 99% of orders succeed).
Title: Primary database failover, orders service
Hypothesis: If the primary database instance is stopped, the replica is promoted
and orders resume within the 5 minute RTO, with no more than
the 1 minute RPO of writes lost.
Environment: Staging, sized as production-lite (see parity notes)
Preconditions: steady synthetic load; dashboards open; on-call informed;
abort criteria agreed.
Steps:
1. Record baseline: order success rate, latency, replica lag.
2. Stop the primary instance.
3. Observe detection time and promotion.
4. Watch application reconnect behaviour and errors.
5. Restore the old primary as a replica.
Expected: Alert fires within 1 minute; promotion completes; success
rate returns to baseline; no duplicate or lost confirmed orders.
Pass/fail: Recovery within RTO and data loss within RPO, else fail.
Abort: Success rate stays under 50% for 10 minutes: roll back per runbook.
Record: Actual times, surprises, follow-up tickets, date of next test.
Judging the result against the targets (worked numbers, illustrative)
- Primary stopped at 10:00:00. Alert fired 10:00:40. Replica promoted 10:02:30. Order success back to baseline 10:03:00. Recovery took 3 minutes, inside the 5 minute RTO: pass on time.
- Replica lag recorded at the moment of the stop was 20 seconds, so at most 20 seconds of writes could be lost, inside the 1 minute RPO: pass on data.
- Had success only recovered at 10:07:00, recovery would be 7 minutes, above the 5 minute RTO, so the test fails even if no data was lost. Both conditions must hold.
Failure-mode table, one example row
| Dependency | Failure | Expected behaviour | Detection |
|---|---|---|---|
| Orders primary database | Instance stops | Replica promoted, orders resume within 5 minutes, at most 1 minute of writes lost | Alert on failed health checks within 1 minute |
Chaos engineering plan. Chaos engineering means deliberately injecting failure in a controlled way to find weaknesses. Document each experiment as: steady-state definition (the normal measurable behaviour), hypothesis, blast radius (the limit on what could be affected), injected fault, abort conditions, and findings. Start in staging, then move to production only with a small blast radius and abort switches.
Staging parity. List what differs from production (instance sizes, data volume, network topology, third-party stubs). A failover that recovers in staging with a tiny dataset says little about recovery time with production data, so state which conclusions transfer and which do not.
Pitfalls: a plan with no expected outcome (cannot fail); tests never rerun after architecture changes; results not stored beside the design.
What security and authentication content must an architecture document for a public API contain, and how do you present it to a security reviewer versus a developer?
Sample Answer
Direct answer
The document must state, for a public API, who can call it, how callers prove who they are, what they are allowed to do, how data is protected in transit and at rest, and how abuse is limited and detected. A security reviewer wants threats, controls and evidence; a developer wants how to authenticate correctly and what errors to expect. I would write one source of truth and give each reader a different entry point into it.
Required content
- Authentication: the mechanism (for example OAuth 2.0, the standard for delegated access, with short-lived access tokens (an access token is a temporary string the caller sends with each request to prove it was authorised), or API keys for server-to-server use), where tokens are issued, lifetime, refresh and revocation.
- Authorization: the model (scopes are named permissions carried on the token, such as
orders:read; roles group permissions by job) and where it is enforced (gateway versus service), including object-level checks (a caller must own the record it requests: if user A asks for/orders/1002and that order belongs to user B, the API must refuse, even though A's token is valid; broken object-level authorization is the top risk in the OWASP API Security list, OWASP being an open security-community project). - Trust boundaries and data flow: what is exposed publicly, what sits behind the gateway, and where TLS ends (TLS is the encryption that protects traffic on the network; "where it ends" is the point where traffic is decrypted and must be trusted from then on).
- Data protection: encryption in transit and at rest, classification of fields, what is never logged.
- Abuse controls: rate limits, quotas, input validation, size limits, and how bad clients are blocked.
- Threat model: a threat model is a structured list of what could go wrong and who might attack, each threat paired with the control that answers it. Record the residual risk (what remains after the controls) and the named person who accepts it.
- Secrets and key management, audit logging, incident contacts.
Presenting to each reader
| Security reviewer | Developer | |
|---|---|---|
| Opens with | Threat table and trust-boundary diagram | "How to get a token" with a copyable request |
| Format | Threat, control, evidence (config link, test, scan result), residual risk | Step-by-step, examples, error codes, scope table |
| Cares about | Gaps, assumptions, compliance mapping (which control satisfies which regulation or standard requirement) | Time to a working, correct call |
Worked example (illustrative fragment)
Security reviewer fragment, threat table rows:
| Threat | Control | Evidence | Residual risk |
|---|---|---|---|
| Stolen access token replayed | 15-minute lifetime; sender-bound refresh tokens (a refresh token that only the client it was issued to can use, so a copy is useless); revocation list at the gateway (token ids refused even before they expire) | Gateway policy file, revocation test | Up to 15 minutes of misuse, accepted by the security owner |
| User A reads user B's order by changing the id in the URL | Service checks the order's owner equals the caller on every read | Automated test that requests another user's order and expects a refusal | None known; retested each release |
Developer fragment, the "how to get a token" page (client-credentials grant means a server application exchanges its own id and secret for a token, with no human user involved; a bearer token is one that works for whoever holds it, so it must be sent only over TLS):
POST /oauth/token
grant_type=client_credentials&client_id=<your-id>&client_secret=<your-secret>&scope=orders:read
-> {"access_token": "<token>", "expires_in": 900}
GET /orders/1002
Authorization: Bearer <token>
Errors: 401 means the API does not know who you are (no token, malformed or expired), so fetch a new token. 403 means it knows who you are but you may not do this (the token lacks the scope, or the order is not yours), so requesting a new token will not help. That difference is authentication (proving who you are) versus authorization (what you are allowed to do).
Pitfalls: describing the design without evidence a reviewer can check; documenting the mechanism but not the failure responses; putting secrets or real tokens in examples; letting the doc and the gateway configuration diverge. Generate the developer reference from the API's OpenAPI description (a machine-readable file listing every endpoint, parameter and response) where you can, so it cannot drift.
For a message-driven order-processing service, what failure modes and degraded behaviours would you record in its architecture documentation, and how would you write each mitigation so an on-call engineer who did not build it can act on it?
Sample Answer
Direct answer
I would give the service a "Failure modes and degraded behaviour" page that is one table plus one runbook-style entry per row. Each entry says what the on-call engineer will see (the symptom, as a named alert or graph), what customers experience meanwhile (the degraded behaviour), the safest first action, what NOT to do, and when and to whom to escalate. The test of a good entry: someone paged at 3 a.m. who has never opened the code can act on it in the first five minutes. (On-call means the engineer currently carrying the pager for the service; a runbook is the step-by-step operating guide they follow. The queue holds orders waiting for a worker; queue depth is how many are waiting and the age of the oldest message is how long the longest-waiting one has sat. A message broker is the server that stores and hands out those messages.)
The table has eight rows. Rows 1 to 6 (dependency timeout, resource exhaustion, network partition, poison message, duplicate delivery, consumer backlog) apply to almost every message-driven service, so document those first. Rows 7 and 8 (multi-region failover and ML fraud scoring) are advanced extras that only some services need.
The failure modes I would record (order flow assumed: API accepts order, publishes to a message broker, workers consume, write to a database, call a payment provider)
| Failure mode | Symptom on-call sees | Degraded behaviour by design | Safe first action | Escalate |
|---|---|---|---|---|
| Dependency timeout (payment provider slow or down) | Provider-call error rate and latency alarms; queue depth rising | Orders accepted as "payment pending", not rejected | Confirm on provider status page; leave the circuit breaker (a switch that stops calling a failing dependency) open; do not restart workers | Provider account owner if still failing after 30 min |
| Resource exhaustion (worker memory, database connection pool) | Worker restarts, "pool exhausted" errors, rising lag | Slower fulfilment; API still accepts | Scale workers only if the database has connection headroom (spare connections before its limit); otherwise reduce consumer concurrency (how many messages each worker handles in parallel) | Database owner if pool stays saturated |
| Network partition (workers cannot reach broker or database) | Consumers drop to zero, broker healthy for other clients | Orders queue durably; nothing is lost, only delayed | Check network path and security rules changed recently; do not purge queues | Platform/network team |
| Poison message (a message that fails every time) | Same message ID retried; dead-letter queue (DLQ, the parking queue for messages that keep failing) count above zero | Order parked, others proceed | Inspect DLQ message, fix data, replay one message | Service owner for a code fix |
| Duplicate delivery (the broker is at-least-once: it guarantees a message arrives, but may deliver it twice) | Customer double-charge reports | Handlers are idempotent (repeat-safe) via an order-ID key | Check how often the dedupe table (the record of order IDs already processed) rejects a repeat; some hits are normal, but zero hits alongside double-charge reports means the check is not running, so escalate | Owner if any duplicate charge occurred |
| Consumer backlog | Age of oldest message above the target | Delayed confirmations | Check whether a downstream is slow before adding consumers | Owner if age exceeds the SLO (service-level objective, the reliability target) |
| Multi-region stateful failover (advanced) | Replication lag alarm; regional health check red | Secondary region serves; writes since the last replicated point may be lost (the RPO, recovery point objective) | Follow failover checklist; do not fail back without owner approval | Incident commander (the person coordinating a major incident response) |
| ML fraud-scoring dependency returns garbage after a schema change (schema drift: input fields renamed or retyped) | Score distribution shifts; validation-error counter climbs | Fall back to simple rules; flag orders for review | Switch the fraud flag to rules-only mode | Model owner |
Retry amplification (the failure that turns one problem into an outage)
flowchart LR
C[Client, 3 attempts] --> A[API, 3 attempts]
A --> W[Worker, 3 attempts]
W --> P[Payment provider]
W -.->|guard| G[Retry budget + jitter + breaker]
If each layer makes up to 3 attempts in total (the diagram's meaning: 1 original try plus 2 retries), one order can produce 3 x 3 x 3 = 27 calls (if each layer instead retried 3 times after the first try, that is 4 attempts per layer and 4 x 4 x 4 = 64 calls) against a provider that is already struggling. The documented guard: retry at ONE layer only, use exponential backoff with jitter (randomised waits so clients do not retry in lockstep), cap retries with a budget, and open the circuit breaker on sustained failure.
Worked example of one entry, written for a stranger
PAYMENT PROVIDER TIMEOUTS (illustrative thresholds)
Alert: provider_call_p95 (the 95th percentile: 95% of calls finish faster than this) above 5s for 10 min, or DLQ depth above 0
Customer impact: orders show "payment pending"; no orders are lost
Do first: 1) open provider status page 2) confirm breaker state on dashboard
Do NOT: restart workers (loses in-flight state: messages a worker has taken but not yet finished, which then get retried or duplicated), purge queue, disable retries
Recovered when: queue age under 5 min for 15 min
Escalate: 30 min unresolved -> payments owner; any suspected double charge -> immediately
Short entries for the two advanced rows
REGION FAILOVER (illustrative)
Alert: regional health check red for 5 min
Do first: confirm with the cloud status page, then run the failover checklist
Do NOT: fail back without owner approval
Escalate: incident commander immediately
FRAUD SCORING GARBAGE (illustrative)
Alert: validation-error counter above 1% of scored orders
Do first: switch fraud flag to rules-only mode
Do NOT: delete queued orders
Escalate: model owner
Trade-offs and pitfalls
- Write symptoms as alert names and dashboard panels, never as "the system is unhealthy".
- Every mitigation must be safe to run by someone who has not seen the code; put irreversible steps behind an explicit "ask the owner" line.
- Mark thresholds as tuned from the SLO and review them after each incident, otherwise they rot.
- Documenting only outages and skipping degraded modes hides the most useful design decision: what the system deliberately keeps doing when a dependency fails.
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.
A decision was made when traffic was a tenth of today's, and a new regulation has since appeared. How do you find out that the assumptions behind an old ADR have gone stale, who owns the review, and what happens next?
Sample Answer
Direct answer
Do not rely on anyone remembering. Build freshness into the decision record when it is written: an ADR (architecture decision record: a short document capturing one significant decision, why it was made, and its consequences) lists the assumptions it rests on, each with a measurable tripwire (a pre-agreed condition that, once crossed, triggers a review) and a review-by date. Staleness then surfaces through four channels: metrics crossing a threshold, code or runtime drifting from the decision, external signals such as a new regulation, and the calendar. The team that owns the affected system runs the review, and it ends in one of four recorded outcomes.
1. Write the assumptions down as checkable claims (at decision time)
---
id: ADR-0014
title: Single-region PostgreSQL primary for order storage
status: accepted
date: 2023-02-14
owner: orders-team
review-by: 2024-02-14
tags: [data-residency, capacity]
---
## Assumptions and tripwires
| Assumption | Tripwire |
|----------------------------------------------|-------------------------------------------|
| Peak load stays under 1,000 requests/second | Sustained peak above 800 (80% of ceiling) |
| Customer data may live in one country | Any new rule on where personal data lives |
| A regional outage of a few hours is tolerable| Contract or SLA (service-level agreement) tightens |
Worked numbers: peak load was 500 requests per second when the ADR was accepted, so the ceiling of 1,000 allowed 2x growth. The tripwire at 800 (0.8 x 1,000) fires at 1.6x growth. A system now at 10x (5,000 per second) crossed it long ago. Without the tripwire, nobody looked until something hurt.
2. Freshness signals (mostly a script and a tag, not a product)
- Metric tripwires: an alert on the traffic dashboard opens a review ticket (not a page) titled "Review ADR-0014", with one open ticket per ADR so repeat firings do not spam.
- Code and runtime drift: each ADR lists the paths or services it covers. A check on pull requests (PRs) that touch those paths comments "this area is governed by ADR-0014, do its assumptions still hold?". A second-region resource appearing in infrastructure code while the ADR says single-region is a deviation worth a ticket.
- Regulatory and external signals: ADRs carry tags such as data-residency or retention. When legal or compliance flags a new rule, they search by tag and get the list of decisions to re-check. This is the fix for the new-regulation half of the scenario.
- Calendar: a scheduled job lists ADRs past their review-by date (12 months for critical systems, 24 otherwise) and opens tickets.
Regulation search in practice: with ADRs stored as files in a repository, the search is one command, run here on three sample files (only two carry the tag):
$ mkdir -p adr
$ printf -- '---\nid: ADR-0014\ntags: [data-residency, capacity]\n---\n' > adr/0014-single-region-postgres.md
$ printf -- '---\nid: ADR-0031\ntags: [retention, data-residency]\n---\n' > adr/0031-eu-customer-backups.md
$ printf -- '---\nid: ADR-0022\ntags: [capacity]\n---\n' > adr/0022-queue.md
$ grep -l "tags:.*data-residency" adr/*.md | sort
adr/0014-single-region-postgres.md
adr/0031-eu-customer-backups.md
The legal contact gets a short list of files, and each becomes a review ticket for its owning team.
3. Who owns the review
The owner field names a team, not a person, because people move. That team's tech lead runs the review; an engineering manager makes sure it lands in the backlog with a due date (two sprints is reasonable). Architects are consulted only for critical or cross-team decisions. If the owning team no longer exists, ownership follows the system in the service catalogue (a registry listing every service and the team that owns it); if no team owns the system, the architecture lead assigns one or marks the ADR deprecated.
4. What happens next: four outcomes, each recorded
| Outcome | When | What you write |
|---|---|---|
| Still valid | Assumptions re-checked and hold | A dated "Reviewed" line with evidence; move review-by forward |
| Amend | Choice stands, details change (new ceiling, new tripwire) | A dated amendment section |
| Supersede | The chosen option no longer fits | New ADR; old one set to superseded with links both ways |
| Deprecate | The system or decision no longer applies | Status change and a reason |
In the scenario: the ticket opens in week 0. In week 1 the owner pulls the load graph (5,000 per second against a 1,000 ceiling) and gets a written note from legal on the new rule. A 30-minute outcome meeting in week 2 supersedes the ADR: a new ADR is proposed, then accepted, and the migration becomes a normal tracked project. If the regulation carries a legal deadline, it skips the routine cycle: compliance sets the date, and any interim mitigation is recorded as its own proposed ADR.
Trade-offs and pitfalls
- Too many tripwires cause alert fatigue (people start ignoring alerts because there are too many): keep two to four load-bearing assumptions per ADR.
- Reviews become rubber stamps (approvals with no real check) unless "still valid" requires a link to evidence.
- A stale ADR was not a wrong decision. Leave the old body unedited and say it was right for its time; rewriting history destroys the reason future readers need.
- Very small organisations with a handful of ADRs can skip the automation and use the calendar alone.
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.