All projects

Project case study

Disk-Mesh

Follow a file across a storage cluster

A Java distributed file-system prototype that splits files into checksummed chunks, pipelines replicas, and coordinates repair through heartbeats.

  • Java
  • TCP
  • SHA-256
  • Distributed storage
Project notesNine local integration scenarios passed, including replica repair after a node failure.

The problem

I built Disk-Mesh with a metadata master that tracks file locations and storage nodes that hold replicated chunks. The client checks the bytes it downloads, tries another replica when a read fails, and verifies the assembled file.

How it fits together

  1. 01

    Allocate

    The master assigns chunk IDs and a replica pipeline.

  2. 02

    Replicate

    The client sends each checksummed chunk through the chosen nodes.

  3. 03

    Commit

    Publish file metadata after the write pipeline acknowledges.

  4. 04

    Reconcile

    Heartbeats report replicas and carry commands to make more copies.

File bytes travel directly between clients and storage nodes. Downloads use the master’s locations, try another replica when a read fails, and verify both chunk checksums and the assembled file’s SHA-256 digest.

Interactive demo

Watch replicas recover

Take a node offline, then press Play or Step to follow missed heartbeats, a repair decision, and a copy between storage nodes.

Browser simulation · 4 nodes · target: 3 replicas per chunk

Step 0 · Idle

Metadata master

4 / 4 nodes online

  1. 01Detect
  2. 02Plan
  3. 03Copy

Every chunk meets the replica target

Each chunk has at least three live copies. Take a node offline to explore another failure.

No copy in flight

Take a storage node offline to start a recovery.

  • Node 1

    Online

    Chunk A: live copyChunk B: live copyChunk C: live copy

    3 stored chunks

  • Node 2

    Online

    Chunk A: live copyChunk B: live copyChunk C: no copy

    2 stored chunks

  • Node 3

    Online

    Chunk A: live copyChunk B: no copyChunk C: live copy

    2 stored chunks

  • Node 4

    Online

    Chunk A: no copyChunk B: live copyChunk C: live copy

    2 stored chunks

A, B, and C are chunks of one file. Offline copies stay on disk and become available when the node returns.

Live copies · target: 3 per chunk
ChunkCopiesLive holders
Chunk A3 / 3N1, N2, N3
Chunk B3 / 3N1, N2, N4
Chunk C3 / 3N1, N3, N4

Step 0 · At target

All three chunks have three live copies. Take Node 1 offline to begin.

Recent events
  1. 00All three chunks have three live copies. Take Node 1 offline to begin.

This illustrative model runs in your browser: three equal-size chunks, a two-step heartbeat timeout, and one repair at a time. Each completed copy includes the next replica report. Returning nodes keep extra copies; steps represent event order, with no network or disk I/O.

Decisions & tradeoffs

Keep metadata separate from file bytes

I keep file transfers between clients and storage nodes so the master only handles names and placement. The master is still a single point of failure. It saves periodic snapshots, but has no metadata write-ahead log; a crash can lose changes since the last snapshot.

Chain replicas before acknowledging a chunk

I send each chunk to the first storage node and let the nodes forward it down a chain. The acknowledgement waits for downstream writes, so a slow node slows the upload. If there are fewer live nodes than the target replication factor, an upload can succeed with fewer copies.

Repair from observed replica reports

Each heartbeat reports the chunks a node holds. When a node times out, the master removes its replicas and asks surviving nodes to make new copies, favoring destinations with free space. This needs a healthy source and somewhere to copy to. A slow node can also time out even when it is still running.

Tests and limitations

All nine local integration scenarios passed on 11 November 2026, covering byte-for-byte round trips, concurrent transfers, corrupt replicas, node loss, and garbage collection. The harness runs the cluster within one JVM; it does not establish production reliability.

The recovery test starts four storage nodes with three replicas per chunk, stops one node, and waits for three live replicas again. It then downloads the file and compares its bytes with the original. The cluster runs in one process, and this test does not cover a master crash.

Chunk data and checksum files are written separately without an explicit disk sync. Copies and checksums alone cannot guarantee survival after power loss. Master crashes and interrupted writes still need testing.

Run the cluster scenarios

With Java 22 or newer installed, run this command from a repository checkout. The supplied runner starts an in-process master and storage nodes and exercises the nine integration scenarios.

bash scripts/test.sh