Cloud ComputingUnit 512 min read
Cloud Architecture: Models, Layers, Protocols & Real-World Systems
Unit 5 of Cloud Computing explores the foundational architecture of cloud systems, covering layered models (5-layer cloud architecture), communication protocols (REST, SOAP, HTTP/HTTPS), service interaction patterns (synchronous/asynchronous), and real-world deployments like AWS/Azure’s multi-tier designs. It compares
Core Concepts: What Cloud Architecture Really Means
Cloud architecture is the blueprint of how cloud services are structured, connected, and delivered. It defines:
- Physical vs. logical layers (what users see vs. what runs behind the scenes).
- How services communicate (protocols, APIs, message formats).
- Scalability and fault tolerance (how the system grows without breaking).
Why It Matters
Without a well-designed architecture, clouds would be:
- Slow (bottlenecks in data flow).
- Unreliable (single points of failure).
- Expensive (inefficient resource use).
1. The 5-Layer Cloud Architecture Model
Cloud systems are built in five abstract layers, each with a specific role. Visualize them as stacked services:
Key Layers Explained
| Layer | Components | Example in Nepal | Real-World Tech |
|---|---|---|---|
| User Interface | Web portals, mobile apps, APIs | eSewa’s payment gateway | React.js, Flutter |
| Application | SaaS apps, microservices, APIs | Daraz’s product catalog | Node.js, Django |
| Platform | Runtime, databases, messaging queues | Khalti’s transaction logs | Kubernetes, Redis |
| Infrastructure | VMs, containers, load balancers | NTC’s network traffic routing | AWS VPC, Docker |
| Physical | Servers, storage, cooling systems | Ncell’s data centers | Blade servers, SSD arrays |
2. Communication Protocols: How Cloud Services Talk
Cloud services never work in isolation. They exchange data using standardized protocols. The two most critical ones are:
A. REST (Representational State Transfer)
- How it works: Uses HTTP/HTTPS to fetch/create data via stateless requests (each request carries all needed info).
- Message format: JSON/XML over HTTP methods (
GET,POST,PUT,DELETE). - Example: When you check your eSewa balance, your app sends a
GETrequest to eSewa’s API, which returns JSON like:{ "user_id": "12345", "balance": 5000, "currency": "NPR" }
B. SOAP (Simple Object Access Protocol)
- How it works: Uses XML for structured messages and WS- standards* (e.g., WS-Security) for enterprise needs.
- Message format: Envelope, header, body (like a letter with metadata).
- Example: Banks use SOAP for secure inter-bank transactions (e.g., NMB’s core banking system).
Comparison Table
| Feature | REST | SOAP |
|---|---|---|
| Protocol | HTTP/HTTPS | HTTP, SMTP, TCP |
| Data Format | JSON/XML | Only XML |
| State | Stateless | Can be stateful |
| Performance | Faster (lightweight) | Slower (XML overhead) |
| Security | HTTPS + OAuth | WS-Security, digital signatures |
| Use Case | Public APIs (eSewa, Daraz) | Banking, healthcare (NMB) |
3. Service Interaction Patterns
Cloud services interact in two primary ways:
A. Synchronous Communication
- Definition: Requester waits for a real-time response (like calling a friend and expecting an immediate answer).
- Example: When you place an order on Daraz, your request waits for the server to confirm:
sequenceDiagram participant User participant DarazApp participant OrderService User->>DarazApp: POST /order (synchronous) DarazApp->>OrderService: Validate & process OrderService-->>DarazApp: Order ID: 12345 DarazApp-->>User: Success!
- Pros: Simple, immediate feedback.
- Cons: Bottlenecks if the service is slow (e.g., NTC’s website during peak hours).
B. Asynchronous Communication
- Definition: Requester does not wait; response is delivered later (like leaving a voicemail).
- Example: Pathao’s ride requests use async messaging:
- You request a ride → Pathao’s app sends a message to the driver queue.
- A driver accepts → Pathao notifies you via push notification.
- Tech used: Message queues (RabbitMQ, AWS SQS).
- Pros: Scalable, fault-tolerant.
- Cons: Complex error handling.
4. Monolithic vs. Microservices Architecture
How cloud apps are structured affects performance, scalability, and cost.
A. Monolithic Architecture
- Definition: All components (UI, business logic, database) are bundled into one unit.
- Example: Early versions of Facebook (before 2012) ran as a monolith.
- Pros:
- Simple to develop/deploy.
- Good for small apps (e.g., a local bakery’s website).
- Cons:
- Hard to scale (must scale the entire app, even if only the checkout page is busy).
- Single point of failure (if the database crashes, the whole app crashes).
B. Microservices Architecture
- Definition: App is split into small, independent services (each with its own database, API, and lifecycle).
- Example: Netflix uses microservices for recommendations, billing, and streaming.
- Pros:
- Independent scaling (e.g., scale only the recommendation service during Diwali sales).
- Fault isolation (if one service fails, others keep running).
- Cons:
- Complex to manage (requires orchestration tools like Kubernetes).
- Higher operational overhead.
Comparison Table
| Feature | Monolithic | Microservices |
|---|---|---|
| Scalability | Vertical (scale entire app) | Horizontal (scale individual services) |
| Deployment | Single unit | Multiple services |
| Tech Stack | One language/framework | Polyglot (Python, Go, Java, etc.) |
| Example in Nepal | Old NEPSE trading system | eSewa’s modular payment services |
| Complexity | Low | High |
5. Hybrid and Multi-Cloud Architectures
Not all clouds are the same. Companies mix public, private, and edge clouds for flexibility.
A. Hybrid Cloud
- Definition: Combines private cloud (on-premises, secure) with public cloud (scalable).
- Example: Nepal Rastra Bank (NRB) uses:
- Private cloud for sensitive financial data.
- AWS for public-facing services (e.g., loan applications).
- Use Case: Healthcare (patient records private; analytics in the cloud).
B. Multi-Cloud
- Definition: Uses multiple public clouds (e.g., AWS + Azure) to avoid vendor lock-in.
- Example: Google uses AWS for some services and Google Cloud for others.
- Challenge: Data consistency (ensuring the same user sees the same info across clouds).
Visual: Hybrid Cloud Data Flow
flowchart TD
A["User Request"] --> B["Private Cloud\n(NRB's Secure DB)"]
B --> C["API Gateway"]
C --> D["Public Cloud\n(AWS Lambda)"]
D --> E["Load Balancer"]
E --> F["Multiple Services\n(Auth, Billing, Analytics)"]
F --> G["User Response"]6. Real-World Cloud Architecture in Nepal
Let’s break down how eSewa and Daraz use cloud architecture:
Case Study 1: eSewa’s Payment Gateway
- User Interface Layer: Mobile app/web portal (React Native).
- Application Layer:
- Auth Service: Verifies user login (OAuth 2.0).
- Transaction Service: Processes payments (REST API).
- Platform Layer: Runs on AWS Lambda (serverless) + Redis (caching).
- Infrastructure Layer: Uses AWS EC2 (virtual servers) and RDS (database).
- Physical Layer: Hosted in AWS data centers (global, low-latency).
Why This Works:
- Scalability: During Dashain, thousands of users pay simultaneously → Lambda auto-scales.
- Security: Private keys stored in AWS KMS (Key Management Service).
Case Study 2: Daraz’s CDN and Caching
- Problem: Slow load times for users in Kathmandu vs. Pokhara.
- Solution: Uses Cloudflare CDN (Content Delivery Network).
- How it works:
- User requests a product image.
- Cloudflare’s edge servers (closest to the user) serve the image.
- If the image isn’t cached, Daraz’s origin server fetches it and caches it.
- How it works:
- Result: Faster page loads, lower bandwidth costs.
7. Cloud Architecture Best Practices
To design a reliable, scalable cloud system:
- Decouple Components: Use message queues (e.g., RabbitMQ) to avoid tight coupling.
- Design for Failure: Assume services will fail → use retries, circuit breakers.
- Optimize Data Flow: Minimize latency (e.g., cache frequently accessed data).
- Secure Every Layer: Encrypt data in transit (TLS) and at rest (AES-256).
- Monitor and Log: Use AWS CloudWatch or Prometheus to track performance.
In the Real World
eSewa’s API Layers
- What it uses: 5-layer cloud architecture + REST APIs.
- How: When you pay a bill, your request flows through:
- UI Layer (mobile app) → Application Layer (auth + transaction services) → Platform Layer (AWS Lambda) → Infrastructure Layer (RDS database).
- Impact: Enables millions of transactions/day without downtime.
Daraz’s Microservices
- What it uses: Microservices for inventory, orders, and recommendations.
- How: During sales, only the order service scales up, not the entire app.
- Impact: Handles 10x traffic during Diwali without crashes.
NTC’s Hybrid Cloud for Network Management
- What it uses: Hybrid cloud (private for core routing, AWS for analytics).
- How: Public cloud runs AI-based traffic prediction, while private cloud manages real-time network switches.
- Impact: Reduces outages by 30% (per NTC’s 2023 report).
Exam Tip: How This Unit Is Tested
This unit is heavily visual and conceptual. Expect:
- Diagram-based questions (50% weight):
- Draw and label the 5-layer cloud architecture.
- Compare REST vs. SOAP message formats.
- Sketch a hybrid cloud data flow for a given scenario (e.g., a bank’s loan processing).
- Scenario analysis (30% weight):
- "Explain how Daraz could use microservices to handle Black Friday traffic."
- "Why might a Nepalese hospital prefer a hybrid cloud over a public cloud?"
- Short-answer definitions (20% weight):
- Define synchronous vs. asynchronous communication.
- Explain CDN caching with an example (e.g., YouTube’s global servers).
Top 3 Mistakes to Avoid:
- Mixing up layers: Don’t confuse the platform layer (runtime) with the infrastructure layer (VMs).
- Ignoring real-world examples: Always tie answers to Nepalese apps (eSewa, Daraz, NTC).
- Overcomplicating diagrams: Keep sequence diagrams simple (max 4 participants).
Final Checklist for Full Marks: ✅ Draw all required diagrams (5-layer model, REST/SOAP, hybrid cloud). ✅ Use Nepalese examples (eSewa, Daraz, NTC, banks) in explanations. ✅ Compare monolithic vs. microservices with pros/cons. ✅ Explain synchronous/asynchronous with a sequence diagram. ✅ Discuss hybrid/multi-cloud with a real-world use case.
Based on the TU BITM syllabus for Cloud Computing (IT277), unit 5.
Discussion
Loading…