Lease vs fencing token
A lease gives one runner the right to work for a short time, but a paused runner can still send work later. A fencing token grows with each lease, and the store rejects old tokens. When runner A loses contact for 12 s, a lease passes 100 duplicate jobs and 100 stale writes. Fencing passes none.
Fencing tokens · lease 30 s · late write with token 33: rejected
Case 1
Archive jobs: 100 due at 1 s, 10 s each. Check jobs: 20 due at 4 s, 1 s each. Runner A loses lease contact from 2 s to 14 s, but work it already sent can finish.
| Measure | Goal | Lease only, 2 s | Lease with a fencing token |
|---|---|---|---|
| Duplicates | none | 100 Fail | 0 Pass |
| Split-brain writes | none | 100 Fail | 0 Pass |
| Lost writes | none | 0 Pass | 0 Pass |
| Completion time (Archive) | under 18 s | 11.02 s Pass | 13.92 s Pass |
| Completion time (Checks) | under 8 s | 5 s Pass | 5 s Pass |
| Monthly cost | 24 USD/mo | 24 USD/mo | |
| Error rate | 0% | 0% |