distributed systems
9 minDistributed Systems Foundations: Consistency, Retries, and Delivery Semantics
Separate consistency guarantees from delivery guarantees and design for the partial failures that make retries necessary.
Loading page...
distributed systems
9 minSeparate consistency guarantees from delivery guarantees and design for the partial failures that make retries necessary.
distributed systems
18 minDesign around Kafka group churn, payment idempotency, coordination limits, sagas, CQRS, and context propagation across async boundaries.
Q&A
Q&AConcurrent histories under the vector clock identity and propagation model.
If neither vector is component-wise less than the other, neither history contains all represented knowledge of the other. This does not establish physical-time order or choose a globally agreed winner.
Q&A
Q&AAt the destination, atomically with the protected effect.
The destination rejects generations older than its highest accepted token. A lease does not stop a paused worker, and a fence cannot reject an expired generation it has not yet learned is superseded.
Q&A
Q&APersist the business change and an event record together, then publish the event asynchronously.
A database transaction writes both the business state and an outbox row. A separate publisher retries delivery from that durable row. This avoids the gap where a database commit succeeds but broker publication fails. Delivery can still be repeated, so consumers should deduplicate by a stable event ID.
Q&A
Q&AThe producer may reject writes when fewer than two replicas remain in the in-sync set.
With three brokers and min.insync.replicas=2, acks=all requires the current in-sync replica set to meet the minimum. If the ISR falls to one, writes are rejected rather than acknowledged with reduced replication. acks=1 favors availability but risks losing leader-only writes if that leader fails before replication.
Q&A
Q&AKeep consumer liveness within max.poll.interval.ms and commit only after durable work.
If processing exceeds max.poll.interval.ms, the group may consider the member failed and reassign its partitions; a later commit from the old generation is rejected. Reduce records per poll, process with bounded workers while preserving partition ordering, pause/resume appropriately, or adjust the interval based on measured worst-case work. Keep the fix from merely delaying failure detection indefinitely.
Q&A
Q&AOffsets are the durability checkpoint. Commit too early and you lose work; commit too late and you duplicate it.
Kafka commits represent when the consumer believes work has been finished. If the offset is committed before the business effect is truly durable, a crash can lose data. If it is committed only after a delay, the application may re-process messages when the consumer restarts. The correct strategy is to commit only after the state change is stored successfully and the work is idempotent enough to recover from retries.