A Python implementation of distributed object storage with erasure coding and multi-region replication.
- 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
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ 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 │
└─────────────────┘
- Install dependencies:
pip install -r requirements.txt- Start the server:
python api/server.pyThe server will be available at http://localhost:8000
docker-compose up -dPOST /objects/{key}- Upload objectGET /objects/{key}- Download objectDELETE /objects/{key}- Delete objectGET /objects- List objectsGET /objects/{key}/info- Get object metadataGET /cluster/stats- Get cluster statisticsGET /cluster/health- Health checkPOST /cluster/recovery/{node_id}- Trigger recoveryGET /metrics/summary- Get metrics summary
Edit config.yaml to configure storage nodes, erasure coding parameters, and replication settings.
Run the benchmark test:
python tests/benchmark.pyRecent benchmark results show:
- 1000 objects processed successfully
- 100% success rate for all operations
- Excellent throughput and latency
- Robust error handling and recovery
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.
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
MIT License