A comprehensive collection of system design concepts, algorithms, and practical implementations covering the fundamental building blocks of scalable distributed systems. This repository serves as a complete learning resource for understanding system design principles through hands-on examples and theoretical concepts.
- APIs: REST, GraphQL, and gRPC implementations
RestAPI/
- FastAPI-based REST API examplesGraphQL/
- GraphQL with FastAPI and StrawberrygRPC/
- Protocol Buffers and gRPC server/client examples
- Load Balancing Algorithms: Practical implementations of various load balancing strategies
01 Round Robin.py
- Basic round-robin load balancing02 Weighted Round Robin.py
- Weighted round-robin algorithm03 Least Connections.py
- Least connections load balancing04 Least Response Time.py
- Response time-based load balancing05 IP Hash.py
- IP hash-based load balancing
- Database concepts and implementations (currently under development)
- Bloom Filters: Memory-efficient probabilistic data structure
22 Bloom Filters.py
- Complete Bloom filter implementation22 Bloom Filters_1.py
- Alternative implementation
- Rate Limiting Algorithms: Various rate limiting strategies
fixed_window_counter.py
- Fixed window rate limitingsliding_window_counter.py
- Sliding window countersliding_window_log.py
- Sliding window logleaky_bucket.py
- Leaky bucket algorithmtoken_bucket.py
- Token bucket algorithm
- WebSockets: Real-time communication documentation
websockets.md
- WebSocket concepts and usage
- Concurrency vs. Parallelism: Interactive comparison
Concurrency vs. Parallelism Comparison.html
- Visual comparison with examples
- REST APIs: Modern FastAPI-based RESTful services
- GraphQL: Type-safe GraphQL APIs with automatic documentation
- gRPC: High-performance RPC framework with Protocol Buffers
- Round Robin: Simple request distribution
- Weighted Round Robin: Capacity-aware load distribution
- Least Connections: Connection-based load balancing
- Least Response Time: Performance-based routing
- IP Hash: Consistent request routing
- Bloom Filters: Efficient membership testing with configurable false positives
- Rate Limiting: Multiple algorithms for API protection
- WebSockets: Real-time bidirectional communication
- Concurrency vs. Parallelism: Understanding execution models
- Caching Strategies: Various caching approaches
- Database Scaling: Sharding and distribution techniques
- Python 3.7+
- pip (Python package manager)
-
Clone the repository
git clone https://github.com/raj713335/System_Design_Masterclass.git cd System_Design_Masterclass
-
Install dependencies for specific modules
For REST API examples:
pip install fastapi uvicorn
For GraphQL examples:
pip install fastapi uvicorn strawberry-graphql
For gRPC examples:
pip install grpcio grpcio-tools
For Bloom Filters:
pip install bitarray
cd "01 Foundations of System Design/01 APIs/RestAPI"
uvicorn main:app --reload
Visit: http://localhost:8000/docs
cd "01 Foundations of System Design/01 APIs/GraphQL"
uvicorn main:app --reload
Visit: http://localhost:8000/graphql
cd "01 Foundations of System Design/01 APIs/gRPC"
# Generate protobuf files
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. greet.proto
# Start server
python greeter_server.py
# In another terminal, run client
python greeter_client.py
cd "02 Load Handling, Caching & Content Delivery/07 Load Balancing Algorithms"
python "01 Round Robin.py"
cd "04 Communication Between Systems/23 Rate Limiting Algorithms"
python fixed_window_counter.py
cd "04 Communication Between Systems/22 Bloom Filters"
python "22 Bloom Filters.py"
The project includes comprehensive visual aids in the Data/
directory:
- API Gateway patterns
- CAP Theorem illustrations
- Load balancing strategies
- Caching strategies and eviction policies
- Database sharding approaches
- WebSocket architectures
- Single Point of Failure (SPOF) analysis
- Idempotency patterns
- PowerPoint presentations for each topic
- Interactive HTML comparisons
- Detailed diagrams in Draw.io format
- Start with REST API fundamentals
- Understand basic load balancing (Round Robin)
- Learn about rate limiting basics
- Explore caching concepts
- Dive into GraphQL and gRPC
- Implement advanced load balancing algorithms
- Master Bloom filters and probabilistic data structures
- Understand WebSocket communication
- Study database sharding and scaling
- Implement complex rate-limiting strategies
- Analyze concurrency vs. parallelism
- Design fault-tolerant architectures
- Create a new Python file in the appropriate directory
- Follow the existing naming conventions
- Include comprehensive documentation
- Add example usage in the code
- Modify existing implementations to suit your needs
- Add new test cases and edge conditions
- Implement additional algorithms following the same patterns
- Fork the repository
- Create a feature branch
- Add your implementation or improvement
- Include proper documentation
- Submit a pull request
This project is licensed under the GNU Lesser General Public License v2.1 - see the LICENSE file for details.
This masterclass provides:
- Practical implementations of theoretical concepts
- Hands-on examples for immediate application
- Visual learning aids for complex concepts
- Progressive difficulty from basic to advanced topics
- Real-world scenarios and use cases
For questions, issues, or contributions, please:
- Check existing documentation
- Review example implementations
- Open an issue with a detailed description
- Provide code examples for bugs
Master the art of designing scalable, reliable, and efficient distributed systems.