All field notes Start reading

Decentralized Data Storage: An Overview of Techniques and Algorithms

A technical guide to replication, erasure coding, consensus, concurrency, recovery, and routing—and the storage guarantees each can actually provide.

Decentralized Data Storage: An Overview of Techniques and Algorithms

A storage system becomes interesting when something goes wrong: a disk disappears, two clients update the same record, or half the network cannot reach the other half. Its architecture determines which operations can continue, which must wait, and whether acknowledged data can be recovered.

After my 2022 introduction to decentralized storage, I wanted to examine the mechanisms behind those promises. This guide connects the main techniques to the problems they solve. They are building blocks, not a checklist that every system must implement.

The first distinction is between distribution and control. A cloud service can distribute data across thousands of machines under one operator. A decentralized network distributes some control among participants. Both need a clear consistency model, a recovery plan, and an account of whom they trust.

Distributed systems

A distributed system coordinates machines through messages. A machine can fail independently; a message can be delayed, duplicated, or lost. From one node’s perspective, a slow peer can be difficult to distinguish from a failed one.

For storage, separate four questions before choosing algorithms:

Question Relevant mechanisms What to test
Can the bytes survive failures? Replication, erasure coding, repair Recovery after independent and correlated losses
Can clients find the right version? Indexes, DHTs, version metadata Stale records and concurrent updates
Can nodes agree on an operation? Consensus, transactions, concurrency control Partitions, leader changes, and incomplete work
Can the system keep serving traffic? Placement, scheduling, routing Hotspots, overload, and recovery traffic

Integrity, confidentiality, and retention are separate requirements. A content hash helps check bytes; encryption controls who can read them; an operating agreement keeps someone storing them. None automatically provides the other two.

Replication

Replication keeps additional copies of data. Full replication places the entire dataset at every participating storage node; partial replication places each object or partition on a selected subset. Placement must account for shared disks, hosts, racks, power, and operators: several copies in one failure domain can disappear together.

The write protocol is a separate choice. Synchronous replication waits for specified acknowledgements; asynchronous replication can return sooner while replicas catch up. A read quorum and write quorum may overlap when R + W > N, but overlap alone does not establish linearizability. Version ordering, concurrent writes, membership changes, and repair also matter.

The Dynamo paper provides a concrete example of these tradeoffs, including replication and application-visible conflict handling.

Original illustration accompanying the replication section

Erasure coding

Erasure coding divides an object into k data fragments and computes m additional coding fragments. With an appropriate maximum-distance-separable code, any k of the k + m fragments can reconstruct the object. These are fragments of one encoding, not several complete copies plus a parity copy.

For example, k = 6 and m = 3 use a storage factor of 9 / 6 = 1.5: roughly 1.5 TB for 1 TB of data before metadata and padding. That arrangement can tolerate three missing fragments, provided the remaining six are intact and available. Ceph’s erasure-coding documentation explains the parameters and placement constraints.

The saving comes with encoding, reconstruction, and repair costs. Compare recovery time and failure domains as well as capacity; a storage ratio alone does not establish an equivalent durability guarantee.

Original illustration accompanying the erasure coding section

Gossip protocols

Gossip spreads information through repeated exchanges between peers. Instead of contacting every node directly, each participant contacts a limited set and lets information propagate. This can distribute membership information, health observations, or summaries used to identify divergent replicas.

Propagation takes time. A missed heartbeat is evidence of a communication problem, not proof that a node has permanently failed. A partition can leave groups with different views, so the design needs versioning, expiry, and reconciliation when communication resumes.

Gossip is useful for keeping a large population informed without a single broadcast coordinator. It should not be confused with a consensus protocol that decides one authoritative sequence of updates.

Original illustration accompanying the gossip protocols section (1)

Original illustration accompanying the gossip protocols section (2)

Distributed hash tables (DHTs)

A distributed hash table maps keys to responsible peers through an overlay network. It can help a client discover where to request an object without asking a central directory.

The records need not contain the file itself. The IPFS DHT, for example, supports provider discovery: a record can identify a peer that says it provides particular content. Retrieving that content remains another operation.

Routing-table maintenance, record replication, expiry, and malicious peers complicate the design. A DHT is therefore not an alternative to redundancy. Discovery records need protection, and the actual file still needs enough reachable providers. A successful lookup followed by an unavailable provider is a storage failure from the user’s perspective.

Original illustration accompanying the distributed hash tables (dhts) section

Agreement and recovery

Consensus protocols

Consensus lets participants agree on decisions despite a specified class of failures. In storage, it may coordinate a metadata log, membership, or the order of updates. It does not require every file byte to be written to a blockchain.

Choose the failure model first. Crash-fault protocols assume nodes follow the protocol until they stop or become unreachable. Byzantine-fault protocols also consider nodes that lie or send inconsistent messages. Their assumptions, communication costs, and quorum requirements differ.

Also separate safety from liveness: avoiding contradictory decisions is not the same as continuing to make progress. During a partition, a safe system may refuse writes rather than allow incompatible histories.

Original illustration accompanying the consensus protocols section

Paxos algorithms

Paxos uses numbered proposals and intersecting majorities to preserve a value once it has been chosen. In the basic protocol, a proposer first obtains promises and learns about prior accepted proposals. It must then choose a value consistent with those responses before asking acceptors to accept it.

This is more constrained than taking turns and voting for arbitrary values. The promise and value-selection rules are what prevent a later majority from choosing an incompatible result. Lamport’s “Paxos Made Simple” sets out those rules.

Multi-Paxos applies agreement to a series of log positions and can use a stable leader to reduce repeated coordination. Persistence, recovery, membership changes, and progress under contention remain essential implementation work.

Original illustration accompanying the paxos algorithms section

Raft algorithm

Raft organizes replicated-state-machine consensus around leader election, log replication, and safety rules. A leader accepts commands and replicates log entries; followers apply committed entries to their state machines. Terms and election restrictions prevent an arbitrary stale server from simply declaring its history authoritative.

In the usual crash-fault model, five voting servers can continue with two unavailable if the remaining majority can communicate and other progress assumptions hold. This does not make Raft inherently more fault-tolerant than Paxos under the same model. Its contribution includes a structure intended to be easier to understand.

The Raft paper and project materials explain the protocol. Neither Raft nor ordinary Paxos is a defense against participants deliberately fabricating protocol messages.

Original illustration accompanying the raft algorithm section

Byzantine fault tolerance (BFT) protocols

Byzantine fault tolerance addresses arbitrary behavior, including conflicting messages and dishonest replicas. Authentication helps establish who sent a message; it does not make the sender’s claims true.

Classic Practical Byzantine Fault Tolerance uses at least 3f + 1 replicas to tolerate f Byzantine replicas under its model. Four replicas can therefore tolerate one faulty replica; saying “one third can be malicious” without the precise bound is misleading. Progress also depends on communication eventually becoming sufficiently timely.

Proof of stake is a way to allocate influence and incentives, not one universal consensus algorithm with a larger fault allowance. A deployment must specify its actual protocol, membership or stake assumptions, and what happens when those assumptions fail.

Original illustration accompanying the byzantine fault tolerance (bft) protocols section

Checkpointing

A checkpoint records enough durable state to resume work without replaying the entire history. A storage service might combine a snapshot of its data with a log position, then replay later committed operations after restart.

The key question is whether the snapshot represents a consistent state. Independently copying several nodes at different moments can capture an update on one side of a relationship and omit it on the other. Coordination, logs, or application-specific recovery rules must account for that.

More frequent checkpoints reduce replay work but consume I/O and storage. Test the complete restore path, including metadata and encryption keys, rather than treating the existence of snapshot files as proof of recoverability.

Original illustration accompanying the checkpointing section

Rollback algorithms

Rollback returns internal state to a recoverable point after incomplete or invalid work. Database undo information and recovery logs are common tools; distributed workflows may instead require compensating actions.

These are different guarantees. Restoring a database does not undo a payment already sent through an external system or erase a message another service has acted on. Compensation is a new action with its own failure cases, not a reversal of time.

Define which operations can be replayed safely and how duplicate effects are detected. Recovery procedures should identify the last committed state, preserve evidence needed for diagnosis, and avoid repeatedly reintroducing the fault that caused the rollback.

Original illustration accompanying the rollback algorithms section

Finding and updating data

Distributed indexing algorithms

An index makes data discoverable without scanning every stored object. A hash-partitioned index can distribute exact-key lookups; a range-partitioned index supports ordered scans; an inverted index maps terms to matching documents.

Each choice creates different hotspots and update costs. A popular key can overload one shard even when the total dataset is evenly divided. A secondary index may also lag behind the primary data unless their updates share a consistency mechanism.

For a storage catalog, specify whether a query may return stale entries and how a client checks them. Include index rebuild and migration in the recovery plan: intact files are of limited use if the system cannot locate them.

Original illustration accompanying the distributed indexing algorithms section

Distributed query processing algorithms

A distributed query planner decides where work should happen and what must cross the network. Filtering near the stored data and sending partial aggregates can reduce transfer volume. A join may require moving rows between partitions or broadcasting a small input.

The slowest participant can dominate completion time. Data skew, a cold cache, or a recovering node may matter more than average server capacity. Measure bytes moved, intermediate-result sizes, and slow partitions as well as query latency.

Parallel execution is not automatically faster. Starting more tasks introduces scheduling and coordination overhead, and independently reading replicas may produce a result without a consistent snapshot unless the system explicitly provides one.

Original illustration accompanying the distributed query processing algorithms section

Distributed transaction processing algorithms

A distributed transaction coordinates changes across participants. Two-phase commit first asks them to prepare, then communicates a commit or abort decision. Participants must retain enough durable state to resolve uncertainty after failures.

Two-phase commit can block when a prepared participant cannot learn the final decision. PostgreSQL’s documentation describes prepared transactions and the need for an external transaction manager. Adding a third phase does not remove every failure problem; nonblocking claims depend on timing and network assumptions.

Atomic commitment is also separate from isolation: agreeing to commit does not by itself prevent every concurrent anomaly. For long business workflows, a sequence of local transactions with explicit compensations may be more practical, but it offers different semantics.

Original illustration accompanying the distributed transaction processing algorithms section

File allocation algorithms

Allocation decides where a file’s blocks or objects live. On a local device, contiguous allocation, linked allocation, and indexed allocation have different fragmentation and access tradeoffs. Across machines, placement must also consider capacity, locality, and failure domains.

Consistent or rendezvous hashing can limit how much placement changes when membership changes. Capacity-aware policies can distribute data unevenly when machines have different resources. Neither approach excuses placing all copies behind the same operational dependency.

Evaluate what happens when a nearly full node fails. The system needs both destinations for replacement data and enough spare network and disk capacity to complete repair before another failure becomes dangerous.

Original illustration accompanying the file allocation algorithms section

File distribution algorithms and striping

Striping divides a file into chunks and places them across devices or nodes. It can allow parallel reads and writes, but striping alone provides no redundancy: losing one required chunk can make the file incomplete.

Replication or erasure coding can protect those chunks. Their placement must be coordinated with the stripe layout so that a single failure does not remove too many required pieces.

Chunk size affects the balance between parallelism, metadata, and small-read efficiency. A layout that serves large sequential media files well may perform poorly for many tiny random reads. Benchmark the actual access pattern, including the slower path when a fragment must be reconstructed.

Original illustration accompanying the file distribution algorithms and striping section

Coordinating concurrent work

Lock-based algorithms

Locks prevent incompatible operations from proceeding at the same time. Shared and exclusive modes can permit concurrent readers while controlling writes; a consistent acquisition order can reduce deadlocks.

Across machines, ownership becomes harder. A process may pause beyond a lease timeout and then resume, unaware that another process has acquired the resource. A fencing token, checked by the protected storage service, can reject operations from an obsolete owner.

Specify who grants the lock, how ownership is recovered, and how clients handle timeouts. Treating a successful lock request as permanent permission can produce corruption during exactly the failures the distributed design is meant to survive.

Original illustration accompanying the lock-based algorithms section

Timestamp-based algorithms

Timestamp-based concurrency control orders or validates operations using assigned timestamps. These may be logical sequence values rather than wall-clock readings. Depending on the algorithm, conflicting work can be rejected and retried instead of waiting for a lock.

A physical clock is not a perfect ordering oracle. Two machines can disagree on time, and equal or reversed timestamps can hide the order in which messages actually influenced one another. Lamport’s work on logical clocks explains the distinction between causal relationships and clock readings.

Choosing “the latest timestamp wins” is a conflict policy. It can deliberately discard a legitimate concurrent update, so the application must decide whether that loss is acceptable.

Original illustration accompanying the timestamp-based algorithms section

Vector clock algorithms

A vector clock records a set of counters that tracks causal history across participants. Comparing vectors can show that one version descends from another, or that neither includes the other’s changes and the versions are concurrent.

That detects a conflict; it does not decide the correct merged value. A shopping-cart application might combine additions, while two edits to a financial instruction may require a different resolution rule. The Dynamo paper illustrates versioning with vector clocks and application-assisted reconciliation.

Metadata growth and changing membership are practical constraints. Truncating history can reduce overhead but also weaken the system’s ability to distinguish related versions from genuinely concurrent ones.

Original illustration accompanying the vector clock algorithms section

Leader election algorithms

Leader election chooses a coordinator for a particular role. It can simplify metadata updates or work assignment, but the election must be connected to the resource’s correctness rules.

A timeout alone is not enough: an isolated old leader may still be running. Terms, quorums, leases under explicit timing assumptions, or fencing can prevent two coordinators from producing conflicting accepted work.

Raft integrates election with log constraints because a leader must preserve committed history. Replacing a failed process quickly is useful only if the replacement has the right authority and state. Measure recovery time alongside the possibility of stale leaders continuing to act.

Original illustration accompanying the leader election algorithms section

Clock synchronization algorithm

Clock synchronization estimates and corrects differences between physical clocks. NTP exchanges timestamps and accounts for network delay, but it cannot give every machine a perfectly identical view of time.

Wall-clock time is useful for human-facing timestamps and many expiry policies. A monotonic clock is generally the appropriate basis for measuring elapsed time within one process. Neither choice alone establishes causal order across machines.

If correctness depends on a time bound, document that bound and the response when it is exceeded. Clock skew, time adjustments, and a host resuming after suspension belong in fault testing.

Original illustration accompanying the clock synchronization algorithm section

Distributed mutual exclusion algorithms

Distributed mutual exclusion ensures that only an authorized participant enters a particular critical section at a time. A coordinator can grant permission; a token can circulate; or participants can exchange ordered permission requests.

The alternatives shift complexity rather than eliminate it. A coordinator needs recovery, a lost token needs safe regeneration, and permission-based schemes must handle missing responses without admitting incompatible owners.

The logical-clock paper develops an ordering-based example. In a real storage application, ask whether a global critical section is necessary. Partitioning ownership or using operations that can merge safely may reduce the coordination required, provided the application invariants still hold.

Original illustration accompanying the distributed mutual exclusion algorithms section

Placing and scheduling work

Load balancing algorithms

Load balancing distributes requests among eligible servers. Round-robin is simple; weighted routing can reflect different capacities; least-loaded strategies react to observed work. Storage adds a constraint: the chosen destination must hold, retrieve, or reconstruct the requested data.

Request count is often an inadequate load measure. One large recovery read may consume more disk and network capacity than many small metadata requests. Queue delay and resource saturation can give a better picture.

Avoid rapid oscillation between nodes based on stale measurements. A good policy includes health checks, admission limits, and a response for the case where every eligible server is overloaded.

Original illustration accompanying the load balancing algorithms section

Scheduling algorithms

Scheduling decides when work runs and which resources it receives. Foreground reads, background repair, compaction, and rebalancing compete for the same disks and network links.

Strict priority can protect interactive latency but starve maintenance. Fair sharing can distribute capacity more evenly while making an urgent recovery slower. Deadline-aware or cost-aware policies need estimates that will sometimes be wrong.

Define minimum progress for background work and limits on its disruption to users. A system that postpones every repair to keep dashboards green can become less durable over time. Track queue age and unfinished work, not just the rate of completed requests.

Original illustration accompanying the scheduling algorithms section

Optimization algorithms

Optimization starts with an objective and constraints: minimize retrieval latency, reduce operating cost, lower repair traffic, or preserve a required failure tolerance. These goals can conflict.

Placement might be modeled with a constrained optimization method or improved through a heuristic. The important step is to make the constraints explicit. An inexpensive layout that violates the required geographic separation is not a valid improvement.

Include the cost of reaching a new layout. Moving many terabytes consumes capacity and may temporarily increase risk. Compare a proposed policy against a simple baseline under representative failures, and retain a way to reverse the change.

Original illustration accompanying the optimization algorithms section

Communication and routing

Message passing protocols

Message passing is how participants exchange requests, replies, and state updates. The application must define serialization, authentication, version compatibility, retries, and flow control.

A transport connection does not settle application-level delivery semantics. If a sender loses the connection after issuing an operation, it may not know whether the receiver completed it. Retrying without an operation identifier or an idempotent action can repeat the effect.

Design the receiver’s behavior as carefully as the sender’s retry loop. Bound outstanding work, reject invalid messages, and preserve enough information to recognize duplicates. Reliable storage depends on those details as much as on the routing topology.

Original illustration accompanying the message passing protocols section

Request-response

Request-response pairs an operation with a reply, such as fetching an object or confirming a write. It is easy for callers to understand, but a timeout means the caller lacks a timely answer; it does not prove that nothing happened.

Use deadlines, bounded retries, and idempotency where the operation permits it. A write response should state what was acknowledged: receipt by a gateway, durable storage on one node, or commitment by the required replicas.

Large transfers may need streaming and cancellation. Backpressure should prevent a slow client or downstream service from turning an ordinary request into an unbounded memory or queue problem.

Original illustration accompanying the request-response section

Publish-subscribe protocols

Publish-subscribe separates event producers from consumers through topics or subscriptions. Storage systems can use it for object-created notifications, cache invalidation, or repair events.

The pattern can use brokers, distributed logs, or peer-to-peer dissemination; it is not inherently centralized. Ordering, retention, delivery guarantees, and acknowledgement rules depend on the actual protocol and deployment.

Consumers must be prepared for the documented behavior, including duplicates or replay. Treat an event as a trigger to check authoritative state where appropriate. A lost notification should not permanently hide a stored object if periodic reconciliation can detect the mismatch.

Original illustration accompanying the publish-subscribe protocols section

Shortest path algorithms

A shortest-path algorithm minimizes a defined sum of edge weights. Dijkstra’s algorithm applies to nonnegative weights; Bellman–Ford can handle negative weights when a meaningful solution exists. Their usefulness depends on what the graph and weights represent.

In a storage network, measured latency, transfer cost, or administrative preferences may matter more than physical distance. A peer overlay also differs from the underlying network: one overlay edge can cross many routers.

Routing information ages quickly under changing load. A mathematically shortest route in the model may therefore be slower in practice. Validate the metric against retrieval time and failure behavior.

Original illustration accompanying the shortest path algorithms section

Minimum hop algorithms

Minimum-hop routing treats each edge as having equal cost and seeks the fewest edges. Breadth-first search provides that result in an unweighted graph.

Fewer hops can reduce some overhead, but do not guarantee lower latency or more bandwidth. One slow international link may cost more time than several fast local links, and a direct provider may be overloaded.

Use hop count when it matches the objective or as one signal among others. For content retrieval, provider availability, connection setup, throughput, and the location of useful cached data often deserve separate measurement.

Original illustration accompanying the minimum hop algorithms section

Load-balanced routing algorithms

Load-balanced routing spreads traffic across viable paths or providers instead of sending every request to the currently preferred destination. It can improve utilization and reduce hotspots when the alternatives have sufficient capacity.

For storage, route selection must respect replica freshness and integrity requirements. A fast but stale replica may be unsuitable for a read that requires the latest committed version. Multipath transfer also needs a way to assemble and verify the returned data.

Combine routing with admission control and bounded retries. Moving overload between paths without reducing demand can create a larger failure. The useful outcome is predictable service under stress, not merely equal traffic counters.

Original illustration accompanying the load-balanced routing algorithms section

Conclusion

A practical architecture combines a small set of mechanisms around a clear promise. For an immutable public archive, content addressing, independent retention, fragment placement, and retrieval monitoring may dominate. For a frequently updated database, ordering, isolation, indexes, and recovery become central.

Write down the failures the system must survive and the behavior clients should observe during each one. Then test those claims: remove a node, delay messages, interrupt a write, restore a snapshot, and measure how long redundancy remains reduced during repair.

Decentralization can change who controls storage and how independent its operators are. The quality of the system still rests on precise guarantees, recoverable state, and an operating model capable of keeping the data available.

Share