Lease-based job processing and fencing
Shows why lease expiry alone is insufficient and stale workers need fencing at the resource. Original worked design example; adapt responsibilities, thresholds and assumptions to your system.
Rendering…
What this template contains
- Diagram type
- Sequence diagram
- Source
- 18 lines
Make it your own.
sequenceDiagram
participant Q as Job queue
participant W1 as Worker A
participant L as Lease store
participant W2 as Worker B
participant R as Protected resource
W1->>L: Acquire job lease
L-->>W1: Fencing token 41
W1->>Q: Read job payload
Note over W1: Worker pauses beyond lease expiry
W2->>L: Acquire expired lease
L-->>W2: Fencing token 42
W2->>R: Write result with token 42
R-->>W2: Accepted
W1->>R: Late write with token 41
R-->>W1: Reject stale fencing token
W2->>Q: Complete job
W2->>L: Release lease if token still 42