Compartilhar via


Design Patterns

Design Patterns

The guide contains twenty-four design patterns that are useful in cloud-hosted applications. Each pattern is provided in a common format that describes the context and problem, the solution, issues and considerations for applying the pattern, and an example based on Microsoft Azure. Each pattern also includes links to other related patterns.

The design patterns are allocated to one or more of the following eight categories: availability, data management, design and implementation, messaging, management and monitoring, performance and scalibility, resiliency, and secuity.

Cache-aside Pattern

Data ManagementPerformance & ScalabilityDesign PatternsShow All

Load data on demand into a cache from a data store. This pattern can improve performance and also helps to maintain consistency between data held in the cache and the data in the underlying data store.

Cache-aside Pattern

For more info, see the Cache-aside Pattern.

Circuit Breaker Pattern

ResiliencyDesign PatternsShow All

Handle faults that may take a variable amount of time to rectify when connecting to a remote service or resource. This pattern can improve the stability and resiliency of an application.

Circuit Breaker Pattern

For more info, see the Circuit Breaker Pattern.

Compensating Transaction Pattern

ResiliencyDesign PatternsShow All

Undo the work performed by a series of steps, which together define an eventually consistent operation, if one or more of the operations fails. Operations that follow the eventual consistency model are commonly found in cloud-hosted applications that implement complex business processes and workflows.

Compensating Transaction Pattern

For more info, see the Compensating Transaction Pattern.

Competing Consumers Pattern

MessagingPerformance & ScalabilityDesign PatternsDownload code sampleShow All

Enable multiple concurrent consumers to process messages received on the same messaging channel. This pattern enables a system to process multiple messages concurrently to optimize throughput, to improve scalability and availability, and to balance the workload.

Competing Consumers Pattern

For more info, see the Competing Consumers Pattern.

Compute Resource Consolidation Pattern

Design and ImplementationDesign PatternsDownload code sampleShow All

Consolidate multiple tasks or operations into a single computational unit. This pattern can increase compute resource utilization, and reduce the costs and management overhead associated with performing compute processing in cloud-hosted applications.

Compute Resource Consolidation Pattern

For more info, see the Compute Resource Consolidation Pattern.

Command and Query Responsibility Segregation (CQRS) Pattern

Data ManagementDesign and ImplementationPerformance & ScalabilityDesign PatternsShow All

Segregate operations that read data from operations that update data by using separate interfaces. This pattern can maximize performance, scalability, and security; support evolution of the system over time through higher flexibility; and prevent update commands from causing merge conflicts at the domain level.

CQRS Pattern

For more info, see the Command and Query Responsibility Segregation (CQRS) Pattern.

Event Sourcing Pattern

Data ManagementPerformance & ScalabilityDesign PatternsShow All

Use an append-only store to record the full series of events that describe actions taken on data in a domain, rather than storing just the current state, so that the store can be used to materialize the domain objects. This pattern can simplify tasks in complex domains by avoiding the requirement to synchronize the data model and the business domain; improve performance, scalability, and responsiveness; provide consistency for transactional data; and maintain full audit trails and history that may enable compensating actions.

Event Sourcing Pattern

For more info, see the Event Sourcing Pattern.

External Configuration Store Pattern

Design and ImplementationManagement and MonitoringDesign PatternsDownload code sample

Move configuration information out of the application deployment package to a centralized location. This pattern can provide opportunities for easier management and control of configuration data, and for sharing configuration data across applications and application instances.

External Configuration Store Pattern

For more info, see the External Configuration Store Pattern.

Federated Identity Pattern

SecurityDesign PatternsShow All

Delegate authentication to an external identity provider. This pattern can simplify development, minimize the requirement for user administration, and improve the user experience of the application.

Federated Identity Pattern

For more info, see the Federated Identity Pattern.

Gatekeeper Pattern

SecurityDesign PatternsShow All

Protect applications and services by using a dedicated host instance that acts as a broker between clients and the application or service, validates and sanitizes requests, and passes requests and data between them. This pattern can provide an additional layer of security, and limit the attack surface of the system.

Gatekeeper Pattern

For more info, see the Gatekeeper Pattern.

Health Endpoint Monitoring Pattern

AvailabilityManagement and MonitoringDesign PatternsDownload code sampleShow All

Implement functional checks within an application that external tools can access through exposed endpoints at regular intervals. This pattern can help to verify that applications and services are performing correctly.

Health Endpoint Monitoring Pattern

For more info, see the Health Endpoint Monitoring Pattern.

Index Table Pattern

Data ManagementPerformance & ScalabilityDesign PatternsShow All

Create indexes over the fields in data stores that are frequently referenced by query criteria. This pattern can improve query performance by allowing applications to more quickly retrieve data from a data store.

Index Table Pattern

For more info, see the Index Table Pattern.

Leader Election Pattern

Design and ImplementationResiliencyDesign PatternsDownload code sampleShow All

Coordinate the actions performed by a collection of collaborating task instances in a distributed application by electing one instance as the leader that assumes responsibility for managing the other instances. This pattern can help to ensure that tasks do not conflict with each other, cause contention for shared resources, or inadvertently interfere with the work that other task instances are performing.

Leader Election Pattern

For more info, see the Leader Election Pattern.

Materialized View Pattern

Data ManagementPerformance & ScalabilityDesign PatternsShow All

Generate pre-populated views over the data in one or more data stores when the data is formatted in a way that does not favor the required query operations. This pattern can help to support efficient querying and data extraction, and improve application performance.

Materialized View Pattern

For more info, see the Materialized View Pattern.

Pipes and Filters Pattern

MessagingDesign and ImplementationDesign PatternsDownload code sampleShow All

Decompose a task that performs complex processing into a series of discrete elements that can be reused. This pattern can improve performance, scalability, and reusability by allowing task elements that perform the processing to be deployed and scaled independently.

Pipes and Filters Pattern

For more info, see the Pipes and Filters Pattern.

Priority Queue Pattern

MessagingPerformance & ScalabilityDesign PatternsDownload code sampleShow All

Prioritize requests sent to services so that requests with a higher priority are received and processed more quickly than those of a lower priority. This pattern is useful in applications that offer different service level guarantees to individual types of client.

Priority Queue Pattern

For more info, see the Priority Queue Pattern.

Queue-based Load Leveling Pattern

MessagingAvailabilityPerformance & ScalabilityDesign PatternsShow All

Use a queue that acts as a buffer between a task and a service that it invokes in order to smooth intermittent heavy loads that may otherwise cause the service to fail or the task to timeout. This pattern can help to minimize the impact of peaks in demand on availability and responsiveness for both the task and the service.

Queue-based Load Leveling Pattern

For more info, see the Queue-based Load Leveling Pattern.

Retry Pattern

ResiliencyDesign PatternsShow All

Enable an application to handle temporary failures when connecting to a service or network resource by transparently retrying the operation in the expectation that the failure is transient. This pattern can improve the stability of the application.

Retry Pattern

For more info, see the Retry Pattern.

Runtime Reconfiguration Pattern

Design and ImplementationManagement and MonitoringDesign PatternsDownload code sampleShow All

Design an application so that it can be reconfigured without requiring redeployment or restarting the application. This helps to maintain availability and minimize downtime.

Runtime Reconfiguration Pattern

For more info, see the Runtime Reconfiguration Pattern.

Scheduler Agent Supervisor Pattern

MessagingResiliencyDesign PatternsShow All

Coordinate a set of actions across a distributed set of services and other remote resources, attempt to transparently handle faults if any of these actions fail, or undo the effects of the work performed if the system cannot recover from a fault. This pattern can add resiliency to a distributed system by enabling it to recover and retry actions that fail due to transient exceptions, long-lasting faults, and process failures.

Scheduler Agent Supervisor Pattern

For more info, see the Scheduler Agent Supervisor Pattern.

Sharding Pattern

Data ManagementPerformance & ScalabilityDesign PatternsShow All

Divide a data store into a set of horizontal partitions shards. This pattern can improve scalability when storing and accessing large volumes of data.

Sharding Pattern

For more info, see the Sharding Pattern.

Static Content Hosting Pattern

Data ManagementDesign and ImplementationPerformance & ScalabilityDesign PatternsDownload code sampleShow All

Deploy static content to a cloud-based storage service that can deliver these directly to the client. This pattern can reduce the requirement for potentially expensive compute instances.

Static Content Hosting Pattern

For more info, see the Static Content Hosting Pattern.

Throttling Pattern

AvailabilityPerformance & ScalabilityDesign PatternsShow All

Control the consumption of resources used by an instance of an application, an individual tenant, or an entire service. This pattern can allow the system to continue to function and meet service level agreements, even when an increase in demand places an extreme load on resources.

Throttling Pattern

For more info, see the Throttling Pattern.

Valet Key Pattern

Data ManagementSecurityDesign PatternsDownload code sampleShow All

Use a token or key that provides clients with restricted direct access to a specific resource or service in order to offload data transfer operations from the application code. This pattern is particularly useful in applications that use cloud-hosted storage systems or queues, and can minimize cost and maximize scalability and performance.

Valet Key Pattern

For more info, see the Valet Key Pattern.

Next Topic | Previous Topic | Home | Community

patterns & practices Developer Center