Cloud Design Patterns Flashcards

1
Q

What is the key to architecting cloud services?

A

Decomposition of monoliths.

Such services communicate through APIs or by using asynchronous messaging or eventing.

Applications scale horizontally, adding new instances as demand requires.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an architecture style?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Architecture styles as constraints

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are some of the constraints in microservices?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the 7 main cloud architectures?

A

1) N-tier
2) Web-Queue-Worker
3) Microservices
4) Event-driven architecture
5) Big data
6) Big compute
7) CQRS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is N-tier?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is Web-Queue-Worker?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is microservice architecture?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is Event-driven architecture?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is Big Data architecture?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is Big Compute architecture?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is Command and Query responsibility segregation (CQRS) architecture?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are layers in N-Tier?

A

Layers are a way to separate responsibilities and manage dependencies. Each layer has a specific responsibility.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Are tiers physically seperated?

A

Yes, tiers may be physically separated, running on separate machines.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do tiers communicate?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How does a closed architecture work in N-Tier?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How does an open architecture work in N-Tier?

A

In an open layer architecture a layer can call any of the layers below it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

When should N-tier be used?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What are some of the benefits of N-tier?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What are some of the challenges of N-tier?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What are some of the best practices when deploying N-tier?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What are the core components of Web-Queue-Worker?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What are some of the other components that are commonly incorporated into Web-Queue-Worker architecture?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

In Web-Queue-Worker, are the web and worker stateful or stateless?

A

The web and worker are both stateless, session state can be stored in a distributed cache.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

Where is long running work done in Web-Queue-Worker?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Is the worker required in Web-Queue-Worker?

A

The worker is an optional component. If there are no long-running operations, the worker can be omitted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What might the front end consist of in Web-Queue-Worker?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

When should you use the Web-Queue-Worker architecture?

A

It’s typically implemented using managed compute services, either Azure App Service or Azure Cloud Services.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

When should you consider Web-Queue-Worker?

A

You should consider it for:
Applications with a relatively simple domain

Applications with some long-running workflows or batch operations

When you want to use manages services, rather than infrastructure as a service (IaaS).

30
Q

What are some of the benefits of Web-Queue-Worker?

A

Relatively simple architecture that is easy to understand

Easy to deploy and manage

Clear separation of concerns

The front end is decoupled from the worker using asynchronous messaging.

The front end and the worker can be scaled independently.

31
Q

What are some of the challenges that Web-Queue-Worker faces?

A

If not carefully designed, the front end and the worker can become large monolithic components that are difficult to maintain and update.

There may be hidden dependencies, if the front end and worker share data schemas or code modules.

32
Q

What are some of the best practices for web-queue-worker?

A

Expose a well-designed API to the client.

Autoscale to handle changes in load.

Cache semi-static data. Use a CDN to host static content

Use polyglot persistence when appropriate; use the best data store for the job

Partition data to improve scalability, reduce contention and optimise performance.

33
Q

What are some additional considerations in Web-Queue-Worker?

A

Not every transaction has to go through the queue and worker to storage. The web front end can perform simple read/write operations directly.

Workers are designed for resource-intensive tasks or long-running workflows. In some cases, you might not need a worker at all.

34
Q

What is the management/orchestration component responsible for in the microservices architecture?

A

This component is responsible for placing services on node, identifying failures, rebalancing services across nodes, and so forth. Typically this component is an off-the-shelf technology such as Kubernetes, rather than something custom built.

35
Q

What is the API Gateway responsible for in microservices architecture?

A

The API Gateway is the entry point for clients. Instead of calling service directly, clients call the API gateway which forwards the call to the appropriate services on the back end.

36
Q

What are some of the advantages in API Gateways with microservices architecture?

A

It decouples clients from services. Services can be versioned or refactored without needing to update all of the clients.

Services can use messaging protocols that are not web friendly.

The API Gateway can perform other cross-cutting functions such as authentication, logging, SSL termination and load buffering.

37
Q

What are some of the benefits of microservices?

A

Agility - because microservices are deployed independently, it’s easier to manage bug fixes and feature releases. You can update a service without redeploying the entire application and roll back an update if something goes wrong.

Mix of technologies - teams can pick the technology that best fits their service, using a mix of technology stacks as appropriate.

Fault isolation - if an individual microservice become unavailable, it won’t disrupt the entire application, as long as any upstream microservices are designed to handle faults correctly

Small code base - by not sharing code or data stores, a microservices arch minimises dependencies and that makes it easier to add new features.

38
Q

What are some of the challenges of microservices architecture?

A

Complexity - it has more moving parts that monolithic applications. Each service is simpler, but the entire system as a whole is more complex.

Development and testing - writing a small service that relies on other dependent services requires a different approach than writing a traditional monolithic or layered application.

Lack of governance - you may end up with so many different languages and frameworks that the application becomes hard to maintain

Data integrity - each microservice is responsible for its own data persistence

Management - success requires a mature DevOps culture.

Network congestions and latency - small services can result in more interservice communication

Versioning - updates to a service must not break services that depend on it

Skill set - teams may not have the skills and experience needed to be successful

39
Q

What is the first kind of approach for Event Driven Architecture?

A

Publishers + Subscribers

The messaging infrastructure keeps track of subscriptions
When an event is published, it sends the event to each subscriber
After an event is received, it cannot be replayed
New subscribers do not see the event

40
Q

How are events delivered in the first approach for Event Driven Architecture?

A

Events are delivered in near real time, so consumers can respond immediately to events as they occur. These have some characteristics.

Producers are decoupled from consumers
A producer typically doesn’t know which consumers are listening
Consumers are also decoupled from each other
Every consumer sees all of the events
In some systems, such as IoT, events must be ingested at very high volumes

41
Q

What is the second kind of approach for Event Driven Architecture?

A

Events are written to a log
Events are strictly ordered and durable
Clients don’t subscribe to a stream, instead they can read from any part of a stream
The client is responsible for advancing its positions in the stream. That means a client can join at any time, and can replay events.

42
Q

What are the three variations of processing for Event Driven Architecture?

A

Simple event processing
Complex event processing
Event stream processing

43
Q

What is simple event processing in Event Driven Architecture?

A

An event immediately triggers an action in the consumer

44
Q

What is complex event processing in Event Driven Architecture?

A

A consumer processes a series of event, looking for patterns in the event media data. This may involve a technology such as Azure Stream Analytics or Apache Storm. For example, you could aggregate readings from an embedded device over a time window and generate a notification if the moving average crosses a certain threshold.

45
Q

What is event stream processing in Event Driven Architecture?

A

Use a data stream platform, such as Azure IoT Hub or Apache Kafka as a pipeline to ingest events and feed them to stream processors. The Stream processors act to process or transform the stream. There may be multiple stream processors for different subsystems of the applications. The approach is a good fit for IoT workloads.

46
Q

When should you use the Event Driven architecture?

A

Multiple subsystems must process the same events
Real-time processing with minimum time lag
Complex event processing, such as pattern matching or aggregation over time windows
High volume and high velocity of data such as IoT

47
Q

What are some of the benefits of EDA?

A

Producers and customers are decoupled
No point-to-point integrations, easy to add new consumers to the system
Consumers can respond to events immediately as they arrive
Highly scalable and distributed
Subsystems have independent views of the event stream

48
Q

What are some of the challenges of EDA?`

A

Guaranteed Delivery, in some systems it’s crucial that events are delivered
Processing events in order or exactly once, each consumers typically runs multiple instances

49
Q

What kind of workloads do big data solutions typically involve?

A

Big data solutions typically involve one or more of the following workload:

  • Batch processing of big data sources at rest
  • Real time processing of big data in motion
  • Interactive exploration of big data
  • Predictive analytics and machine learning
50
Q

What are some of the common components of big data?

A
  • Data sources
  • Data storage
  • Batch processing
  • Real-time message ingestion
  • Stream processing
  • analytical data store
  • analysis and reporting
  • orchestration
51
Q

What are some of the data sources used in big data?

A

Application data stores like RDBs
Static files produced by applications like log files
Real time data sources like IoT devices

52
Q

What is used for data storage in big data?

A

Data for processing operations is typically held in a distributed file store that can hold high volumes of large files in various formats. This kind of store is often called a data lake.

53
Q

What is batch processing in big data?

A

since data sets are so large, often a big data solution must process data files using long-running batch jobs to filter, aggregate and otherwise prepare the data for analysis.

54
Q

What is real time message ingestion in big data?

A

If the solution has real-time data sources, the arch must capture and store real-time messages for stream processing. This might be a simple data store where incoming messages are dropped into a folder for processing. Many solutions require a message ingestion store, however, to act as a buffer for messages and to support scale-out processing, reliable delivery

55
Q

What is stream processing in big data?

A

After capturing messages, the solution must process them by filtering, aggregating and otherwise preparing the data for analysis.

56
Q

What is the analytical data store in big data?

A

Many big data solutions prepare data for analysis and then serve the processed data in a structured format that can be quired using analytical tools.

57
Q

What is analysis and reporting in big data?

A

The goal of most big data solutions is to provide insights into the data through analysis and reporting. To empower users to analyse the data, the architecture may include a data modelling layer.

58
Q

What is orchestration in big data?

A

Most big data solutions consist of repeated data processing operations, encapsulated in workflows, that transform source data; move data between multiple sources and sinks; load the processed data into an analytical data store; or push the results straight to a report or dashboard

59
Q

When should you use the big data architecture?

A

Consider this style when you need to:

  • Store and process data in volumes too large for a traditional database
  • Transform unstructured data for analysis and reporting
  • Capture, process and analyse unbound streams of data in real time, or with low latency.
60
Q

What are some of the beneifts of big data?

A

Performance through parallelism
Elastic scale - all components support scale-out provisioning and you pay only for the resources that you use
Interoperability with existing solutions

61
Q

What are some of the challenges that big data brings?

A

Complexity, big data solutions can be extremely complex

Skillset, many big data technologies are highly specialized, using languages not typical of more general architectures

Technology maturity, many of the technologies around big data are evolving

62
Q

What senarios are good for big compute?

A

Image rendering

Fluid dynamics

Financial risk modelling

Oil exploration

Drug design

Engineering stress analysis

63
Q

What are some of the typical characteristics of big compute applications?

A

The work can be split into discrete tasks

Each task is finite

The entire application runs for a finite amount of time

The applications does not need to stay up 24/7

For some applications, tasks are independent and can run in parallel.

64
Q

When should you use the big compute architecture?

A

Computationally intensive operations

Simulations that must be split across CPUs in multiple containers

Simulations that require too much memory for one computer

Long running computations

Small computations that must be run 100s or 1000s of times

65
Q

What are some of the benifits of big compute?

A

High performance with parallel processing

Can harness hundreds of thousands of computer cores

Access to specialised high-performance hardware

Ability to provision VMs for a specific task and then tear them down when no longer needed.

66
Q

What are some of the challenges of big compute?

A

Managing the VM infrastructure

Managing the volume of number crunching

Provisioning thousands of cores in a timely manner

For tightly coupled tasks, adding more cores can have diminishing returns.

67
Q

What is the context for CQRS?

A

In traditional architectures. the same data model is used to query and update a database.

This works well for basic CRUD operations. In more complex applications, however this approach can become unwieldy.

For example, on the read side, the application may perform many queries returning DTOs with different shapes. Object mapping can become complicated. On the write side, the model may implement complex validation and business logic. As a result, you can end up with an overly complex model that does too much.

Read and write workloads are often asymmetrical, with very different performance and scale requirements.

68
Q

How can CQRS fix some of the issues of traditional architectures?

A

It separates reads and writes into different models, using commands to update data and queries to read data.

Commands should be task-based, rather than data centric
Commands may be placed on a queue for asynchronous processing, rather than being processed synchronously
Queries never modify the database. A query returns a DTO that does not encapsulate any domain knowledge
For greater isolation, you can physically separate the read data from the write data.
It might even use a different type of data store.

69
Q

What are some of the benefits of CQRS?

A

Independent scaling

Optimised data schemas

Security

Separation of concerns

Simpler queries

70
Q

What are some of the issues and considerations during the implementation of CQRS?

A

Complexity

Messaging

Eventual consistency