Skip to content

Distributed Object Storage with Erasure Coding and Multi-Region Replication

License

suhasramanand/minigcs

Repository files navigation

MiniGCS: Distributed Object Storage with Erasure Coding

A Python implementation of distributed object storage with erasure coding and multi-region replication.

Features

  • Object storage with upload/download/list/delete operations
  • Reed-Solomon erasure coding (k=2, m=1) for data protection
  • Multi-region replication across 3 simulated regions
  • SQLite-based metadata management
  • Node failure recovery with shard repair
  • Metrics collection for latency, throughput, and MTTR
  • FastAPI-based REST API

Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   FastAPI API   │    │  Metadata DB    │    │  Storage Nodes  │
│                 │    │                 │    │                 │
│  - Upload       │◄──►│  - Object Info  │◄──►│  - Shard Store  │
│  - Download     │    │  - Shard Loc    │    │  - Health Check │
│  - List         │    │  - Versions     │    │  - Recovery     │
│  - Delete       │    │                 │    │                 │
└─────────────────┘    └─────────────────┘    └─────────────────┘
         │                       │                       │
         └───────────────────────┼───────────────────────┘
                                 │
                    ┌─────────────────┐
                    │ Erasure Coding  │
                    │                 │
                    │  - Encode Data  │
                    │  - Decode Data  │
                    │  - Repair       │
                    └─────────────────┘

Quick Start

Installation

  1. Install dependencies:
pip install -r requirements.txt
  1. Start the server:
python api/server.py

The server will be available at http://localhost:8000

Docker Deployment

docker-compose up -d

API Endpoints

  • POST /objects/{key} - Upload object
  • GET /objects/{key} - Download object
  • DELETE /objects/{key} - Delete object
  • GET /objects - List objects
  • GET /objects/{key}/info - Get object metadata
  • GET /cluster/stats - Get cluster statistics
  • GET /cluster/health - Health check
  • POST /cluster/recovery/{node_id} - Trigger recovery
  • GET /metrics/summary - Get metrics summary

Configuration

Edit config.yaml to configure storage nodes, erasure coding parameters, and replication settings.

Testing

Run the benchmark test:

python tests/benchmark.py

Performance Benchmarks

Recent benchmark results show:

  • 1000 objects processed successfully
  • 100% success rate for all operations
  • Excellent throughput and latency
  • Robust error handling and recovery

Performance Metrics

The system collects metrics for:

  • Operation latency and throughput
  • Node failure recovery times (MTTR)
  • Success rates and error counts
  • Storage utilization statistics

Metrics are exported to CSV format and available via API endpoints.

Project Structure

minigcs/
├── api/
│   └── server.py          # FastAPI server
├── core/
│   ├── metadata.py        # Metadata management
│   ├── storage_node.py    # Storage node operations
│   ├── replication_manager.py  # Replication & recovery
│   ├── erasure_coding.py  # Reed-Solomon coding
│   └── metrics.py         # Metrics collection
├── tests/
│   └── benchmark.py       # Performance tests
├── config.yaml            # Configuration
└── requirements.txt       # Dependencies

License

MIT License