@teckedd-code2save/b2dp 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,873 @@
1
+ # Cloud Design Patterns
2
+
3
+ A comprehensive reference of all 44 cloud design patterns from the Azure Architecture Center, organized by concern area and detailed with problem context, usage scenarios, WAF pillar alignment, and related patterns.
4
+
5
+ ---
6
+
7
+ ## Patterns by Concern
8
+
9
+ ### Availability / Reliability
10
+
11
+ Circuit Breaker · Compensating Transaction · Health Endpoint Monitoring · Leader Election · Queue-Based Load Leveling · Retry · Saga · Scheduler Agent Supervisor · Sequential Convoy · Bulkhead · Rate Limiting
12
+
13
+ ### Data Management
14
+
15
+ Cache-Aside · CQRS · Event Sourcing · Index Table · Materialized View · Sharding · Valet Key · Claim Check
16
+
17
+ ### Design / Implementation
18
+
19
+ Ambassador · Anti-Corruption Layer · Backends for Frontends · Compute Resource Consolidation · Deployment Stamps · External Configuration Store · Gateway Aggregation · Gateway Offloading · Gateway Routing · Sidecar · Strangler Fig · Federated Identity
20
+
21
+ ### Messaging
22
+
23
+ Asynchronous Request-Reply · Choreography · Claim Check · Competing Consumers · Messaging Bridge · Pipes and Filters · Priority Queue · Publisher/Subscriber · Queue-Based Load Leveling · Sequential Convoy
24
+
25
+ ### Performance / Scalability
26
+
27
+ Cache-Aside · Geode · Throttling · Deployment Stamps · CQRS
28
+
29
+ ### Security
30
+
31
+ Gatekeeper · Quarantine · Valet Key · Federated Identity · Throttling
32
+
33
+ ---
34
+
35
+ ## Pattern Reference
36
+
37
+ ### 1. Ambassador
38
+
39
+ **Create helper services that send network requests on behalf of a consumer service or application.**
40
+
41
+ **Problem:** Applications need common connectivity features such as monitoring, logging, routing, security (TLS), and resiliency patterns. Legacy or difficult-to-modify apps may not support these features natively. Network calls require substantial configuration for concerns such as circuit breaking, routing, metering, and telemetry.
42
+
43
+ **When to use:**
44
+
45
+ - You need a common set of client connectivity features across multiple languages or frameworks
46
+ - The connectivity concern is owned by infrastructure teams or another specialized team
47
+ - You need to reduce the age or complexity of legacy app networking without modifying source code
48
+ - You want to standardize observability and resiliency across polyglot services
49
+
50
+ **WAF Pillars:** Reliability, Security
51
+
52
+ **Related patterns:** Sidecar, Gateway Routing, Gateway Offloading
53
+
54
+ ---
55
+
56
+ ### 2. Anti-Corruption Layer
57
+
58
+ **Implement a façade or adapter layer between a modern application and a legacy system.**
59
+
60
+ **Problem:** During migration, the new system must often integrate with the legacy system's data model or API, which may use outdated schemas, protocols, or design conventions. Allowing the modern application to depend on legacy contracts contaminates its design and limits future evolution.
61
+
62
+ **When to use:**
63
+
64
+ - A migration is planned over multiple phases and the old and new systems must coexist
65
+ - The new system's domain model differs significantly from the legacy system
66
+ - You want to prevent legacy coupling from leaking into modern components
67
+ - Two bounded contexts (DDD) need to communicate but have incompatible models
68
+
69
+ **WAF Pillars:** Operational Excellence
70
+
71
+ **Related patterns:** Strangler Fig, Gateway Routing
72
+
73
+ ---
74
+
75
+ ### 3. Asynchronous Request-Reply
76
+
77
+ **Decouple backend processing from a frontend host, where backend processing needs to be asynchronous but the frontend still needs a clear response.**
78
+
79
+ **Problem:** In many architectures, the client expects an immediate acknowledgement while the actual work happens in the background. The client needs a way to learn the result of the background operation without holding a long-lived connection or repeatedly guessing when processing completes.
80
+
81
+ **When to use:**
82
+
83
+ - Backend processing may take seconds to minutes and the client should not block
84
+ - Client-side code such as a browser app cannot provide a callback endpoint
85
+ - You want to expose an HTTP API where the server initiates long-running work and the client polls for results
86
+ - You need an alternative to WebSocket or server-sent events for status updates
87
+
88
+ **WAF Pillars:** Performance Efficiency
89
+
90
+ **Related patterns:** Competing Consumers, Pipes and Filters, Queue-Based Load Leveling
91
+
92
+ ---
93
+
94
+ ### 4. Backends for Frontends
95
+
96
+ **Create separate backend services to be consumed by specific frontend applications or interfaces.**
97
+
98
+ **Problem:** A general-purpose backend API tends to accumulate conflicting requirements from different frontends (mobile, web, desktop, IoT). Over time the backend becomes bloated and changes for one frontend risk breaking another. Release cadences diverge and the single backend becomes a bottleneck.
99
+
100
+ **When to use:**
101
+
102
+ - A shared backend must be maintained with significant development overhead for multiple frontends
103
+ - You want to optimize each backend for the constraints of a specific client (bandwidth, latency, payload shape)
104
+ - Different frontend teams need independent release cycles for their backend logic
105
+ - A single backend would require complex, client-specific branching logic
106
+
107
+ **WAF Pillars:** Reliability, Security, Performance Efficiency
108
+
109
+ **Related patterns:** Gateway Aggregation, Gateway Offloading, Gateway Routing
110
+
111
+ ---
112
+
113
+ ### 5. Bulkhead
114
+
115
+ **Isolate elements of an application into pools so that if one fails, the others continue to function.**
116
+
117
+ **Problem:** A cloud-based application may call multiple downstream services. If a single downstream becomes slow or unresponsive, the caller's thread pool or connection pool can be exhausted, causing cascading failure that takes down unrelated functionality.
118
+
119
+ **When to use:**
120
+
121
+ - You need to protect critical consumers from failures in non-critical downstream dependencies
122
+ - A single noisy tenant or request type should not degrade service for others
123
+ - You want to limit the blast radius of a downstream fault
124
+ - The application calls multiple services with differing SLAs
125
+
126
+ **WAF Pillars:** Reliability, Security, Performance Efficiency
127
+
128
+ **Related patterns:** Circuit Breaker, Retry, Throttling, Queue-Based Load Leveling
129
+
130
+ ---
131
+
132
+ ### 6. Cache-Aside
133
+
134
+ **Load data on demand into a cache from a data store.**
135
+
136
+ **Problem:** Applications frequently read the same data from a data store. Repeated round trips increase latency and reduce throughput. Data stores may throttle or become expensive under high read loads.
137
+
138
+ **When to use:**
139
+
140
+ - The data store is read-heavy and the same data is requested frequently
141
+ - The data store does not natively provide caching
142
+ - Data can tolerate short periods of staleness
143
+ - You want to reduce cost and latency of repeated reads
144
+
145
+ **WAF Pillars:** Reliability, Performance Efficiency
146
+
147
+ **Related patterns:** Materialized View, Event Sourcing, CQRS
148
+
149
+ ---
150
+
151
+ ### 7. Choreography
152
+
153
+ **Have each component of the system participate in the decision-making process about the workflow of a business transaction, instead of relying on a central point of control.**
154
+
155
+ **Problem:** A central orchestrator can become a single point of failure, a performance bottleneck, or a source of tight coupling. Changes to the workflow require changes to the orchestrator, which may be owned by a different team.
156
+
157
+ **When to use:**
158
+
159
+ - Services are independently deployable and owned by separate teams
160
+ - The workflow changes frequently and a central orchestrator would become a maintenance burden
161
+ - You want to avoid a single point of failure in workflow coordination
162
+ - Services need loose coupling and can react to events
163
+
164
+ **WAF Pillars:** Operational Excellence, Performance Efficiency
165
+
166
+ **Related patterns:** Publisher/Subscriber, Saga, Competing Consumers
167
+
168
+ ---
169
+
170
+ ### 8. Circuit Breaker
171
+
172
+ **Handle faults that might take a variable amount of time to fix when connecting to a remote service or resource.**
173
+
174
+ **Problem:** Transient faults are handled by the Retry pattern, but when a downstream service is unavailable for an extended period, retries waste resources and block callers. Continuing to send requests to a failing service prevents it from recovering and wastes the caller's threads, connections, and compute.
175
+
176
+ **When to use:**
177
+
178
+ - A remote dependency experiences intermittent prolonged outages
179
+ - You need to fail fast rather than make callers wait for a timeout
180
+ - You want to give a failing downstream time to recover before sending more requests
181
+ - You want to surface degraded functionality instead of hard failures
182
+
183
+ **WAF Pillars:** Reliability, Performance Efficiency
184
+
185
+ **Related patterns:** Retry, Bulkhead, Health Endpoint Monitoring, Ambassador
186
+
187
+ ---
188
+
189
+ ### 9. Claim Check
190
+
191
+ **Split a large message into a claim check and payload to avoid overwhelming the messaging infrastructure.**
192
+
193
+ **Problem:** Message brokers and queues often have size limits and charge per message. Sending large payloads (images, documents, datasets) through the messaging channel wastes bandwidth, increases cost, and may hit transport limits.
194
+
195
+ **When to use:**
196
+
197
+ - The message payload exceeds the messaging system's size limit
198
+ - You want to reduce messaging costs by keeping message bodies small
199
+ - Not all consumers need the full payload; some only need metadata
200
+ - You need to protect sensitive payload data by separating access control from the messaging channel
201
+
202
+ **WAF Pillars:** Reliability, Security, Cost Optimization, Performance Efficiency
203
+
204
+ **Related patterns:** Competing Consumers, Pipes and Filters, Publisher/Subscriber
205
+
206
+ ---
207
+
208
+ ### 10. Compensating Transaction
209
+
210
+ **Undo the work performed by a series of steps, which together define an eventually consistent operation.**
211
+
212
+ **Problem:** In distributed systems, multi-step operations cannot rely on traditional ACID transactions. If a later step fails, the previous steps have already committed. The system needs a mechanism to reverse or compensate for the work done by the completed steps.
213
+
214
+ **When to use:**
215
+
216
+ - Multi-step operations span multiple services or data stores that do not share a transaction coordinator
217
+ - You need to maintain consistency when a step in a distributed workflow fails
218
+ - Rolling back is semantically meaningful (refund a charge, release a reservation)
219
+ - The cost of inconsistency outweighs the complexity of compensation logic
220
+
221
+ **WAF Pillars:** Reliability
222
+
223
+ **Related patterns:** Saga, Retry, Scheduler Agent Supervisor
224
+
225
+ ---
226
+
227
+ ### 11. Competing Consumers
228
+
229
+ **Enable multiple concurrent consumers to process messages received on the same messaging channel.**
230
+
231
+ **Problem:** At peak load, a single consumer cannot keep up with the volume of incoming messages. Messages queue up, latency increases, and the system may breach its SLAs.
232
+
233
+ **When to use:**
234
+
235
+ - The workload varies significantly and you need to scale message processing dynamically
236
+ - You require high availability—if one consumer fails, others continue processing
237
+ - Multiple messages are independent and can be processed in parallel
238
+ - You want to distribute work across multiple instances or nodes
239
+
240
+ **WAF Pillars:** Reliability, Cost Optimization, Performance Efficiency
241
+
242
+ **Related patterns:** Queue-Based Load Leveling, Priority Queue, Publisher/Subscriber, Pipes and Filters
243
+
244
+ ---
245
+
246
+ ### 12. Compute Resource Consolidation
247
+
248
+ **Consolidate multiple tasks or operations into a single computational unit.**
249
+
250
+ **Problem:** Deploying each small task or component as a separate service introduces operational overhead: more deployments, monitoring endpoints, and infrastructure cost. Many lightweight components are underutilized most of the time, wasting allocated compute.
251
+
252
+ **When to use:**
253
+
254
+ - Several lightweight processes have low CPU or memory usage individually
255
+ - You want to reduce deployment and operational overhead
256
+ - Processes share the same scaling profile and lifecycle
257
+ - Communication between tasks benefits from being in-process rather than over the network
258
+
259
+ **WAF Pillars:** Cost Optimization, Operational Excellence, Performance Efficiency
260
+
261
+ **Related patterns:** Sidecar, Backends for Frontends
262
+
263
+ ---
264
+
265
+ ### 13. CQRS (Command and Query Responsibility Segregation)
266
+
267
+ **Segregate operations that read data from operations that update data by using separate interfaces.**
268
+
269
+ **Problem:** In traditional CRUD architectures, the same data model is used for reads and writes. This creates tension: read models want denormalized, query-optimized shapes while write models want normalized, consistency-optimized shapes. As the system grows, the shared model becomes a compromise that serves neither concern well.
270
+
271
+ **When to use:**
272
+
273
+ - Read and write workloads are asymmetric (far more reads than writes, or vice versa)
274
+ - Read and write models have different schema requirements
275
+ - You want to scale read and write sides independently
276
+ - The domain benefits from an event-driven or task-based style rather than CRUD
277
+
278
+ **WAF Pillars:** Performance Efficiency
279
+
280
+ **Related patterns:** Event Sourcing, Materialized View, Cache-Aside
281
+
282
+ ---
283
+
284
+ ### 14. Deployment Stamps
285
+
286
+ **Deploy multiple independent copies of application components, including data stores.**
287
+
288
+ **Problem:** A single shared deployment for all tenants or regions creates coupling. A fault in one tenant's workload can affect all tenants. Regulatory requirements may mandate data residency. Scaling the entire deployment for a single tenant's spike is wasteful.
289
+
290
+ **When to use:**
291
+
292
+ - You need to isolate tenants for compliance, performance, or fault isolation
293
+ - Your application must serve multiple geographic regions with data residency requirements
294
+ - You need independent scaling per tenant group or region
295
+ - You want blue/green or canary deployments at the stamp level
296
+
297
+ **WAF Pillars:** Operational Excellence, Performance Efficiency
298
+
299
+ **Related patterns:** Geode, Sharding, Throttling
300
+
301
+ ---
302
+
303
+ ### 15. Edge Workload Configuration
304
+
305
+ **Centrally configure workloads that run at the edge, managing configuration drift and deployment consistency across heterogeneous edge devices.**
306
+
307
+ **Problem:** Edge devices are numerous, heterogeneous, and often intermittently connected. Deploying and configuring workloads individually is error-prone. Configuration drift between devices causes inconsistent behavior and difficult debugging.
308
+
309
+ **When to use:**
310
+
311
+ - You manage a fleet of edge devices running the same workload with differing local parameters
312
+ - Edge devices have intermittent connectivity and must operate independently
313
+ - You need a central source of truth for configuration with local overrides
314
+ - Audit and compliance require tracking which configuration each device is running
315
+
316
+ **WAF Pillars:** Operational Excellence
317
+
318
+ **Related patterns:** External Configuration Store, Sidecar, Ambassador
319
+
320
+ ---
321
+
322
+ ### 16. Event Sourcing
323
+
324
+ **Use an append-only store to record the full series of events that describe actions taken on data in a domain.**
325
+
326
+ **Problem:** Traditional CRUD stores only keep current state—history is lost. Audit, debugging, temporal queries, and replays are impossible without supplementary logging, which is often incomplete or out of sync.
327
+
328
+ **When to use:**
329
+
330
+ - You need a complete, immutable audit trail of all changes
331
+ - The business logic benefits from replaying or projecting events into different views
332
+ - You want to decouple the write model from the read model (often combined with CQRS)
333
+ - You need to reconstruct past states for debugging or regulatory purposes
334
+
335
+ **WAF Pillars:** Reliability, Performance Efficiency
336
+
337
+ **Related patterns:** CQRS, Materialized View, Compensating Transaction, Saga
338
+
339
+ ---
340
+
341
+ ### 17. External Configuration Store
342
+
343
+ **Move configuration information out of the application deployment package to a centralized location.**
344
+
345
+ **Problem:** Configuration files deployed alongside the application binary require redeployment to change. Different environments (dev, staging, prod) need different values. Sharing configuration across multiple services is difficult when each has its own config file.
346
+
347
+ **When to use:**
348
+
349
+ - Multiple services share common configuration settings
350
+ - You need to update configuration without redeploying or restarting services
351
+ - You want centralized access control and audit logging for configuration
352
+ - Configuration must differ across environments but be managed in a single system
353
+
354
+ **WAF Pillars:** Operational Excellence
355
+
356
+ **Related patterns:** Edge Workload Configuration, Sidecar
357
+
358
+ ---
359
+
360
+ ### 18. Federated Identity
361
+
362
+ **Delegate authentication to an external identity provider.**
363
+
364
+ **Problem:** Building and maintaining your own identity store introduces security risks (password storage, credential rotation, MFA implementation). Users must manage separate credentials for each application, leading to password fatigue and weaker security posture.
365
+
366
+ **When to use:**
367
+
368
+ - Users already have identities in an enterprise directory or social provider
369
+ - You want to enable single sign-on (SSO) across multiple applications
370
+ - Business partners need to access your application with their own credentials
371
+ - You want to offload identity management (MFA, password policy) to a specialized provider
372
+
373
+ **WAF Pillars:** Reliability, Security, Performance Efficiency
374
+
375
+ **Related patterns:** Gatekeeper, Valet Key, Gateway Offloading
376
+
377
+ ---
378
+
379
+ ### 19. Gatekeeper
380
+
381
+ **Protect applications and services by using a dedicated host instance that acts as a broker between clients and the application or service.**
382
+
383
+ **Problem:** Services that expose public endpoints are vulnerable to malicious attacks. Placing validation, authentication, and sanitization logic inside the service mixes security concerns with business logic and increases the attack surface if the service is compromised.
384
+
385
+ **When to use:**
386
+
387
+ - Applications handle sensitive data or high-value transactions
388
+ - You need a centralized point for request validation and sanitization
389
+ - You want to limit the attack surface by isolating security checks from the trusted host
390
+ - Compliance requires an explicit security boundary between public and private tiers
391
+
392
+ **WAF Pillars:** Security
393
+
394
+ **Related patterns:** Valet Key, Gateway Routing, Gateway Offloading, Federated Identity
395
+
396
+ ---
397
+
398
+ ### 20. Gateway Aggregation
399
+
400
+ **Use a gateway to aggregate multiple individual requests into a single request.**
401
+
402
+ **Problem:** A client (especially mobile) may need data from multiple backend microservices to render a single page or view. Making many fine-grained calls from the client increases latency (multiple round trips), battery usage, and complexity. The client must understand the topology of the backend.
403
+
404
+ **When to use:**
405
+
406
+ - A client needs to make multiple calls to different backend services for a single operation
407
+ - Network latency between the client and backend is significant (mobile, IoT, remote clients)
408
+ - You want to reduce chattiness and simplify client code
409
+ - Backend services are fine-grained microservices and the client should not know their topology
410
+
411
+ **WAF Pillars:** Reliability, Security, Operational Excellence, Performance Efficiency
412
+
413
+ **Related patterns:** Backends for Frontends, Gateway Offloading, Gateway Routing
414
+
415
+ ---
416
+
417
+ ### 21. Gateway Offloading
418
+
419
+ **Offload shared or specialized service functionality to a gateway proxy.**
420
+
421
+ **Problem:** Cross-cutting concerns such as TLS termination, authentication, rate limiting, logging, and compression are duplicated across every service. Each team must implement, configure, and maintain these features independently, leading to inconsistency and wasted effort.
422
+
423
+ **When to use:**
424
+
425
+ - Multiple services share cross-cutting concerns (TLS, auth, rate limiting, logging)
426
+ - You want to standardize and centralize these features instead of duplicating them per service
427
+ - You need to reduce operational complexity for individual service teams
428
+ - The gateway is already in the request path and adding features there avoids extra hops
429
+
430
+ **WAF Pillars:** Reliability, Security, Cost Optimization, Operational Excellence, Performance Efficiency
431
+
432
+ **Related patterns:** Gateway Aggregation, Gateway Routing, Sidecar, Ambassador
433
+
434
+ ---
435
+
436
+ ### 22. Gateway Routing
437
+
438
+ **Route requests to multiple services using a single endpoint.**
439
+
440
+ **Problem:** Clients must know the addresses of multiple services. Adding, removing, or relocating a service requires client updates. Exposing internal service topology increases coupling and complicates DNS and load balancing.
441
+
442
+ **When to use:**
443
+
444
+ - You want to expose multiple services behind a single URL with path- or header-based routing
445
+ - You need to decouple client URLs from the internal service topology
446
+ - You want to simplify client configuration and DNS management
447
+ - You need to support versioned APIs or blue/green routing at the gateway level
448
+
449
+ **WAF Pillars:** Reliability, Operational Excellence, Performance Efficiency
450
+
451
+ **Related patterns:** Gateway Aggregation, Gateway Offloading, Backends for Frontends
452
+
453
+ ---
454
+
455
+ ### 23. Geode
456
+
457
+ **Deploy backend services into a set of geographical nodes, each of which can service any client request in any region.**
458
+
459
+ **Problem:** Users across the globe experience high latency when all traffic routes to a single region. A single-region deployment also creates a single point of failure and cannot meet data residency requirements for multiple jurisdictions.
460
+
461
+ **When to use:**
462
+
463
+ - Users are globally distributed and expect low-latency access
464
+ - You need active-active multi-region availability
465
+ - Data residency or sovereignty requirements mandate regional deployment
466
+ - A single-region failure should not take down the service globally
467
+
468
+ **WAF Pillars:** Reliability, Performance Efficiency
469
+
470
+ **Related patterns:** Deployment Stamps, Sharding, Cache-Aside, Static Content Hosting
471
+
472
+ ---
473
+
474
+ ### 24. Health Endpoint Monitoring
475
+
476
+ **Implement functional checks in an application that external tools can access through exposed endpoints at regular intervals.**
477
+
478
+ **Problem:** Without health checks, failures are detected only when users report them. Load balancers, orchestrators, and monitoring systems need a programmatic way to determine whether an instance is healthy, ready to accept traffic, and functioning correctly.
479
+
480
+ **When to use:**
481
+
482
+ - You use a load balancer or orchestrator (Kubernetes, App Service) that needs liveness and readiness signals
483
+ - You want automated alerting when a service degrades
484
+ - You need to verify downstream dependencies (database, cache, third-party API) are reachable
485
+ - You want to enable self-healing by removing unhealthy instances from rotation
486
+
487
+ **WAF Pillars:** Reliability, Operational Excellence, Performance Efficiency
488
+
489
+ **Related patterns:** Circuit Breaker, Retry, Ambassador
490
+
491
+ ---
492
+
493
+ ### 25. Index Table
494
+
495
+ **Create indexes over the fields in data stores that are frequently referenced by queries.**
496
+
497
+ **Problem:** Many NoSQL stores support queries efficiently only on the primary or partition key. Queries on non-key fields result in full scans, which are slow and expensive at scale.
498
+
499
+ **When to use:**
500
+
501
+ - Queries frequently filter or sort on non-key attributes
502
+ - The data store does not support secondary indexes natively
503
+ - You want to trade additional storage and write overhead for faster reads
504
+ - Read performance on secondary fields is critical to the user experience
505
+
506
+ **WAF Pillars:** Reliability, Performance Efficiency
507
+
508
+ **Related patterns:** Materialized View, Sharding, CQRS
509
+
510
+ ---
511
+
512
+ ### 26. Leader Election
513
+
514
+ **Coordinate the actions performed by a collection of collaborating instances by electing one instance as the leader that assumes responsibility for managing the others.**
515
+
516
+ **Problem:** Multiple identical instances need to coordinate shared work (aggregation, scheduling, rebalancing). Without coordination, instances may duplicate effort, conflict, or corrupt shared state.
517
+
518
+ **When to use:**
519
+
520
+ - A group of peer instances needs exactly one to perform coordination tasks
521
+ - The leader must be automatically re-elected if it fails
522
+ - You want to avoid a statically assigned coordinator that becomes a single point of failure
523
+ - Distributed locks or consensus are needed for coordination
524
+
525
+ **WAF Pillars:** Reliability
526
+
527
+ **Related patterns:** Scheduler Agent Supervisor, Competing Consumers
528
+
529
+ ---
530
+
531
+ ### 27. Materialized View
532
+
533
+ **Generate prepopulated views over the data in one or more data stores when the data isn't ideally formatted for required query operations.**
534
+
535
+ **Problem:** The normalized storage schema that is optimal for writes is often suboptimal for complex read queries. Joins across tables or services are expensive, slow, and sometimes impossible in NoSQL stores.
536
+
537
+ **When to use:**
538
+
539
+ - Read queries require joining data across multiple stores or tables
540
+ - The read pattern is well-known and relatively stable
541
+ - You can tolerate a short delay between a write and its appearance in the view
542
+ - You want to offload complex query logic from the application tier
543
+
544
+ **WAF Pillars:** Performance Efficiency
545
+
546
+ **Related patterns:** CQRS, Event Sourcing, Index Table, Cache-Aside
547
+
548
+ ---
549
+
550
+ ### 28. Messaging Bridge
551
+
552
+ **Build an intermediary to enable communication between messaging systems that are otherwise incompatible, due to protocol, format, or infrastructure differences.**
553
+
554
+ **Problem:** Organizations may operate multiple messaging systems (RabbitMQ, Azure Service Bus, Kafka, legacy MQ). Applications bound to different brokers cannot exchange messages natively, creating data silos and duplicated effort.
555
+
556
+ **When to use:**
557
+
558
+ - You need to integrate systems that use different messaging protocols or brokers
559
+ - A migration from one messaging platform to another must be gradual
560
+ - You want to decouple producers and consumers from a specific messaging technology
561
+ - Interoperability between cloud and on-premises messaging is required
562
+
563
+ **WAF Pillars:** Cost Optimization, Operational Excellence
564
+
565
+ **Related patterns:** Anti-Corruption Layer, Publisher/Subscriber, Strangler Fig
566
+
567
+ ---
568
+
569
+ ### 29. Pipes and Filters
570
+
571
+ **Decompose a task that performs complex processing into a series of separate elements that can be reused.**
572
+
573
+ **Problem:** Monolithic processing pipelines are difficult to test, scale, and reuse. A single stage's failure brings down the entire pipeline. Different stages may have different scaling needs that cannot be addressed independently.
574
+
575
+ **When to use:**
576
+
577
+ - Processing can be broken into discrete, independent steps
578
+ - Different steps have different scaling or deployment requirements
579
+ - You want to reorder, add, or remove processing stages without rewriting the pipeline
580
+ - Individual steps should be independently testable and reusable
581
+
582
+ **WAF Pillars:** Reliability
583
+
584
+ **Related patterns:** Competing Consumers, Queue-Based Load Leveling, Choreography
585
+
586
+ ---
587
+
588
+ ### 30. Priority Queue
589
+
590
+ **Prioritize requests sent to services so that requests with a higher priority are received and processed more quickly than those with a lower priority.**
591
+
592
+ **Problem:** A standard FIFO queue treats all messages equally. High-priority messages (payment confirmations, alerts) wait behind low-priority messages (reports, analytics), degrading the experience for critical operations.
593
+
594
+ **When to use:**
595
+
596
+ - The system serves multiple clients or tenants with different SLAs
597
+ - Certain message types must be processed within tighter time bounds
598
+ - You need to guarantee that premium or critical workloads are not starved
599
+ - Different priorities map to different processing costs or deadlines
600
+
601
+ **WAF Pillars:** Reliability, Performance Efficiency
602
+
603
+ **Related patterns:** Competing Consumers, Queue-Based Load Leveling, Throttling
604
+
605
+ ---
606
+
607
+ ### 31. Publisher/Subscriber
608
+
609
+ **Enable an application to announce events to multiple interested consumers asynchronously, without coupling the senders to the receivers.**
610
+
611
+ **Problem:** A service that must notify multiple consumers directly becomes tightly coupled to each consumer. Adding a new consumer requires changing the producer. Synchronous calls from the producer to each consumer increase latency and reduce availability.
612
+
613
+ **When to use:**
614
+
615
+ - Multiple consumers need to react to the same event independently
616
+ - Producers and consumers should evolve independently
617
+ - You need to add new consumers without modifying the producer
618
+ - The system benefits from temporal decoupling (consumers process events at their own pace)
619
+
620
+ **WAF Pillars:** Reliability, Security, Cost Optimization, Operational Excellence, Performance Efficiency
621
+
622
+ **Related patterns:** Choreography, Competing Consumers, Event Sourcing, Queue-Based Load Leveling
623
+
624
+ ---
625
+
626
+ ### 32. Quarantine
627
+
628
+ **Ensure external assets meet a team-agreed quality level before being authorized for consumption.**
629
+
630
+ **Problem:** External artifacts (container images, packages, data files, IaC modules) may contain vulnerabilities, malware, or misconfigurations. Consuming them without validation exposes the system to supply-chain attacks and compliance violations.
631
+
632
+ **When to use:**
633
+
634
+ - You consume third-party container images, packages, or libraries
635
+ - Compliance requires scanning artifacts before deployment
636
+ - You want to gate promotion of artifacts through quality tiers (untested → tested → approved)
637
+ - You need traceability for which version of an external asset is deployed
638
+
639
+ **WAF Pillars:** Security, Operational Excellence
640
+
641
+ **Related patterns:** Gatekeeper, Gateway Offloading, Pipes and Filters
642
+
643
+ ---
644
+
645
+ ### 33. Queue-Based Load Leveling
646
+
647
+ **Use a queue that acts as a buffer between a task and a service it invokes, to smooth intermittent heavy loads.**
648
+
649
+ **Problem:** Spikes in demand can overwhelm a service, causing throttling, errors, or outages. Over-provisioning to handle peak load wastes resources during normal periods.
650
+
651
+ **When to use:**
652
+
653
+ - The workload is bursty but the backend service scales slowly or is expensive to over-provision
654
+ - You need to decouple the rate at which work is submitted from the rate at which it is processed
655
+ - You want to flatten traffic spikes without losing requests
656
+ - Temporary unavailability of the backend should not result in data loss
657
+
658
+ **WAF Pillars:** Reliability, Cost Optimization, Performance Efficiency
659
+
660
+ **Related patterns:** Competing Consumers, Priority Queue, Throttling, Bulkhead
661
+
662
+ ---
663
+
664
+ ### 34. Rate Limiting
665
+
666
+ **Control the rate of requests a client or service can send to or receive from another service, to prevent overconsumption of resources.**
667
+
668
+ **Problem:** Without rate limiting, a misbehaving or compromised client can exhaust backend resources, causing service degradation for all consumers. Uncontrolled traffic can also trigger cloud provider throttling or incur excessive costs.
669
+
670
+ **When to use:**
671
+
672
+ - You need to protect shared resources from overconsumption
673
+ - You want to enforce fair usage across tenants or clients
674
+ - The backend has known capacity limits and you want to stay below them
675
+ - You need to prevent cascade failures caused by sudden traffic surges
676
+
677
+ **WAF Pillars:** Reliability
678
+
679
+ **Related patterns:** Throttling, Bulkhead, Circuit Breaker, Queue-Based Load Leveling
680
+
681
+ ---
682
+
683
+ ### 35. Retry
684
+
685
+ **Enable an application to handle anticipated, temporary failures when it tries to connect to a service or network resource, by transparently retrying a failed operation.**
686
+
687
+ **Problem:** Cloud environments experience transient faults—brief network glitches, service restarts, temporary throttling. If the application treats every failure as permanent, it unnecessarily degrades the user experience or triggers costly failovers.
688
+
689
+ **When to use:**
690
+
691
+ - The failure is likely transient (HTTP 429, 503, timeout)
692
+ - Retrying the same request is idempotent or safe
693
+ - You want to improve resilience without complex failover infrastructure
694
+ - The downstream service is expected to recover within a short window
695
+
696
+ **WAF Pillars:** Reliability
697
+
698
+ **Related patterns:** Circuit Breaker, Bulkhead, Ambassador, Health Endpoint Monitoring
699
+
700
+ ---
701
+
702
+ ### 36. Saga
703
+
704
+ **Manage data consistency across microservices in distributed transaction scenarios.**
705
+
706
+ **Problem:** Traditional distributed transactions (two-phase commit) are not feasible across microservices with independent databases. Without a coordination mechanism, partial failures leave the system in an inconsistent state.
707
+
708
+ **When to use:**
709
+
710
+ - A business operation spans multiple microservices, each with its own data store
711
+ - You need eventual consistency with well-defined compensating actions
712
+ - Two-phase commit is not available or would introduce unacceptable coupling
713
+ - Each step can be reversed by a compensating transaction
714
+
715
+ **WAF Pillars:** Reliability
716
+
717
+ **Related patterns:** Compensating Transaction, Choreography, Scheduler Agent Supervisor, Event Sourcing
718
+
719
+ ---
720
+
721
+ ### 37. Scheduler Agent Supervisor
722
+
723
+ **Coordinate a set of distributed actions as a single operation. If any of the actions fail, try to handle the failures transparently, or else undo the work that was performed.**
724
+
725
+ **Problem:** Distributed workflows involve multiple steps across different services. You need a way to track progress, detect failures, retry or compensate, and ensure the workflow reaches a terminal state.
726
+
727
+ **When to use:**
728
+
729
+ - A workflow spans multiple remote services that must be orchestrated
730
+ - You need centralized monitoring and control of workflow progress
731
+ - Failures should be retried or compensated automatically
732
+ - The workflow must guarantee completion or rollback
733
+
734
+ **WAF Pillars:** Reliability, Performance Efficiency
735
+
736
+ **Related patterns:** Saga, Compensating Transaction, Leader Election, Retry
737
+
738
+ ---
739
+
740
+ ### 38. Sequential Convoy
741
+
742
+ **Process a set of related messages in a defined order, without blocking processing of other groups of messages.**
743
+
744
+ **Problem:** Message ordering is required within a logical group (e.g., all events for a single order), but a strict global order would serialize the entire system and destroy throughput. Different groups are independent and can be processed in parallel.
745
+
746
+ **When to use:**
747
+
748
+ - Messages within a group must be processed in order (e.g., order events, session events)
749
+ - Different groups can be processed concurrently
750
+ - Out-of-order processing within a group would cause data corruption or incorrect results
751
+ - You need high throughput across groups while preserving per-group ordering
752
+
753
+ **WAF Pillars:** Reliability
754
+
755
+ **Related patterns:** Competing Consumers, Priority Queue, Queue-Based Load Leveling
756
+
757
+ ---
758
+
759
+ ### 39. Sharding
760
+
761
+ **Divide a data store into a set of horizontal partitions or shards.**
762
+
763
+ **Problem:** A single database server has finite storage, compute, and I/O capacity. As data volume and query load grow, vertical scaling becomes prohibitively expensive or hits hardware limits. A single server is also a single point of failure.
764
+
765
+ **When to use:**
766
+
767
+ - A single data store cannot handle the storage or throughput requirements
768
+ - You need to distribute data geographically for latency or compliance
769
+ - You want to scale horizontally by adding more nodes
770
+ - Different subsets of data have different access patterns or SLAs
771
+
772
+ **WAF Pillars:** Reliability, Cost Optimization
773
+
774
+ **Related patterns:** Index Table, Materialized View, Geode, Deployment Stamps
775
+
776
+ ---
777
+
778
+ ### 40. Sidecar
779
+
780
+ **Deploy components of an application into a separate process or container to provide isolation and encapsulation.**
781
+
782
+ **Problem:** Applications need cross-cutting functionality (logging, monitoring, configuration, networking). Embedding these directly into the application creates tight coupling, language lock-in, and shared failure domains.
783
+
784
+ **When to use:**
785
+
786
+ - The cross-cutting component must run alongside the main application but in isolation
787
+ - The main application and the sidecar can be developed in different languages
788
+ - You want to extend or add functionality without modifying the main application
789
+ - The sidecar has a different lifecycle or scaling requirement than the main application
790
+
791
+ **WAF Pillars:** Security, Operational Excellence
792
+
793
+ **Related patterns:** Ambassador, Gateway Offloading, Compute Resource Consolidation
794
+
795
+ ---
796
+
797
+ ### 41. Static Content Hosting
798
+
799
+ **Deploy static content to a cloud-based storage service that can deliver them directly to the client.**
800
+
801
+ **Problem:** Serving static files (images, scripts, stylesheets, documents) from the application server wastes compute that should be reserved for dynamic content. It also limits scalability and increases cost.
802
+
803
+ **When to use:**
804
+
805
+ - The application serves static files that do not change per request
806
+ - You want to reduce the load on your web servers
807
+ - A CDN can accelerate delivery to geographically distributed users
808
+ - You want cost-effective, highly available static file hosting
809
+
810
+ **WAF Pillars:** Cost Optimization
811
+
812
+ **Related patterns:** Valet Key, Geode, Cache-Aside
813
+
814
+ ---
815
+
816
+ ### 42. Strangler Fig
817
+
818
+ **Incrementally migrate a legacy system by gradually replacing specific pieces of functionality with new applications and services.**
819
+
820
+ **Problem:** Rewriting a large legacy system from scratch is risky, expensive, and often fails. The legacy system must continue operating during the migration. A big-bang cutover is not feasible due to risk and business continuity requirements.
821
+
822
+ **When to use:**
823
+
824
+ - You are replacing a monolithic legacy application incrementally
825
+ - You need the old and new systems to coexist during migration
826
+ - You want to reduce migration risk by delivering value incrementally
827
+ - The legacy system is too large or complex for a single-phase replacement
828
+
829
+ **WAF Pillars:** Reliability, Cost Optimization, Operational Excellence
830
+
831
+ **Related patterns:** Anti-Corruption Layer, Gateway Routing, Sidecar
832
+
833
+ ---
834
+
835
+ ### 43. Throttling
836
+
837
+ **Control the consumption of resources used by an instance of an application, an individual tenant, or an entire service.**
838
+
839
+ **Problem:** Sudden spikes in demand or a misbehaving tenant can exhaust shared resources, degrading the experience for all users. Over-provisioning to handle worst-case load is expensive and wasteful.
840
+
841
+ **When to use:**
842
+
843
+ - You need to enforce SLAs or quotas per tenant in a multi-tenant system
844
+ - The backend has known capacity limits and exceeding them causes instability
845
+ - You want to degrade gracefully under load rather than fail entirely
846
+ - You need to prevent a single workload from monopolizing shared resources
847
+
848
+ **WAF Pillars:** Reliability, Security, Cost Optimization, Performance Efficiency
849
+
850
+ **Related patterns:** Rate Limiting, Bulkhead, Queue-Based Load Leveling, Priority Queue
851
+
852
+ ---
853
+
854
+ ### 44. Valet Key
855
+
856
+ **Use a token or key that provides clients with restricted direct access to a specific resource or service.**
857
+
858
+ **Problem:** Routing all data transfers through the application server creates a bottleneck and increases cost. Giving clients direct access to the data store without any restriction is a security risk.
859
+
860
+ **When to use:**
861
+
862
+ - You want to minimize the load on the application server for data-intensive transfers (uploads/downloads)
863
+ - You need to grant time-limited, scope-limited access to a specific resource
864
+ - You want to offload transfer bandwidth to a storage service (Blob Storage, S3)
865
+ - Clients need temporary access without full credentials to the data store
866
+
867
+ **WAF Pillars:** Security, Cost Optimization, Performance Efficiency
868
+
869
+ **Related patterns:** Gatekeeper, Static Content Hosting, Federated Identity
870
+
871
+ ---
872
+
873
+ > Source: [Azure Architecture Center — Cloud Design Patterns](https://learn.microsoft.com/en-us/azure/architecture/patterns/)