BM
Bashar ModallalSOFTWARE · AI · SYSTEMS
Backend Engineering

Expert · Lesson 12 of 12

Software Architecture

Capstone — Decide Whether Checkout Can Launch

A checkout passes its peak-load test, but rollback strands a confirmed order. Use the failure budget and the clerk’s pickup queue to make the launch decision.

A shop manager checks a receipt against a blue notebook while an engineer reviews the order on a tablet.

At 17:40 the manager of a Sharjah stationery shop asks whether she can enable the new checkout before a promotion. The engineer has a persuasive number: 19,988 out of 20,000 test purchases succeeded. The clerk has a different piece of evidence: after yesterday's rollback rehearsal, a confirmed order sat in the database while its pickup slip never reached the counter. Which piece of evidence determines whether the first real customer should see this release?

You are the release owner. Your options are to hold the release, expose a bounded group to it, or open it to everyone. The numbers below form an illustrative case, not a report about a production store. Keep a decision record as you read. For each observation, write the promise it tests, what would disprove your interpretation, and who can stop the rollout. That record should let the next engineer reach the same decision after the shift changes.

Write the acceptance rules before reading the results

The shop accepts an order when it commits the agreed amount, stock allocation and pickup branch, and returns an order number the customer can retrieve. If a phone times out after commit, the customer may repeat the request with the same key and recover the original order. An emailed receipt is asynchronous. A short mail delay can be tolerable even though a lost pickup instruction is a release blocker. Agree with the manager on that distinction before labeling any request a success.

For this case, the service objective requires at least 99.9 percent of eligible checkout attempts to return the correct confirmation within two seconds. Count an unexpected server error or timeout as a bad attempt. Count each eligible network attempt once, including a retry, and reconcile duplicate business effects separately using the purchase key. A correctly rejected out-of-stock basket is outside this denominator and has its own counter. Define the exclusions in advance so a new error cannot improve the metric just by being renamed.

The release review adds three gates. At forecast peak demand, checkout p99 must stay under 500 milliseconds. Reconciliation must find zero duplicate orders, oversold units or confirmed orders assigned to the wrong branch. Finally, within ten minutes of calling rollback, the team must restore service and process pending work created by the candidate. The ten-minute clock starts at the decision to revert and stops at a successful customer journey and a reconciled queue. A healthy process alone cannot stop it.

Put the remaining budget in customer units

Take a fixed review snapshot covering one million eligible attempts in the measurement window. The 99.9 percent objective permits 1,000 bad attempts in that population. Operations has already counted 760, leaving 240 at the time of review. The shop sets aside at most 24 bad attempts for the initial release stage, ten percent of the remaining allowance. These are local policy choices. Google's example error-budget policy illustrates how a service can tie release decisions to the reliability it has promised. Google SRE Workbook on error-budget policy

Treat 240 as a snapshot. In a rolling window, both the denominator and the events leaving the window change. Recompute the balance before exposing customers. The synthetic test neither spends the production budget nor adds successful test traffic to it. The 24-attempt limit is a ceiling on live exposure, not permission to create 24 incorrect orders. Even one confirmed sale of the last notebook to two different buyers violates a separate correctness gate and requires an immediate stop.

Reproduce the pressure of the promotion

The forecast calls for 40 eligible starts per second on average, with short bursts to 80. Build a 500-second arrival schedule totaling 20,000 starts. Replay the same sequence on the current release and the candidate with equivalent data and warmed services. Use the same pickup and delivery mix, basket sizes and simulated quote delays. Track scheduled, started and completed attempts. If the generator starts fewer requests when responses slow down, the apparent improvement can come from easing the demand. Grafana k6 on open and closed load models

Observation under the same arrival schedule Current release Candidate
Scheduled starts that reached the gateway 20,000 20,000
Eligible attempts with a bad outcome 10 12
Gateway p99 across all attempts 390 ms 420 ms
Duplicate orders or stock discrepancies 0 0

The candidate produces 12 bad attempts, or 0.06 percent, against an allowance of 0.1 percent. It meets the illustrative test gates. The two extra failures deserve examination, but a difference of two events in one replay does not establish a stable production regression. In this run each failure was an explicitly logged timeout; retained attempt records include its elapsed time. Check the slow delivery subset and inspect several traces around the bursts. An attractive aggregate could conceal a single branch where tills regularly fail.

Now take order SH-481 for two notebooks at AED 13.50 each. Force the response to disappear after commit. Resubmit the same request key, fetch the order as its owner, and compare the returned ID, the saved amount of 2,700 fils and the allocation of two units. A different customer must be unable to retrieve it. Change the pickup branch and read it again through the old terminal and the new tablet. These focused probes supplement the timing run. They establish what “correct confirmation” means beyond a status code.

Rehearse the part a deployment dashboard cannot see

Start the candidate against a copy of the expanded schema. Accept SH-481 and pause the pickup worker before it consumes the event. The new order service writes the numeric branch ID 23 into the queued message. Switch traffic back to the exact bridge build intended for rollback, leaving the database and queue intact. At minute four its checkout health probe passes. At minute six a new purchase succeeds. At minute eight the clerk checks for SH-481 and finds an empty pickup tray.

Inspection reveals that the restored worker expects the string KHAN. It treats a message carrying only the number 23 as invalid and parks it for manual review. The order row and stock balance are correct. The outstanding customer promise is still broken at minute ten. Rolling back an application image cannot rewind a message already written in a format its consumer cannot read. The Builders' Library describes deployment sequencing that lets readers understand a new format before writers begin producing it. AWS on rollback safety

Decision for this candidate: hold. The load result and remaining budget support further evaluation, but the rollback gate failed on an order the service had accepted. Sending even a small cohort through the candidate would create work the designated recovery path might strand. The manager can keep the promotion on the current release. The release owner records the incompatible message and the failed deadline, and the worker owner takes responsibility for a repeatable recovery test.

Patch the bridge worker to read both message shapes and resolve the branch in the order's merchant context. Deploy the compatible reader before enabling writers that emit the new format. Keep the business operation keyed by the original order and pickup event so replay cannot print two actionable slips. In the rehearsal, include a pending legacy message, a new-format message, and a redelivery of the new one. Retrieve parked work explicitly. A decoder fix by itself cannot pull an existing item out of a manual-review queue.

Set limits for the next decision

Suppose the revised rehearsal finishes at minute seven. Both tills read the same order, old and new messages drain, the replay produces a single pickup instruction, and the counter receives SH-481 for Khan. Repeat the load comparison on the exact artifacts proposed for rollout. If those gates still pass and the production budget is available, authorize an initial canary capped at 2,000 eligible attempts, with the current build serving a comparable control group. This approval covers that stage only.

Give the on-call engineer a live counter and the ability to stop routing new purchases to the canary. Checkpoint every 200 attempts, monitor continuously, and pause for investigation at four bad attempts in the stage or any integrity failure. Keep enough margin below the 24-attempt ceiling for in-flight traffic and measurement delay; bound concurrency or reduce exposure if you cannot maintain that margin. Compare candidate and control for the same routes and branches. Also use absolute limits because a shared database or worker can degrade both groups together. Google SRE Workbook on canarying releases

A quiet canary gives limited evidence about rare failures. Record observed volume, latency, failures, remaining budget and the oldest pending pickup event before deciding on expansion. A missed telemetry interval also changes the decision: if you cannot count failures or reconcile orders, pause new exposure until visibility returns. State the exact build to restore and name the person who checks the clerk's queue after traffic moves. Those details make the decision usable at 18:05 when the manager is serving customers and the release owner is on another call.

اقرأ المشروع الختامي بالعربية

Capstone exercise: sign the decision

Your corrected build meets the load gate. The live budget snapshot still shows 240 attempts available. During the first 600 canary attempts there are three bad outcomes, versus none in 600 control attempts. The next observation is a second actionable pickup slip for SH-481 after a worker retry. Choose hold, continue or expand. Write a short handover naming the decisive evidence, the immediate action and the evidence required to resume.

Model decision. Stop new canary traffic and use the rehearsed bridge. Three failures are below the numerical pause threshold, but the duplicate slip violates the independent integrity gate. Preserve both event records, reconcile the clerk's queue and prevent a second handover of the goods. Resume only after replaying that exact retry produces one actionable slip, rollback still completes within ten minutes, and the refreshed budget supports another bounded stage. A defensible release decision identifies the customer promise that failed and the observation that could change the answer.

YOUR TAKE

What did you think?

Choose one reaction for this article.

Was this useful?

A cookie helps limit repeat responses. Your feedback is private.

Share this noteLinkedIn ↗X ↗Email ↗

Keep exploring.

Software Architecture9 min read

Find a Tail Latency Regression

Checkout barely moves at the median, but its p99 triples. Trace a missing 610 milliseconds, shorten a connection hold and decide whether to roll out the fix.

Read article ↗