A message queue, microservices, or a single database do not make an architecture good by themselves. The same technique can reduce latency in one process and add unacceptable complexity in another. The useful question sounds different: what problem does the change solve, under what conditions does it work, and what does the team pay for the expected result?
General practical recommendations should be used as a source of options and questions, not as proof of suitability. For example, Architecture Tradeoff Analysis Method, ATAM is intended for analyzing competing quality attributes, risks, and trade-offs, not for finding a single architecture suitable for all systems. The process proposed below relies on such reasoning but does not claim to reproduce full ATAM.
1. Fix the context of the decision
Before comparing technologies, describe the boundary of the task and what must change. For a significant decision, it is useful to answer several questions:
- Goal and stakeholders. What user or operational result is needed? Who has the authority to agree on latency, data loss, and costs?
- System boundary. Which components and external dependencies does the decision affect? For which of them is the team responsible, and on which can it only rely?
- Load and environment. What is the current and expected profile of requests, peaks, and failures? Which data is confirmed, and which are currently assumptions?
- Constraints. What are the budget, timelines, security and recovery requirements, team competencies, and commitments to users?
- Cost of inaction. What will happen if nothing changes? This option should also participate in the comparison if it is realistic.
Separately note uncertainties. For example, if the load forecast is not confirmed, the decision may be justified only for a certain load range. This limitation should be transferred to verification criteria and review conditions.
2. Translate wishes into quality scenarios
The phrase "the system must be reliable" does not allow determining whether the reliability is sufficient. A Quality scenario specifies the requirement through six elements:
- Stimulus source: user, dependency, operator, or another source.
- Stimulus: request, load growth, failure, or change.
- Environment: normal operation, peak, recovery after a failure.
- Affected part: component or system boundary.
- Response: what the system must do.
- Response measure: how to verify the result and where the acceptable limit passes.
For example, instead of "order acceptance must be fast," you can set: at a certain load profile, measure the time from sending the request to the order acceptance response; for the 95th percentile, agree on the limit value. For a dependency failure, a separate scenario is needed: which dependency is unavailable, for how long, what happens to new orders, and how recovery is verified.
Scenarios are selected and prioritized together with stakeholders. Their form makes the requirement verifiable, but does not itself prove its fulfillment: analysis, testing, or operational measurements will be required. SEI materials on quality requirements link such requirements to verifiable properties and stakeholder priorities.
3. Compare alternatives by the same criteria
For each option, first check hard constraints, then priority scenarios. In the comparison table, show not only expected advantages but also new responsibilities: data storage, recovery, observability, maintenance, and change cost.
Do not reduce the comparison to a single score without explaining weights. The sum may hide unacceptable data loss behind a good performance rating. If weights still help the discussion, separately fix hard constraints and show how the conclusion will change with other weights or assumptions.
When analyzing trade-offs, it is useful to distinguish:
- Sensitive point: a parameter whose change significantly affects the result, for example, the processing speed of an accumulated queue.
- Trade-off point: a decision affecting several properties, for example, redelivery increases the chance of processing after a failure but requires protection against a repeated effect.
- Risk: significant uncertainty or possible requirement violation. It must be linked to verification, an owner, and a response method.
Improving one quality may worsen another. Priorities define the needs of the system and stakeholders, not a universal quality rating.
4. Record the decision and confidence level
An architecture decision record, or ADR, preserves context, choice, and consequences. It should include alternatives, reasons for rejecting them, negative consequences, status, assumptions, confidence level, and review conditions. Such a composition corresponds to the purpose of ADR in Microsoft's guide and helps the future team understand why the decision was reasonable at the time of adoption.
ADR does not replace analysis and does not guarantee target metrics. It is useful to explicitly separate:
- Goal: agreed threshold or desired behavior.
- Analytical estimate: conclusion from the model and its assumptions.
- Test result: measurement in a specific environment and under a specific scenario.
- Operational observation: actual metric of the working system over a specified period.
Below shows how to combine these elements in one decision.
Filled ADR example: order acceptance and notification
All numbers, conditions, and roles in the example are educational assumptions. These are not measurement results and not source recommendations. Thresholds need to be replaced after agreeing on real requirements. The decision is preliminary: tests and operational observations have not yet been conducted.
Context and requirements
The service accepts an order and initiates notification sending. The notification is a side effect: per the task conditions, it is acceptable to send it later, but it is not allowed to lose the obligation to send it for a confirmed order due to temporary unavailability of the notification handler.
Suppose the team can atomically save the order and the record about the notification obligation in one transaction of the main database. The external notification service supports an idempotency key for the same notification throughout the entire assumed retry and recovery period. This is an important assumption that needs to be confirmed by agreement with the service owner and testing.
Educational constraints and criteria:
| Scenario | Condition and target response |
|---|---|
| Order acceptance | At a steady load of 100 requests per second and a given test profile, p95 time from sending the request to the order acceptance response does not exceed 300 ms. |
| Handler unavailability | When the handler is stopped for 30 minutes, order acceptance continues to meet the specified latency criterion; each confirmed order and the obligation to send its notification are preserved. |
| Redelivery | Repeated processing of one notification does not create a repeated external side effect when the external service idempotency assumption is met. |
| Recovery | After starting the handler, accumulated obligations are processed; the team measures the age of pending notifications, processing speed, and time to drain the accumulated flow. |
The test profile should also describe the request composition, data size, stand configuration, measurement duration, and p95 calculation method. Errors and timeouts are recorded separately: they cannot be excluded from the result discussion. The example does not claim that these conditions are already met.
The availability of the main database remains a dependency of order acceptance. If the database is unavailable or the transaction did not complete successfully, the system must not confirm the order as accepted. The scenario does not promise order acceptance under any failure and does not set RTO or RPO for database recovery.
Alternatives
| Option | Acceptance during handler or notification service unavailability | Delivery and repeated effect | Operational consequences and conclusion |
|---|---|---|---|
| Synchronous notification call before order confirmation | The dependency may delay or block the response; the latency criterion needs verification. | Handling of an uncertain call result and protection against a repeated effect are needed. | Simpler request sequence, but notification failure is on the critical path of acceptance. Preliminary rejected at the given priority. |
| Asynchronous processing via a durable queue and transactional obligation record | The handler is separated from acceptance; the target p95 needs to be confirmed by testing. | Redelivery, obligation control, and idempotency of the external effect are needed. | A queue, handler, monitoring, and recovery procedures appear. Preliminary selected when assumptions are met. |
| Change nothing | It is assumed that current acceptance depends on a synchronous call and may block on notification failure; this needs confirmation on the existing system. | Existing repeat behavior needs verification. | No change costs, but the original risk remains. Preliminary rejected if the risk is confirmed. |
Decision and mechanism
Status: proposed, awaiting checks. Owner: technical lead of the order service; thresholds and acceptability of delayed notification are agreed by the product owner. Confidence: preliminary, since test results and confirmation of external idempotency are absent.
The order and the record about the obligation to send a notification are saved in one transaction of the main database. The success acceptance response is issued only after its successful completion. A separate process publishes obligations to a durable queue, and the handler sends notifications to the external service with a persistent key tied to a specific notification.
The transactional record eliminates the window between saving the order and a separate attempt to put a message in the queue: the obligation remains in the database if publication temporarily fails. The transfer to the queue and subsequent processing may repeat, including after a failure between the external call and its result commit. Therefore, the idempotency key must persist between attempts, and the team must account for its validity period at the external service. A local "sent" record is insufficient to exclude a repeated external effect if the service response is lost.
If external idempotency is not confirmed or the key storage period is shorter than the possible recovery period, the no-repeated-effect criterion is not justified. Then it is necessary to agree on a requirement change or choose another mechanism and re-evaluate the decision.
Consequences and risks: acceptance no longer has to wait for the notification handler, but the database and obligation record remain on its path. Costs appear for storage and queue operation, repeated attempts, monitoring, and handling of unprocessable messages. Storage filling, publisher failure, prolonged external service unavailability, and idempotency key expiration require separate procedures and checks. Without them, asynchronicity only shifts the risk, not eliminates it.
Analytical recovery estimate
For a preliminary estimate, suppose all 100 requests per second create one notification each, and the handler processes nothing for 30 minutes. Then the following accumulates:
100 × 30 × 60 = 180 000 notifications.
If after recovery the handler steadily completes 200 notifications per second, and intake remains at 100 per second, the net reduction rate of accumulation will be 100 notifications per second. The estimated time to drain the accumulated flow is 180 000 / 100 = 1 800 seconds, or 30 minutes.
This is not a test result and not a recovery guarantee. The estimate assumes sufficient storage capacity, uniform load, and stable processing speed without additional external service limits. If processing speed does not exceed intake speed, accumulation will not disappear under this model. The calculation shows which assumptions are especially important to check.
Test plan for the example
Before testing, the team fixes the stand configuration, test data, measurement methods, allowable impact on dependencies, and stop criteria. Then it performs checks:
- Load test. Reproduce the agreed profile at a level of 100 requests per second. Measure p95 of the full response time, errors, and timeouts; compare the result with the 300 ms goal. Separately verify that the environment matches the expected operation.
- Handler stop. Disable it for 30 minutes under the same load. Reconcile confirmed orders with transactional obligation records, check accumulation and p95. Also stop the queue publication process: obligations must remain available for subsequent publication.
- Retry and uncertain response. Redeliver one notification, including simulating a response loss after acceptance by the external service. Reconcile external effects by the idempotency key and verify that the key does not change between attempts. The test is valid only for verified behavior and key validity period.
- Recovery. Start the handler after accumulation. Measure intake and completion speed, age of pending notifications, and time to drain the accumulated flow. Reconcile the result with the calculation, explaining discrepancies; check processing of messages that cannot be delivered.
- Database failure and decision boundaries. Verify that on an unsuccessful transaction the order is not confirmed, and on a successful one both the order and the obligation are saved. Test storage filling in a controlled environment and determine the operator's reaction; acceptance under such a failure is not guaranteed in the example.
Results are entered into the ADR with date, configuration, observations, deviations, and decision: accept, refine, or reject the option. While results are absent, the table contains goals, not proven guarantees. Even a successful test confirms behavior only in verified conditions and within the scenario limits, not the absence of all possible failures.
From tests to operational control
After deployment, goals need to be linked to observable metrics. For example, a user SLI may be the share of order acceptance requests meeting the agreed definition of a successful response; an SLO sets a goal for this metric over a selected period. It is important to define the numerator, denominator, measurement window, and error handling. The approach to SLI and SLO in Google SRE is a practical reference, not a universal set of thresholds.
For the asynchronous path, observations are also needed for the age of pending notifications, publication and processing errors, repeated attempts, storage capacity, and discrepancies between orders and obligations. The trigger threshold and operator actions are determined by the team based on real consequences of delay.
If recovery and acceptable data loss matter to the business, RTO — target recovery time — and RPO — acceptable data loss volume expressed as time — should be agreed separately. They cannot be derived from a p95 goal or from the presence of a queue. AWS recommendations on failure management include failure and recovery checks; the applicability of specific procedures and thresholds depends on the system.
Part of the checks can be automated as architectural fitness functions: for example, verify the atomicity of saving the order and obligation or signal when the agreed age of a pending notification is exceeded. Description of evolutionary architecture considers such functions as an objective check of chosen characteristics. They do not automatically measure all system qualities and require review together with risks.
When to review the decision
The ADR owner organizes periodic review with the team and product owner; frequency is agreed based on change speed and error consequences. An unscheduled review is needed if:
- agreed intake, delivery, or recovery metrics are violated;
- load, failure profile, or notification latency requirements change;
- external idempotency no longer covers the retry and recovery period;
- the cost of queue operation and related procedures exceeds the agreed benefit;
- requirements for data loss, recovery, or maintainability change.
The evaluation result is not a statement that asynchronicity is a best practice. It is a verifiable explanation: under which assumptions the chosen option better meets priorities, what risks it creates, what confirms its behavior, and what fact change will make the team return to the choice.