Workstation topics · System design for builders

Lesson 3 of 3 · about 30 minutes

Planning for bad days

🏠The everyday picture

A careful shopkeeper has a plan for bad days: a second copy of the ledger kept at home, a cash book for when the card machine stops, a list of who to call when the shutter jams, and a quick check every evening that the till adds up. An app needs the same plan, written down before the bad day comes.

📘What it really is

Four habits that keep a system safe:

  1. Backups you've tested. Copy the database every day to somewhere separate, keep several days of copies, and practise restoring one into a test copy now and then. A backup you have never restored is only a hope.
  2. A plan for each outside service. Payments, SMS, email and couriers will each fail sometimes. Decide in advance what the shop does: wait and retry, switch to a backup, or show a clear message.
  3. Logs and alerts. Logs are the system's diary: what happened and when. Alerts message a person when something important goes wrong, such as payments failing for 5 minutes, instead of waiting for customers to complain.
  4. A one-page system diagram. Boxes for each part, arrows for how they talk, and a note of where each part runs and who looks after it. It's the first thing anyone needs when something breaks at night.

📝A worked example

Sharma Textiles' "what if?" table:

What if... What the customer sees What the system does Who is told
The payment service is down "Payments are paused, please try again in a few minutes" Keeps the basket; doesn't create half-paid orders Priya, by alert after 5 minutes
The payment confirmation arrives twice Nothing odd Spots the repeated payment ID and records it once Priya, in the daily report
The database server fails "We'll be back shortly" page The host restores last night's backup (orders since then must be re-entered) Mr Sharma and the developer
The courier's tracking service stops "Tracking will update soon" Retries every 15 minutes Nobody, unless it lasts a day

🖱️Try it

Make a "what if?" table for your own app with at least four rows: one for payments (or your most important outside service), one for the database, one for a mistake by a person (such as deleting a product by accident), and one of your own. Then draw the one-page diagram. Ask an AI: "Here is my diagram and what-if table. What failure have I missed?"

✅Quick check

The shop takes backups every night but has never restored one. What's the risk?

Show the answer

That the backups don't work, are incomplete, or nobody knows how to restore them, and this is only discovered on the bad day. Practise a restore into a test copy.

Why have alerts, if customers will tell you anyway?

Show the answer

Because many customers just leave instead of complaining, and by the time someone does complain, hours of orders may be lost. An alert tells you within minutes.

🧩Check yourself

Tap an answer to see why every option is right or wrong. There's no score and nothing is saved, so try as often as you like.

1. Which shows that Sharma Textiles' backups can really be trusted?

2. The payment service starts failing during the evening rush. What is the best behaviour?

3. What is the main purpose of the one-page system diagram?

← PreviousCoping with a rush: the Diwali sale
ProLearners Assist