Cloud Design Patterns and Application Architecture: Resilience, Scalability, Microservices and Event-Driven Reference Designs
Architecture Styles
| Style | Idea | Good for | Watch out |
|---|---|---|---|
| N-tier | Layers: web, business, data | Lift and shift, simple apps | Layers can become tightly coupled |
| Web-queue-worker | Web front end, queue, worker | Moderate apps with background work | Large monolithic components |
| Microservices | Many small independent services | Large, fast-changing systems and many teams | Operational complexity, data consistency |
| Event-driven | Producers and consumers via events | Real-time, IoT, loose coupling | Debugging and ordering |
| Big data / big compute | Pipelines and parallel jobs | Analytics, simulation | Cost control |
| CQRS | Separate read and write models | Different read and write loads | Extra complexity |
Resilience Patterns
| Pattern | Problem solved | How |
|---|---|---|
| Retry | Transient faults | Retry with exponential backoff and jitter, limited attempts |
| Circuit breaker | Retrying a dead service wastes resources | Stop calls for a time after repeated failures, then test |
| Bulkhead | One failing part sinks everything | Isolate pools of threads or instances per dependency |
| Timeout | Hanging calls | Fail fast |
| Health endpoint monitoring | Unknown health | /health checks used by load balancers |
| Compensating transaction | Undo multi-step work | Run reverse steps (saga) |
| Leader election | One coordinator | Use a lease on Blob or a coordination service |
python
import random, time
def call_with_retry(fn, attempts=5, base=0.2):
for n in range(attempts):
try:
return fn()
except TimeoutError:
if n == attempts - 1:
raise
time.sleep(base * (2 ** n) + random.uniform(0, base)) # backoff + jitter
Scalability and Performance Patterns
| Pattern | Idea |
|---|---|
| Cache-aside | Read from cache, on a miss load from the database and store with a TTL |
| Competing consumers | Workers share a queue and scale out |
| Queue-based load leveling | Smooth spikes |
| Sharding | Split data by key across databases |
| Throttling / rate limiting | Protect the system under load |
| CQRS and materialized view | Precomputed read models for fast queries |
| Static content hosting / CDN | Offload static files |
| Event sourcing | Store changes as events, rebuild state |
Microservices Design Rules
- Each service owns its own data. No shared database between services
- Communicate through APIs and events, not database access
- Design for independent deployment and versioning
- Use API gateway, service discovery and centralized logging and tracing
- Start with a modular monolith if the team and domain are small
Reference Design: Event-Driven Order Platform
text
Front Door/WAF -> APIM -> Order service (Container Apps) -> Service Bus topic "orders"
|-> Inventory service -> its own Azure SQL
|-> Billing service -> its own Cosmos DB
|-> Notification Function -> email/SMS
Cache-aside with Redis for product catalog. App Insights traces correlate requests across services.
Practice
- Choose an architecture style for a small team building an internal tool and for a 40-team retailer
- Add retry, circuit breaker and bulkhead to a diagram
- Explain cache-aside with a stale data example
Conclusion
Use proven patterns: retry with backoff, circuit breaker and bulkhead for resilience, cache-aside, queues and sharding for scale, and choose an architecture style that matches team size and system complexity.
Quick Summary: styles; resilience; scalability; microservices; reference.

