You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A distributed file storage system built with Spring Boot that demonstrates core distributed systems concepts including chunking, replication, logical clocks, conflict detection, ZAB consensus, and self-healing.
Modern React frontend for uploading, downloading, and monitoring the cluster
Gateway
Entry point β handles uploads, downloads, chunking, replication
Storage Nodes
Store file chunks on disk with metadata
ZAB Metadata Cluster
Consensus-based metadata service β tracks which chunks go where
π Distributed Systems Concepts Implemented
Concept
Implementation
File Chunking
Files split into 1MB pieces via Chunker.java
Replication (Quorum)
W=2 / R=2 quorum reads/writes (3rd replica writes in background)
Manifest-Aware Reads
Direct fast-path reads from known chunk replicas, with broadcast fallback
Lamport Clocks
Logical timestamps for event ordering
Version Vectors
Per-node version tracking for conflict detection
Conflict Detection & Resolution
Detects concurrent updates; resolves using version vectors + Lamport tiebreaker
ZAB Consensus
Leader election + two-phase commit for metadata operations
Membership & Heartbeat
Periodic heartbeats; nodes marked DOWN after timeout
Self-Healing (Repair)
Automatic chunk re-replication to healthy nodes when one goes DOWN
Garbage Collection (GC)
Automatic purging of "stray" chunks found during reconciliation passes
Auto-Healing & Rebalance
Proactive scanning for under-replicated chunks (Heal Pass) to restore N=3
Chaos UI (Fault-Togglable)
Dynamic UI for simulating node crashes/recoveries without process restarts
π οΈ Tech Stack
Backend
Java 17 + Spring Boot 3.5.6
gRPC (Netty + Protobuf) for inter-node communication
REST API (Spring Web) for client-facing operations
Maven for build management
Simulation Layer: Conditional heartbeats for non-destructive fault testing
Frontend
React 19 + TypeScript
Vite for fast, optimized builds
Lucide Icons for modern cluster visualization
TailwindCSS for premium, dynamic styling
π Getting Started
Prerequisites
Java 17 (JDK)
Maven (or use the included mvnw wrapper)
Node.js & npm (for the frontend UI)
IntelliJ IDEA (recommended) or any IDE
Postman (for testing raw APIs)
Running with IntelliJ IDEA
Create the following Run Configurations (Run β Edit Configurations β + β Application). Set the Main class to com.example.demo.DemoApplication for all:
# Check membership (should show storage nodes with status "UP")
GET http://localhost:8080/membership/nodes
π‘ API Reference
File Operations (Gateway β port 8080)
Method
Endpoint
Description
POST
/files
Upload a file (multipart/form-data, key: file)
GET
/files/{filename}
Download a file
Chunk Operations (Gateway β port 8080)
Method
Endpoint
Description
PUT
/chunks/{chunkId}
Write a raw chunk (application/octet-stream)
GET
/chunks/{chunkId}
Read a chunk
Membership (Gateway β port 8080)
Method
Endpoint
Description
GET
/membership/nodes
List all registered nodes
GET
/membership/nodes/up
List only UP nodes
GET
/membership/nodes/down
List only DOWN nodes
GET
/membership/nodes/{nodeId}
Get a specific node
Chaos & Fault Simulation
Method
Endpoint
Description
POST
/chaos/toggle
Toggles node health (pauses/resumes heartbeat)
POST
/chaos/kill
Hard crash (System.exit) for testing process loss
Storage Node (ports 9001β9004)
Method
Endpoint
Description
PUT
/chunks/{chunkId}
Store a chunk
GET
/chunks/{chunkId}
Retrieve a chunk
HEAD
/chunks/{chunkId}
Check if chunk exists
DELETE
/chunks/{chunkId}
Delete a chunk
GET
/chunks
List all chunk IDs
GET
/meta/{chunkId}
Get chunk metadata
ZAB Metadata (ports 8081β8083)
Method
Endpoint
Description
POST
/zab-meta/reserve
Reserve chunk placements
POST
/zab-meta/commit
Commit a file manifest
GET
/zab-meta/manifest/{fileId}
Get file manifest
GET
/zab-meta/manifests
List all manifests
DELETE
/zab-meta/manifest/{fileId}
Delete a manifest
GET
/zab-meta/cluster/status
Get cluster status
GET
/zab-meta/cluster/health
Get cluster health
π§ͺ Testing
Import Postman Collection
Import postman_collection.json into Postman for pre-built requests.
Run Unit Tests
./mvnw test
Tests cover:
LamportClockTest β 11 tests
VersionVectorTest β 20 tests
ConcurrentUpdateConflictTest β 7 tests
VersionedStorageServiceTest β 8 tests
Testing Fault Tolerance (viva Ready)
Dashboard Toggling: Go to the Pulse Monitor tab.
Simulate Failure: Click "Simulate Failure" on Node 3.
Observation: Watch the heart pulse turn red. Within 5-10s, the Gateway logs: Repair Controller: Node 3 is DOWN, triggering re-replication.
Verification: Check the chunk mapping modal for a file; the chunk that was on Node 3 will now be copied to Node 4.
Node Recovery: Click "Bring UP" on Node 3.
Auto-Healing: Within 60s, watch the Gateway console for: ποΈ Reconciliation GC: Found stray chunk on Node 3. The "zombie" data is purged, and the system is perfectly rebalanced.
Built as a Distributed Systems practice project β SLIIT Semester 4.
About
A custom Distributed File System demonstrating core distributed concepts: W=2/R=2 quorum replication, Lamport Clocks, Version Vectors for conflict resolution, and ZAB leader election.