Thursday, June 25, 2020

Azure Cloud Design Patterns

Cloud applications have a unique set of characteristics. They deal with unpredictable workloads, run on commodity hardware, and provide services to untrusted users. These factors impose a range of problems. When building and designing applications for the cloud you need to overcome a lot of challenges, like working with configuration, authentication, and authorization.

Apart from being user-friendly, your applications must also be resilient so that they can recover from failures, secure to protect services from malicious attacks, and elastic in order to respond to an ever-changing workload. Design patterns help you address these challenges and solve the problems you might encounter in many different areas of cloud application development.

A design pattern is a solution, that can be used repeatedly, to address a commonly occurring problem in software design. It is not a finished design that can be transformed directly into code rather it is a template or a guideline for solving a problem that can be used in many different situations.

Cloud design patterns are useful for building reliable, scalable, secure applications in the cloud. Each pattern for Azure discusses the design considerations and contains code samples or snippets to explain how it can be implemented on Microsoft Azure. Most of the design patterns can be used for any distributed system, whether hosted on Azure or on other cloud platforms.

Categories of Azure Design Patterns
The design patterns are majorly grouped into eight categories based on the faced in cloud development:

Availability
Availability is referred to the proportion of time that the system is working and fully functional. It is usually measured as a percentage of uptime. Availability can get negatively impacted by system errors, system load, infrastructure problems, and malicious attacks.

Data Management
Being the key element of cloud applications, Data management influences most of the quality attributes of the cloud apps. In today’s era of distributed systems, data is typically hosted across multiple servers, and in different locations to improve performance, scalability or availability. This, by virtue of its nature, can pose a range of challenges. Therefore, design patterns for such challenges typically address problems related data consistency, data organization, data synchronization, etc.

Design and Implementation
Good design takes into consideration several factors such as coherence and consistency in component design and deployment, maintainability to simplify administration and development, and reusability to allow components to be used in other applications and scenarios. Decisions taken during the design and implementation phase can hugely impact the quality and the total cost of ownership of cloud-hosted applications and services.

Messaging
Cloud applications are mostly distributed in nature that requires a messaging infrastructure which can connect the components and services to maximize scalability. Asynchronous messaging is the commonly used infrastructure. However, it also brings many challenges such as the poison message management, ordering of messages, idempotency, etc. Therefore, standardized design patterns come into play to solve the problems that arise due to the messaging infrastructure.

Management and Monitoring
Cloud applications run in a remote datacenter. As a result, you do not have full control of the infrastructure or, in some cases, the operating system, which makes management and monitoring difficult than an on-premises deployment. Therefore, applications need to expose runtime information that administrators and operators can use to manage and monitor the system, as well as facilitating and supporting changing business requirements without requiring the application to be stopped or redeployed.

Performance and Scalability
Performance indicates the responsiveness of a system to execute any action within a given period of time, while scalability determines the ability of a system to handle increased load without impact on performance. Variable workloads and peaks in activity are typical of cloud applications and hence they demand design patterns that can keep them ready to scale out and and scale in to meet troughs and crests in demand.

Resiliency
Resiliency is the capacity of a system to recover quickly from failures. The multi-tenant cloud hosted applications use shared platform services, run on commodity hardware, compete for resources and bandwidth, and communicate over the Internet, which means there is an increased chance of both transient and more permanent faults. Hence, detecting failures, and recovering rapidly and efficiently, is essential to maintain resiliency.

Security
Security is a critical element for cloud applications as it is essential to prevent malicious or accidental attempts outside of the designed usage, and to prevent disclosure of information or data breaches. By nature, cloud applications are exposed on the Internet outside trusted on-premises boundaries and often serve untrusted users. Therefore applications need to be designed and deployed in a way that protects sensitive data, restricts access to only approved users, and protects them from malicious attacks.

Cloud Design Patterns
Now that we know the importance and categories of Azure cloud design patterns, let’s have a look at the core thematic list of 24 Microsoft Azure cloud design patterns:

  1. Cache-Aside – Loads data on demand into a cache from a data store.
  2. CQRS – Segregates operations that read data from operations used to update data by using separate interfaces.
  3. Circuit Breaker – Handles failures or faults that take a variable amount of time to fix when connecting to a remote service or resource.
  4. Compute Resource Consolidation – Consolidates multiple operations or tasks into a single computational unit.
  5. Compensating Transaction – Used to undo the work performed by a series of steps.
  6. Competing Consumers – Allows multiple concurrent consumers to process messages received on the same messaging channel.
  7. Event Sourcing – Records the full series of events that describe actions taken on data in a domain using an append-only store.
  8. Gatekeeper – This design pattern basically protects applications using a dedicated host instance that acts as a broker between the application and clients, validates requests, and passes requests and data between them.
  9. Federated Identity – Helps to delegate authentication to an external identity provider.
  10. External Configuration Store – Facilitates moving configuration information out of the application deployment package to a centralized location.
  11. Health Endpoint Monitoring – Implements functional checks in an application that can be accessed by external tools through exposed endpoints at regular intervals.
  12. Materialized View – Helps to generate prepopulated views over the data in one or more data stores.
  13. Index Table – Creates indexes over the frequently referenced fields in data stores.
  14. Leader Election – Elects one instance as the leader to manage and coordinate the actions performed by a collection of collaborating tasks in a distributed application.
  15. Valet Key – Uses a key or token which provides clients with restricted direct access to a specific resource or service.
  16. Pipes and Filters – This pattern lets you break down a complex processing task into a series of separate elements that can be reused.
  17. Throttling – This Azure design pattern controls the consumption of resources used by an entire service, an individual tenant, or an instance of an application.
  18. Priority Queue – As the name suggests, it prioritizes requests sent to services to ensure that higher priority requests are received and processed faster than those with a lower priority.
  19. Runtime Reconfiguration – Used to design an application to simplify its reconfiguration without the need of redeployment or restart.
  20. Sharding – This simply means dividing a data store into a set of horizontal partitions or shards.
  21. Queue-Based Load Leveling – Uses a queue that acts as a buffer between a task and a service to surface smooth intermittent heavy loads.
  22. Scheduler Agent Supervisor – This solution helps to coordinate among an array of actions across a distributed set of services and other remote resources.
  23. Retry – Allows an application to handle anticipated, temporary failures by retrying an operation that has previously failed.
  24. Static Content Hosting – As indicated by the name, this design pattern deploys static content to a cloud-based storage service so that the content can be delivered directly to the client.

Conclusion
Design patterns offer guidance and provide best practice solutions to the common problems faced during designing cloud-hosted applications. As you have seen, Azure Cloud Design Patterns are rich in useful content, therefore, a foundational knowledge of the design patterns will help you to design and build modern cloud-based applications seamlessly and with precision.

No comments:

Post a Comment