Build1 distinct publisher3 min readUpdated
A four-part dev.to walkthrough of leases, fencing tokens and consensus ends where it should. Coordination is a cost, and the cheaper fix is usually a unique index or a version column.
The Engineer · Build desk

Compiled by The EngineerSomething wrong?How this is made
The closing installment of a four-part dev.to series on distributed locking spends its last pages arguing against the machinery it just finished explaining: after locks, leases, fencing tokens, leader election and consensus, the author's advice is to step back and ask whether the system can be redesigned so that coordination is not necessary at all [1][3]. That is the right conclusion, and it is worth stating plainly because the opposite reading is so tempting: study enough coordination primitives and you start to believe reliability is a function of how sophisticated your primitive is [2].
The cost side of the ledger is the part teams skip. Every coordination mechanism adds network communication between services, adds failure scenarios that must each be handled correctly, adds operational surface that has to be monitored, debugged and maintained, and usually adds latency, because coordination means waiting for agreement or confirmation [4]. The series' framing is that the most reliable systems are often not the ones with the strongest coordination but the ones that minimise coordination while still preserving correctness [5].
The two worked examples are unglamorous and that is the point. First, duplicate registration. The naive design acquires a distributed lock, checks whether the email exists, inserts the customer, then releases the lock [6]. The alternative is one line of DDL: a unique index on customer(email) [8]. Every instance then just attempts the insert and lets the constraint accept or reject it, with no lock, no coordination service and no lease management [7][9]. Counting the source's own diagrams, that is four steps down to one application operation, and two of the four steps existed only to manage the lock [1].
Second, concurrent updates to the same row. Two instances read an inventory record at version 8; A writes and the record becomes version 9; B's write still carries version 8, the database rejects the mismatch, and B retries from the current state [11][12]. No instance ever held exclusive ownership [11]. The author's claim for this pattern is throughput, because operations are not blocked, plus lower coordination overhead and a simple recovery model, and notes it works particularly well when conflicts are relatively rare [13].
What both fixes have in common is not cleverness but ownership: the invariant is enforced at the single place that owns the data, rather than negotiated in a protocol between peers who each think they might own it [2]. That is the test to apply before you write any lock acquisition code. If the rule you are protecting lives entirely inside one store, the store should enforce it, and the series says as much [10].
The honest boundary is in that same sentence. The delegation argument is scoped to cases where correctness depends entirely on the state of a single database, so it says nothing about invariants spanning two stores or a store plus an external side effect [3]. Those are where leases and fencing tokens still earn their keep.
What to watch, if you are holding a lock today: measure your actual conflict rate before adopting optimistic concurrency, since the source's own qualifier is that the pattern suits rare conflicts [13]. Watch retry behaviour under load, because a rejected write becomes application work rather than a queue behind a lock [12][13]. And check whether the invariant your lock defends is already expressible as a constraint, which is a schema change rather than a new dependency [8][9].
Follow any of these and your For You feed starts watching them — no settings page required.
Ranked by verification strength, evidence, and original report placement.
Relational databases already provide strong data integrity guarantees including uniqueness constraints, so the business rule can be expressed in the schema instead of coordinated at the application level.
The constraint shown is CREATE UNIQUE INDEX uk_customer_email ON customer(email).
With the unique constraint in place, every application instance simply attempts the insert and the constraint returns success or rejection; there is no distributed lock, no coordination service and no lease management.
Whenever correctness depends entirely on the state of a single database, delegating enforcement to the database itself is usually the simplest and most reliable solution, because the database owns the data.
Optimistic concurrency lets concurrent operations proceed and resolves conflicts only when they occur, is particularly effective when conflicts are relatively rare, and provides high throughput because operations are not blocked unnecessarily, minimal coordination overhead between services, and a simple recovery model.
The series covers distributed locks, leases, fencing tokens, leader election and consensus, each existing to solve a coordination problem where multiple machines must agree on who is allowed to do what and when.
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
Single-source explainer; mechanics verifiable, generalisations unbacked
All content comes from one dev.to installment. The technical mechanics are internally complete and checkable from the text itself — the unique index DDL, the reduced insert flow, and the version 8 / version 9 rejection-and-retry sequence — and they describe long-standing, uncontroversial patterns. But the load-bearing normative claims (that minimal coordination yields the most reliable systems, that experienced engineers reach this conclusion at scale, that optimistic concurrency is widely used) carry no measurements, named systems, citations or corroborating publisher. There is also no coverage of multi-store invariants, and the idempotency section is truncated mid-sentence.
No adoption signal in supplied material
The source is an educational walkthrough. It reports no release, deployment, benchmark, pricing or licensing event, names no organisation using these patterns, and discloses no usage figures. Its one adoption-flavoured line — that optimistic concurrency is 'widely used in modern backend systems' — is an unquantified assertion with no system named, which is not an observable adoption event. No adoption observations were recorded, so this dimension cannot be scored.
Broadly aligned; mild over-generalisation beyond the two examples
The framing is deliberately deflationary — the recommendation is to remove machinery rather than adopt anything — and the article states its own scope condition ('whenever correctness depends entirely on the state of a single database') and the precondition for optimistic concurrency (conflicts relatively rare). That honesty keeps the gap near zero. It tilts slightly positive because superlative reliability claims and a claim about what experienced engineers generally do are asserted on the strength of two toy examples, with the multi-store case left uncovered in the supplied text.
Individual tutorial series; audience incentive, no vendor or product stake
The item is part 4 of 4 of a numbered dev.to series by an individual author on a community publishing platform. No product, employer, sponsor, vendor or commercial relationship is disclosed or promoted, and the advice steers readers away from purchasing coordination infrastructure rather than toward any offering. The residual incentive is the ordinary one for serialised developer content — reach, follows and series completion — which favours confident, quotable generalisations such as the reliability thesis over hedged, evidence-heavy treatment.
High confidence in the mechanics, low in the generalisations
Confidence is bounded by a single publisher, a single item, zero adoption evidence and a truncated final section. Within those limits the descriptive claims are reliable: the flows, the DDL and the version-conflict sequence are quoted verbatim and describe standard, widely understood database behaviour, so they are unlikely to be overturned. The thesis-level and practice-level claims cannot be confirmed from the supplied material at all, which pulls the aggregate to the middle.
build
Once You Have Added Leases And Fencing, Your Lock Is Just A Badly Timed Election1 distinct publisher
build
The @Version field that guarded nothing: JPA counters, bulk UPDATEs and quietly missing clicks1 distinct publisher
build
Your agent's retry logic is reading a timeout as a fact it does not have1 distinct publisher
build
Force the tool call, then hand Lightsail a long-lived key1 distinct publisher
Distinct publishers with included, body-backed reporting in this cluster.
dev.to
1 article · August 19, 2026