Cloud Design Patterns Flashcards
What is the key to architecting cloud services?
Decomposition of monoliths.
Such services communicate through APIs or by using asynchronous messaging or eventing.
Applications scale horizontally, adding new instances as demand requires.
What is an architecture style?
An architecture style is a family of architectures that share certain characteristics.
For example, N-Tier is a common architecture style.
More recently, microservice architectures have started to gain popularity.
Architecture styles don’t require the use of particular technologies, but some technologies are well-suited for certain architectures. For example, containers are a natural fit for microservices.
Architecture styles as constraints
An architecture style places constraints on the design, including the set of elements that can appear and the allowed relationships between those elements.
Constraints guide the “shape” of an architecture by restricting the range of choices.
What are some of the constraints in microservices?
A service represents a single responsibility
Every service is independent of others
Data is private to the service that owns it, services do not share data
What are the 7 main cloud architectures?
1) N-tier
2) Web-Queue-Worker
3) Microservices
4) Event-driven architecture
5) Big data
6) Big compute
7) CQRS
What is N-tier?
N-tier is a traditional architecture for enterprise applications. Dependencies are managed by dividing the application/service into layers that perform logical functions such as presentation, business, logic and data.
It is a natural fit for migrating existing applications that already use a layered architecture. It’s most often seen in IaaS
What is Web-Queue-Worker?
For a purely PaaS solution, consider a Web-Queue-Worker architecture.
The app has a web front end that handles HTTP requests and a backend worker that performs CPU-intensive/long running tasks.
The front end communicates to the worker through an asynchronous message queue.
Like N-tier, it’s easy to understand.
With complex domains, it can be hard to manage dependencies.
Both the front and back end can easily become large monolithic components that are hard to maintain and update. As with N-tier, this architecture can reduce the frequency of updates and limit innovation.
What is microservice architecture?
A microservices application is composed of many small independent services. Each service implements a single business capability. Services are loosely coupled, communicating through API contracts.
Individual services can be deployed without a lot of coordination between teams, which encourages frequent updates. It’s a lot more complex to build and manage than n-tier or web-queue-worker. It requires a mature development and DevOps culture but done right it can lead to higher release velocity, faster innovation and a more resilient architecture.
What is Event-driven architecture?
This uses a publish-subscribe model, where producers publish events and consumers subscribe to them.
Producers are separate from consumers, and consumers are separate from customers.
Useful for when different subsystems must perform different types of processing on the same event data or for applications that ingest and process a large volume of data with very low latency such as IoT solutions.
Data is routed through an event router to direct events to the correct service.
What is Big Data architecture?
Big data divides a very large dataset into chunks, performing parallel processing across the entire set for analysis and reporting.
This may leverage clusters of systems, distributed processing and data locality principles.
Machine learning is usually employed to process and analyse the data
These may not operate in real time
What is Big Compute architecture?
Big compute - aka HPC (high-performance computing) - makes parallel computations across a large number (thousands) of cores
Usually used in simulations, modeling, 3-D rendering and machine learning training.
This may used specialised hardware such as GPUs, TPUs or ASICs.
What is Command and Query responsibility segregation (CQRS) architecture?
This separates read and write operations into separate models.
This isolates the parts of the system that update data from the parts that read the data.
Read and write databases are physically separated from each other. That lets you scale the read and write workloads independently.
These make the most sense when it’s applied to a subsystem of a larger architecture.
What are layers in N-Tier?
Layers are a way to separate responsibilities and manage dependencies. Each layer has a specific responsibility.
Are tiers physically seperated?
Yes, tiers may be physically separated, running on separate machines.
How do tiers communicate?
A tier can call to another tier directly, or use asynchronous messaging (message queue). Although each layer might be hosted in its own tier, that’s not required.
How does a closed architecture work in N-Tier?
In a closed layer architecture, a layer can only call the next later immediately down.
A closed layer arch limits the dependencies between layers. However, it might create unnecessary network traffic since one layer simply passes requests along to the next layer.
How does an open architecture work in N-Tier?
In an open layer architecture a layer can call any of the layers below it
When should N-tier be used?
Simple Web applications
Migrating an on-premises application to Azure with minimal refactoring
Unified development of on-premises and cloud applications
N-tier archs are very common in traditional on-prem applications, so it’s a natural fit for migrating existing workloads to Azure.
What are some of the benefits of N-tier?
Portability between cloud and on-premises, and between cloud platforms
Less learning curve for most developers
Natural evolution from the traditional application model
Open to heterogeneous environment
What are some of the challenges of N-tier?
It’s easy to end up with a middle tier that just does CRUD ops on the database, adding extra latency without doing any useful work.
Monolithic design prevents independent deployment of features
Managing an IaaS application is more work than an application that uses only managed services.
It can be difficult to manage network security in a large system
What are some of the best practices when deploying N-tier?
Consider:
Use of async messaging to decouple tiers
cache semi-static/static data
configure the database tier for high availability
place a web application firewall (WAF) between the front end and the internet
place each tier in its own subnet, and use subnets as a security boundary
restrict access to the data tier by allowing requests only from the middle tier.
What are the core components of Web-Queue-Worker?
A front end that serves client requests
A worker that performs resource-intensive task, long-running workflows or batch jobs
A message queue to enable the web front end to communicate with the worker
What are some of the other components that are commonly incorporated into Web-Queue-Worker architecture?
One or more databases
A cache to store values from the database for quick reads.
A content delivery network (CDN) to serve static content
Remote services such as email or SMS
Identity provider for autherntication
In Web-Queue-Worker, are the web and worker stateful or stateless?
The web and worker are both stateless, session state can be stored in a distributed cache.
Where is long running work done in Web-Queue-Worker?
Any long-running work is done asynchronously by the worker. The worker can be triggered by messages on the queue, or run on a schedule for batch processing.
Is the worker required in Web-Queue-Worker?
The worker is an optional component. If there are no long-running operations, the worker can be omitted.
What might the front end consist of in Web-Queue-Worker?
The front end might consist of a web API. On the client side, the web API can be consumed by a single-page application that makes AJAX calls, or by a native client application
When should you use the Web-Queue-Worker architecture?
It’s typically implemented using managed compute services, either Azure App Service or Azure Cloud Services.