Chapter II · Area 08 of 12

Distributed systems

The Question for Our ShopWhat happens if the connection to the payment provider drops after sending a request?

Here you will find the basics for distributed states, networks and handling partial failures.

Three questions for every distributed interaction

  1. What can go wrong?

    Assumptions & failures

    Payment P-731 gets no response; the outcome is unknown, the order stays open.

  2. What arrives, and how often?

    Delivery

    Order B-1042 may reach the invoice worker twice; its identifier reveals the repeat.

  3. How do participants agree on a shared result?

    Agreement

    Cart in two regions: wait during a partition or accept locally; three replicas, two acknowledgements each.

Known names – and where they are

This is how the building blocks hang together

Network assumptions (fallacies) and partial failures show what can go wrong. Delivery classifies message loss and retries. CAP weighs consistency against availability, quorum defines confirmation groups, consensus secures a binding order.

Architectural conditionPartial failuresHere you learn how to handle failed participants and uncertain outcomes in distributed workflows.RiskAssumptions about distributionmake visible the assumptions that latency and independent failures violateConceptDelivery guaranteesdescribe how messages are handled under delay, loss and repetitionModelCAP & PACELCclassify consistency and availability during partitions, and latency in normal operationMechanismQuorumsets a required number of replicas for reads and writesMechanismConsensushas a majority confirm binding entries in a shared order
Relations: Assumptions about distribution make visible the assumptions that latency and independent failures violate; Delivery guarantees describe how messages are handled under delay, loss and repetition; CAP & PACELC classify consistency and availability during partitions, and latency in normal operation; Quorum sets a required number of replicas for reads and writes; Consensus has a majority confirm binding entries in a shared order.

Your learning path through the area

Here you clarify what applies if the connection to the payment provider drops after sending. From this you derive delivery guarantees, replica groups and agreement across several nodes. Each building block shows its theme at our shop.

  1. Assumptions about distribution

    Standalone conceptFailures

    This is what you learnYou can derive a specific error and operating case for a shop process from a network assumption.

    In the shopThe shop application requests an external payment provider. The team looks at what delay, separation and variable response times mean for the flow.

    Assumptions about distribution Open
  2. Partial failures

    Standalone conceptFailures

    This is what you learnYou can detect a partial failure and continue the affected flow with an explicit intermediate state.

    In the shopThe shop stores an order and calls up the payment provider. The connection breaks off after sending, while the order management continues.

    Partial failures Open
  3. Failure Detection

    Standalone concept

    This is what you learnDetection provides a sound basis for a targeted response. Assess the result against this limit: One missing signal cannot distinguish a network fault from a process crash.

    In the shopThe shop example uses the existing shared database and seven modules. Any added service or deployment model is a hypothetical extension. During checkout, a worker sends a heartbeat every five seconds. After several missed reports, the controller marks it suspect and routes new work to healthy instances. A delayed heartbeat can result from network load while the worker is processing a payment. The in-flight job therefore remains queryable by its identifier; detection does not trigger a second charge. The team measures detection time and false alarms, then tunes the threshold to recovery objectives.

    Failure Detection Open
  4. Delivery guarantees

    Overview & comparisonDelivery

    This is what you learnYou can treat multiple delivery as a normal message case and schedule idempotent processing.

    In the shopThe shop publishes an order for invoicing. A worker stores invoice and order identifier before confirming broker delivery.

    Delivery guarantees Open
  5. CAP & PACELC

    Overview & comparisonAgreement

    This is what you learnFor a network outage, you can specify which consistency and availability commitment a replicated service prioritizes.

    In the shopThe shopping cart is replicated in two regions. While the regions are separate, the shop decides whether changes to the shopping cart positions are accepted locally or deferred until a common view.

    CAP & PACELC Open
  6. PACELC

    Standalone concept

    This is what you learnMake latency and consistency visible even without partitions. Assess the result against this limit: PACELC frames trade-offs but proves no property of a specific system.

    In the shopThe shop example uses the existing shared database and seven modules. Any added service or deployment model is a hypothetical extension. On the shop’s order flow, the cart reads the last replicated product price from a regional replica. The team permits brief replication lag for fast local responses, but requires a coordinated price check at final checkout. During a partition, checkout waits or fails while the catalogue remains readable. PACELC helps discuss these paths separately and set measurable latency and consistency goals.

    PACELC Open
  7. CAP Theorem

    Standalone concept

    This is what you learnReason about response choices during a partition. Assess the result against this limit: CAP concerns partitions and precisely defined guarantees.

    In the shopThe shop example uses the existing shared database and seven modules. Any added service or deployment model is a hypothetical extension. The shop replicates stock availability across two sites. A partition separates them while customers request reservations. The team decides that a site rejects reservations without coordination to avoid double allocation; the product catalogue may temporarily show older availability. This different response follows the business risk of each operation. A CAP diagram does not replace a precise consistency guarantee and failure model.

    CAP Theorem Open
  8. Quorum

    Standalone conceptAgreement

    This is what you learnYou can calculate reading and writing quors and explain what overlap their configuration allows.

    In the shopA distributed shopping cart storage uses three replicas. The team uses two confirmations for reading and writing and sees how the groups overlap.

    Quorum Open
  9. Consensus

    Overview & comparisonAgreement

    This is what you learnYou can distinguish the purpose of a consensus protocol from replication and quorum.

    In the shopVariant: A separately operated inventory service uses multiple replicas to log changes to shared stocks in an orderly manner. The shop itself remains a modular monolith.

    Consensus Open
  10. Fencing Token

    Standalone concept

    This is what you learnUse resource-side enforcement to exclude stale holders. Assess the result against this limit: A token without validation at the target offers no protection.

    In the shopThe shop example uses the existing shared database and seven modules. Any added service or deployment model is a hypothetical extension. For invoice B-1042, worker A receives token 41. After a pause, its lease expires and worker B takes over with token 42. B stores the validated invoice status. When A later sends an old write, the database compares 41 with the stored maximum 42 and rejects it. The token must reach the resource that stores the effect; checking only inside the worker would not stop the delayed call.

    Fencing Token Open
  11. Lease

    Standalone concept

    This is what you learnConnect time-limited ownership to a verifiable takeover. Assess the result against this limit: Expiry does not automatically stop a paused process.

    In the shopThe shop example uses the existing shared database and seven modules. Any added service or deployment model is a hypothetical extension. An invoice worker claims order B-1042 with a 30-second lease and renews it while generating the PDF. A long GC pause prevents renewal; after expiry, the coordinator assigns the job to another instance. When the first worker returns, it may still issue a delayed write. The invoice store accepts only the latest fencing token. The job remains available while a stale holder cannot change state.

    Lease Open
Afterwards in the learning path · area 09Runtime & operations