Introduction
Assignment Overview
In this assignment, you will build a distributed calculator service using Python and gRPC. This hands-on project will help you understand the fundamental challenges of distributed systems and how to build resilient services.
Why This Assignment?
Remote Procedure Calls (RPC) are fundamental to modern distributed systems. They power:
- Microservices communication (e.g., Netflix, Uber)
- Cloud services (AWS, Google Cloud, Azure)
- Mobile apps talking to backend servers
- IoT devices communicating with cloud platforms
Understanding RPC is essential for building scalable, reliable distributed applications.
Key Concepts Covered
1. RPC Fundamentals
- Client-server architecture
- Protocol Buffers (protobuf) for data serialization
- Synchronous request-response patterns
2. Failure Handling
- Network timeouts and retries
- At-least-once vs at-most-once semantics
- Partial failures in distributed systems
3. Idempotency
- Making operations safe to retry
- Request deduplication
- State management in distributed systems
4. Circuit Breaker Pattern
- Preventing cascading failures
- Fast failure and recovery
- System resilience under load
Assignment Structure
The assignment is divided into 4 progressive parts:
Part 1: Basic RPC (30%)
Implement a simple calculator service with gRPC
Part 2: Failure Handling (35%)
Add timeout handling and retry logic
Part 3: Idempotency (20%)
Implement request IDs for safe retries
Part 4: Circuit Breaker (15%)
Add circuit breaker pattern to prevent cascading failures
Bonus: RPC vs REST (+10%)
Compare performance and analyze trade-offs
What You'll Learn
By the end of this assignment, you will:
- ✅ Understand how RPC frameworks work under the hood
- ✅ Handle network failures gracefully
- ✅ Design idempotent APIs
- ✅ Implement resilience patterns
- ✅ Make informed decisions about RPC vs REST
Prerequisites
Before starting, you should be familiar with:
- Python programming (functions, classes, async/await)
- Basic networking (client-server model, TCP/IP)
- Command line usage
New to gRPC?
Don't worry! We provide detailed setup instructions and starter code.