Distributed SystemUnit 1512 min read
Distributed Systems: Real-World Apps & Emerging Trends
Unit 15 of Distributed System: Explores cutting-edge applications, emerging technologies (blockchain, IoT, cloud-native), and practical case studies (eSewa, Daraz, NEPSE) to bridge theory with industry needs, including hands-on examples like consensus in cryptocurrency and latency in Pathao’s ride-matching.
TAKEAWAYS:
- Learn how blockchain (e.g., eSewa’s transaction ledgers) uses distributed consensus to replace centralized trust.
- Understand edge computing (e.g., NTC’s 5G base stations) to reduce latency in real-time services like Pathao.
- Compare serverless architectures (e.g., Daraz’s order processing) with traditional cloud models.
- Analyze quantum-resistant cryptography (e.g., NEPSE’s future-proofing) for post-2030 security.
- See how AI-driven load balancing (e.g., Google’s global infrastructure) optimizes resource allocation.
- Solve a real-world trace (e.g., Khalti’s multi-bank transaction flow) using distributed principles.
1. Blockchain and Distributed Ledgers
Blockchain is a decentralized, tamper-proof ledger where transactions are verified by consensus across nodes. Unlike traditional databases, it eliminates single points of failure and fraud.
How It Works
- Transaction Broadcast: A user (e.g., sending money via eSewa) broadcasts a transaction to the network.
- Validation: Nodes (miners/validators) verify the transaction using cryptographic proofs.
- Consensus: A protocol (e.g., Proof-of-Stake) selects a validator to add the block to the chain.
- Immutability: Once recorded, data cannot be altered without consensus.
sequenceDiagram
participant User
participant NodeA
participant NodeB
participant Ledger
User->>NodeA: Broadcast Transaction (e.g., "Transfer 100 NPR to Alice")
NodeA->>NodeB: Propagate Transaction
NodeA->>Ledger: Validate (Cryptographic Hash)
NodeB->>Ledger: Validate
Ledger-->>NodeA: Confirm Block (Consensus)
Ledger-->>User: Transaction ConfirmedReal-World Example: eSewa’s Transaction Ledger
- Idea Used: Immutable, append-only ledger for financial transactions.
- How: eSewa’s blockchain records every payment (e.g., utility bills, remittances) across banks without a central authority.
- Advantages:
- Fraud resistance (no double-spending).
- Auditability (all parties can verify).
- Disadvantages:
- High energy use (Proof-of-Work).
- Slow throughput (~7 TPS vs. Visa’s 24,000).
Worked Example: Bitcoin vs. eSewa
| Feature | Bitcoin (Decentralized) | eSewa (Hybrid) |
|---|---|---|
| Consensus | Proof-of-Work (mining) | Proof-of-Stake (validators) |
| Throughput | 7 TPS | 1,000+ TPS (optimized) |
| Latency | 10+ minutes | <2 seconds |
| Use Case | Global crypto payments | Local remittances/bills |
2. Edge Computing for Low-Latency Services
Edge computing processes data closer to the source (e.g., NTC’s 5G base stations) to reduce latency.
How It Works
- Data Collection: Sensors (e.g., Pathao’s GPS) send real-time data.
- Local Processing: Edge nodes (e.g., NTC’s cell towers) filter/analyze data.
- Cloud Sync: Only critical data is sent to the cloud for long-term storage.
Real-World Example: Pathao’s Ride-Matching
- Idea Used: Edge computing for real-time route optimization.
- How: NTC’s 5G towers process rider requests locally, reducing wait times from 5s to <1s.
- Advantages:
- Faster response (critical for ride-hailing).
- Bandwidth savings (less cloud traffic).
- Disadvantages:
- Higher hardware costs at the edge.
Worked Example: Latency Comparison
| Service | Traditional Cloud (Latency) | Edge Computing (Latency) |
|---|---|---|
| Pathao Ride Match | 300ms | 10ms |
| YouTube Video | 200ms | 50ms (CDN) |
| Stock Trading | 100ms | 1ms (HFT edge nodes) |
3. Serverless Architectures in E-Commerce
Serverless (e.g., AWS Lambda) lets platforms like Daraz scale dynamically without managing servers.
How It Works
- Event Trigger: A user adds an item to their cart (Daraz).
- Function Invocation: A serverless function processes the order.
- Auto-Scaling: Daraz’s backend scales to handle 10,000+ orders/min during sales.
sequenceDiagram
participant User
participant DarazFrontend
participant AWSLambda
participant Database
User->>DarazFrontend: Add Item to Cart
DarazFrontend->>AWSLambda: Trigger "ProcessOrder" Function
AWSLambda->>Database: Update Inventory
AWSLambda->>PaymentGateway: Charge Card
Database-->>AWSLambda: Confirmation
AWSLambda-->>User: Order ReceivedReal-World Example: Daraz’s Prime Day
- Idea Used: Serverless auto-scaling for peak traffic.
- How: During Prime Day, Daraz’s Lambda functions handle 50x more requests without manual scaling.
- Advantages:
- Pay-per-use cost efficiency.
- Faster deployment (no server setup).
- Disadvantages:
- Cold starts (~100ms latency).
- Vendor lock-in (AWS/Azure).
Comparison Table: Serverless vs. Traditional Cloud
| Feature | Serverless (Daraz) | Traditional Cloud (Ncell) |
|---|---|---|
| Scaling | Automatic | Manual |
| Cost | Pay-per-execution | Fixed VM costs |
| Latency | ~100ms (cold start) | ~50ms (warm VMs) |
| Use Case | Spiky workloads (sales) | Steady-state (call centers) |
4. Quantum-Resistant Cryptography for NEPSE
NEPSE is adopting post-quantum cryptography to secure trading data against future quantum attacks.
How It Works
- Threat Model: Quantum computers could break RSA/ECC in 2030.
- Solution: Use lattice-based cryptography (e.g., CRYSTALS-Kyber).
- Implementation: NEPSE’s trading servers encrypt messages with quantum-resistant keys.
Real-World Example: NEPSE’s Future-Proofing
- Idea Used: Quantum-resistant encryption for stock trades.
- How: NEPSE’s blockchain-like ledger uses Kyber to secure transactions even if RSA is cracked.
- Advantages:
- Future-proof security.
- Compliance with global standards (NIST).
- Disadvantages:
- Higher computational overhead.
Worked Example: Key Comparison
| Algorithm | Broken By Quantum? | Latency (Encryption) | NEPSE Use Case |
|---|---|---|---|
| RSA (2048-bit) | Yes (~2030) | 10ms | Legacy systems |
| ECC (256-bit) | Yes (~2030) | 5ms | Current NEPSE |
| CRYSTALS-Kyber | No | 20ms | Future-proof trades |
5. AI-Driven Load Balancing in Global Clouds
Google uses AI to distribute traffic across its 200+ data centers, reducing latency for users worldwide.
How It Works
- Traffic Monitoring: Google’s AI (Borg) tracks user requests globally.
- Dynamic Routing: Requests are routed to the nearest healthy server.
- Predictive Scaling: AI predicts traffic spikes (e.g., YouTube video uploads).
Real-World Example: Google’s Global Infrastructure
- Idea Used: AI-driven load balancing for low-latency access.
- How: When you search on Google, AI routes you to the nearest cache (e.g., Singapore for Southeast Asia).
- Advantages:
- Sub-100ms response times.
- Automatic failover.
- Disadvantages:
- Complexity in AI models.
Worked Example: Kathmandu Traffic Routes
| User Location | Nearest Google DC | Latency | Fallback DC |
|---|---|---|---|
| Kathmandu | Singapore | 120ms | Mumbai (200ms) |
| New York | Chicago | 20ms | London (50ms) |
| Sydney | Melbourne | 10ms | Singapore (150ms) |
6. Distributed AI: Federated Learning
Federated learning trains AI models across devices (e.g., Ncell’s 5G base stations) without centralizing data.
How It Works
- Local Training: Ncell’s base stations train a model on local call data.
- Aggregation: Only model updates (not raw data) are sent to the cloud.
- Global Model: The cloud aggregates updates to improve accuracy.
Real-World Example: Ncell’s Call Quality AI
- Idea Used: Federated learning for network optimization.
- How: Ncell’s base stations detect call drops locally and share only the model improvements (not user data) with the cloud.
- Advantages:
- Privacy-preserving.
- Faster training (no data transfer).
- Disadvantages:
- Model drift (local vs. global differences).
Comparison: Federated vs. Centralized Learning
| Feature | Federated Learning (Ncell) | Centralized Learning (Google) |
|---|---|---|
| Data Location | On-device | Cloud |
| Privacy | High | Low |
| Training Speed | Faster (local) | Slower (data transfer) |
| Use Case | IoT, telecom | Image recognition (Google) |
In the Real World
eSewa’s Blockchain:
- Uses distributed consensus (Proof-of-Stake) to validate transactions across banks without a central ledger. This replaces traditional bank reconciliation, reducing fraud by 30%.
Pathao’s Edge Computing:
- NTC’s 5G edge nodes process ride requests locally, cutting latency from 300ms to <10ms. This is why Pathao’s app feels instant even in Kathmandu’s traffic.
NEPSE’s Quantum Cryptography:
- Adopts CRYSTALS-Kyber to secure stock trades against quantum computers. This is a direct response to NIST’s 2024 post-quantum standards.
Daraz’s Serverless Prime Day:
- During sales, Daraz’s AWS Lambda functions handle 50x more traffic than usual, proving serverless scales better than traditional clouds for unpredictable spikes.
Exam Tip
- Focus on real-world mappings: Always tie concepts (e.g., consensus, edge computing) to Nepali companies (eSewa, Pathao) or global ones (Google, NEPSE).
- Trace examples: For blockchain, show how eSewa’s transaction flow uses P2P validation. For edge computing, draw Pathao’s 5G tower → rider route.
- Compare architectures: Always include a table (e.g., serverless vs. traditional cloud) to highlight trade-offs.
- Quantum section: Expect 1-2 questions on post-quantum cryptography (e.g., "Why is NEPSE adopting Kyber?").
- AI/ML: Know federated learning’s advantage for privacy-sensitive data (e.g., Ncell’s call quality AI).
Based on the TU BCA syllabus for Distributed System (CACS352), unit 15.
Discussion
Loading…