CloudNative I
CloudNative I
Cloud Native –
Introduction; Pillars of Cloud Native; Cloud Native Applications
2
Outline
• Introduction
• Pillars of Cloud Native
• Cloud Native Applications
• Cloud-native Communication Patterns
• Cloud-native Data Patterns
• Cloud-native Resiliency
• Monitoring & Health
• Cloud-native Identity
• Cloud-native Security
• Devops
3
Outline
• Introduction
• Pillars of Cloud Native
• Cloud Native Applications
• Cloud-native Communication Patterns
• Cloud-native Data Patterns
• Cloud-native Resiliency
• Monitoring & Health
• Cloud-native Identity
• Cloud-native Security
• Devops
4
Introduction
Cloud-native architecture and technologies are an approach to designing, constructing, and operating
workloads that are built in the cloud and take full advantage of the cloud computing model.
The Cloud Native Computing Foundation provides the official definition:
• Cloud-native technologies empower organizations to build and run scalable applications in modern, dynamic
environments such as public, private, and hybrid clouds.
• Containers, service meshes, microservices, immutable infrastructure, and declarative APIs exemplify this approach.
These techniques enable loosely coupled systems that are resilient, manageable, and observable.
Combined with robust automation, they allow engineers to make high-impact changes frequently and
predictably with minimal toil.
Cloud native is about speed and agility.
• Business systems are evolving from enabling business capabilities to weapons of strategic transformation that
accelerate business velocity and growth.
• It's imperative to get new ideas to market immediately.
At the same time, business systems have also become increasingly complex with users demanding
more.
• They expect rapid responsiveness, innovative features, and zero downtime.
• Performance problems, recurring errors, and the inability to move fast are no longer acceptable.
Cloud-native systems are designed to embrace rapid change, large scale, and resilience.
5
Company Experience
Netflix Has 600+ services in production. Deploys 100 times per day.
Uber Has 1,000+ services in production. Deploys several thousand times each week.
Outline
• Introduction
• Pillars of Cloud Native
• Cloud Native Applications
• Cloud-native Communication Patterns
• Cloud-native Data Patterns
• Cloud-native Resiliency
• Monitoring & Health
• Cloud-native Identity
• Cloud-native Security
• Devops
8
1. Cloud Infrastructure
2. Containers
3. Microservices
4. Modern Design
5. Backing Services
6. Automation
9
Microservices
Cloud-native systems embrace microservices, a popular architectural style for
constructing modern applications.
Built as a distributed set of small, independent services that interact through a
shared fabric, microservices share the following characteristics:
• Each implements a specific business capability within a larger domain context.
• Each is developed autonomously and can be deployed independently.
• Each is self-contained encapsulating its own data storage technology, dependencies,
and programming platform.
• Each runs in its own process and communicates with others using standard
communication protocols such as HTTP/HTTPS, gRPC, WebSockets, etc.
• They compose together to form an application.
10
Monolithic vs Microservices
Why Microservices?
Microservices provide agility.
Each microservice has an autonomous lifecycle and can evolve
independently and deploy frequently.
• You don't have to wait for a quarterly release to deploy a new feature or
update.
• You can update a small area of a live application with less risk of disrupting the
entire system.
• The update can be made without a full redeployment of the application.
Each microservice can scale independently.
• Instead of scaling the entire application as a single unit, you scale out only
those services that require more processing power to meet desired
performance levels and service-level agreements.
• Fine-grained scaling provides for greater control of your system and helps
reduce overall costs as you scale portions of your system, not everything.
12
Microservice Challenges
Communication
• How will front-end client applications communicate with backed-end core microservices?
− Will you allow direct communication?
− Or, might you abstract the back-end microservices with a gateway facade that provides flexibility, control, and security?
• How will back-end core microservices communicate with each other?
− Will you allow direct HTTP calls that can increase coupling and impact performance and agility?
− Or might you consider decoupled messaging with queue and topic technologies?
Resiliency
• A microservices architecture moves your system from in-process to out-of-process network
communication.
• In a distributed architecture, what happens when Service B isn't responding to a network call from Service
A?
• Or, what happens when Service C becomes temporarily unavailable and other services calling it become
blocked?
Distributed Data
• By design, each microservice encapsulates its own data, exposing operations via its public interface.
• If so, how do you query data or implement a transaction across multiple services?
• Secrets
• How will your microservices securely store and manage secrets and sensitive configuration data?
13
Additional Factors
• In the book, Beyond the Twelve-Factor App, author Kevin Hoffman details each
of the original 12 factors (written in 2011).
• Additionally, he discusses three extra factors that reflect today's modern cloud
application design.
15
Backing Services
Cloud-native systems depend upon many different ancillary resources, such as
data stores, message brokers, monitoring, and identity services. These services
are known as backing services.
16
Backing Services
You could host your own backing services, but then you'd be responsible for
licensing, provisioning, and managing those resources.
Cloud providers offer a rich assortment of managed backing services.
• Instead of owning the service, you simply consume it.
• The cloud provider operates the resource at scale and bears the responsibility for
performance, security, and maintenance.
• Monitoring, redundancy, and availability are built into the service.
• Providers guarantee service level performance and fully support their managed services
- open a ticket and they fix your issue.
• Cloud-native systems favor managed backing services from cloud vendors.
• The savings in time and labor can be significant.
• The operational risk of hosting your own and experiencing trouble can get expensive fast.
17
Backing Services
A best practice is to treat a backing service as an attached resource, dynamically
bound to a microservice with configuration information (a URL and credentials)
stored in an external configuration.
• This guidance is spelled out in the Twelve-Factor Application:.
− Factor #4 specifies that backing services "should be exposed via an addressable URL. Doing so
decouples the resource from the application, enabling it to be interchangeable."
− Factor #3 specifies that "Configuration information is moved out of the microservice and
externalized through a configuration management tool outside of the code."
• With this pattern, a backing service can be attached and detached without code
changes.
• You might promote a microservice from QA to a staging environment.
• You update the microservice configuration to point to the backing services in staging and
inject the settings into your container through an environment variable.
18
Backing Services
Cloud vendors provide APIs for you to communicate with their proprietary backing
services.
• These libraries encapsulate the proprietary plumbing and complexity.
• However, communicating directly with these APIs will tightly couple your code to that
specific backing service.
• It's a widely accepted practice to insulate the implementation details of the vendor API.
• Introduce an intermediation layer, or intermediate API, exposing generic operations to
your service code and wrap the vendor code inside it.
• This loose coupling enables you to swap out one backing service for another or move
your code to a different cloud environment without having to make changes to the
mainline service code.
• Backing services also promote the Statelessness principle from the Twelve-Factor
Application
• Factor #6 specifies that, "Each microservice should execute in its own process, isolated
from other running services. Externalize required state to a backing service such as a
distributed cache or data store."
19
Automation
Cloud-native systems embrace microservices, containers, and modern
system design to achieve speed and agility.
But, that's only part of the story.
• How do you provision the cloud environments upon which these systems run?
• How do you rapidly deploy app features and updates?
• How do you round out the full picture?
Enter the widely accepted practice of Infrastructure as Code, or IaC.
• With IaC, you automate platform provisioning and application deployment.
• You essentially apply software engineering practices such as testing and versioning
to your DevOps practices.
• Your infrastructure and deployments are automated, consistent, and repeatable.
20
Automating Infrastructure
• Tools like Azure Resource Manager, Azure Bicep, Terraform from HashiCorp, enable you to
declaratively script the cloud infrastructure you require.
• Resource names, locations, capacities, and secrets are parameterized and dynamic.
• The script is versioned and checked into source control as an artifact of your project.
• You invoke the script to provision a consistent and repeatable infrastructure across system
environments, such as QA, staging, and production.
• Under the hood, IaC is idempotent, meaning that you can run the same script over and over
without side effects.
• If the team needs to make a change, they edit and rerun the script.
• Only the updated resources are affected.
• In the article, What is Infrastructure as Code, Author Sam Guckenheimer describes how,
"Teams who implement IaC can deliver stable environments rapidly and at scale. They avoid
manual configuration of environments and enforce consistency by representing the desired
state of their environments via code. Infrastructure deployments with IaC are repeatable and
prevent runtime issues caused by configuration drift or missing dependencies. DevOps
teams can work together with a unified set of practices and tools to deliver applications and
their supporting infrastructure rapidly, reliably, and at scale."
21
Automating Deployments
The Twelve-Factor Application, calls for separate steps when transforming
completed code into a running application.
• Factor #5 specifies that "Each release must enforce a strict separation across the build,
release and run stages. Each should be tagged with a unique ID and support the ability
to roll back."
Modern CI/CD systems help fulfill this principle. They provide separate build and
delivery steps that help ensure consistent and quality code that's readily available
to users.
Applying these practices, organizations have radically evolved how they ship
software.
Many have moved from quarterly releases to on-demand updates.
The goal is to catch problems early in the development cycle when they're less
expensive to fix.
The longer the duration between integrations, the more expensive problems
become to resolve.
With consistency in the integration process, teams can commit code changes
more frequently, leading to better collaboration and software quality.
22
1. The developer constructs a feature in their development environment, iterating through what is called
the "inner loop" of code, run, and debug.
2. When complete, that code is pushed into a code repository, such as GitHub or BitBucket.
3. The push triggers a build stage that transforms the code into a binary artifact. The work is implemented
with a Continuous Integration (CI) pipeline. It automatically builds, tests, and packages the application.
4. The release stage picks up the binary artifact, applies external application and environment
configuration information, and produces an immutable release. The release is deployed to a specified
environment. The work is implemented with a Continuous Delivery (CD) pipeline. Each release should
be identifiable. You can say, "This deployment is running Release 2.1.1 of the application."
5. Finally, the released feature is run in the target execution environment. Releases are immutable
meaning that any change must create a new release.
23
Outline
• Introduction
• Pillars of Cloud Native
• Cloud Native Applications
• Cloud-native Communication Patterns
• Cloud-native Data Patterns
• Cloud-native Resiliency
• Monitoring & Health
• Cloud-native Identity
• Cloud-native Security
• Devops
24
Readings
• Architecting Cloud Native .NET Applications for Azure.
https://dotnet.microsoft.com/en-us/download/e-book/cloud-native-
azure/pdf