Professional Documents
Culture Documents
Architecture Patterns Online Part2 New
Architecture Patterns Online Part2 New
Architecture Patterns Online Part2 New
Architecture Patterns_Part 2
Khoa Tran
KhoaTND@fsoft.com.vn
TOPIC NAME
Key Recap
• Working software is not enough
Not only Development but also Operation
• Assets : Pattern, Principle, Framework, Build vs Buy, Packaged
Application , Legacy , Framework, Mechanism
• Know the anti-patterns / Avoid Sliver Bullet
• => Design decision is what matter (not the reference arc. , DP,
FW, package…) => Don’t try to memorize, design is think and
mitigate the trade-off
• Every arc must:
Availability (No SPOF)
Performance (SOC/Tech Update/ Right Stack / Async)
& Cross-cutting (?) handle
2
Make it different
• Part 1: Assest
Think Operation ? Think Scale
Key Resource for modern architect
• Part 2: C - day
Containerize / Cloud First / Cloud Native
Cloud Design Pattern
• Part 4: Exam
3
Integration is important
• API with REST(ful) style
- REpresentational State Transfer
• The six constraints are:
– Uniform Interface
– Stateless
– Cacheable
– Client-Server
– Layered System
– Code on Demand (optional)
4
Integration is important
• API is great but…
5
Integration is important
• API is great but…
6
P2P APIs
7
API-led Integration
8
API Led
9
Integration is important
• API Gateway is now high-demand
• Many design consideration to think about
10
Integration is important
• Try yourself API Gateway
• Explore integration plats/mechanisms:
– Mulesoft
– WSO2 microIntegrator
– https://ballerina.io/learn/
11
Architectural styles for
clouds and services
TOPIC NAME
Software services: a
multidisciplinary problem
13
Dimensions of Sw
Engineering for Services
14
SOC and SOA
• Service Oriented Computing is a distributed
programming paradigm for business
applications supporting complex enterprises
16
SOA
17
OMG Standards for SOA
18
Typical topics in SOA
• Model, design, and implement a SOA
• Create an agile, reusable SOA
• Automate business processes by mapping to
the architectural model
• Orchestrate services and execute processes
with the Business Process Execution Language
(BPEL)
• Achieve interoperability within a SOA using
proven standards and best practices
• Secure and govern an enterprise SOA
19
SOA Meta Model
20
Standardizing bodies for SOAs
• W3C (1994)
• OASIS (1993), consortium of former GML
providers, deals with applications using XML
• OMG (1989)
• WS-I (2002), promotes interoperability among
the stack of Web Services specifications"
21
Elements of SOA Design
• Business Modeling
• Service Oriented Architectural Modeling and
Design
• Model Driven assumptions (loose coupling)
• Distributed objects and MOM (Message
Oriented Middleware) for component-based
sw systems
22
Services and SOAs
• A service is a program interacting via message
exchanges
– On Web all messages and service descriptions are
written in XML
• A SOA is a set of deployed services cooperating
in a given task
– Adapt to new services after deployment
23
SOA Reference Architecture
24
Main SOA Standards
25
Oracle Fusion Middleware
SOA Suite
26
TIBCO SOA Suite
27
WSO2 SOA Suite
28
JBOSS SOA Suite
29
Software-as-a-Service (SaaS)
• Definition of SaaS: Internet-based deployment (for access and
management) of commercially available software
• Service managed from “central” locations enabling customers
to access applications remotely via web
• Delivery: one-to-many model (single instance, multi-tenant
architecture) including architecture, pricing, partnering, and
management characteristics
• Centralized updating, which obviates the need for end-users to
download patches and upgrades
• Frequent integration into a larger network of communicating
software—either as part of a mashup or a plugin to a platform
as a service
30
Architectural styles for
clouds and services
TOPIC NAME
Why Cloud ?
• TCO -> cloud movement
• Faster way of doing thing on/with cloud
Scalable with cost effective:
- Vertical scale
- Horizontal scale
32
Think Cloud
• Amazing Services : think of those common
problem (storage, mass ingestion, api
management, security, key-vault, cache,
queue, topic,….)
I share 100 GB
of movies to
10 friends
in 1 month
3:15
I share an 100GB movie to 10 friends in 1 month
Only 1 download / friend
Pick your favorite cloud storage and calculate the expected cost
Nhóm Azure AWS GCP
1 2.3 $
2 1$
3 2.06 $
4 2.09 $
5 0.01 $
6 145 $
7 125 $
Think Cloud
• Cost factor that impact our architect decide
• Compliance !
https://docs.microsoft.com/en-
us/azure/architecture/best-practices/index-
best-practices
https://docs.microsoft.com/en-
us/azure/architecture/browse/?products=azure
&azure_categories=web
Multi Cloud ?
Fundamental:
1. Compute
2. Storage
3. Network
4. Database
5. Security
TOPICME
Definition
• Microservice ?
– Not a group of function
– Not microserver
• Cloud-native ?
– Different with using 100% cloud service
components
– Not only containerization
44
If we ask 10 of our friend
• What is Cloud Native ?
=> Likely 10 to 12 answers
May be offcial
• 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.
Design consideration
+ Resilient
+ Distributed Data
+ Identity
Twelve Factor App + Communication
+ API First
+ Telemetry
+ A&A
Detail: https://docs.microsoft.com/en-us/dotnet/architecture/cloud-native/definition
Microservice
• 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, or AMQP.
– They compose together to form an application.
49
Important Pillars
Company Experience
Netflix Has 600+ services in production. Deploys hundred times per day.
Uber Has 1,000+ services in production. Deploys several thousand times each week.
WeChat Has 3,000+ services in production. Deploys 1,000 times a day.
Design consideration
+ Resilient
+ Distributed Data
+ Identity
Twelve Factor App + Communication
+ API First
+ Telemetry
+ A&A
Detail: https://docs.microsoft.com/en-us/dotnet/architecture/cloud-native/definition
Modern Design
• Twelve Factor App: https://12factor.net/
51
Twelve Factor App
Code is Version Controlled
52
Twelve Factor App
Configuration is Stored in the Environment
53
Twelve Factor App
Build and Run Stages are Separated
54
Twelve Factor App
Services are Exported via Port Binding
55
Twelve Factor App
Processes are Disposable
56
Twelve Factor App
Logs Treated as Event Streams
57
Modern Design ++
• Twelve Factor App
• +3 more:
+ API First : Make everything a service. Assume your code
will be consumed by a front-end client, gateway, or
another service.
+ Telemetry : On a workstation, you have deep visibility
into your application and its behavior. In the cloud, you
don't. Make sure your design includes the collection of
monitoring, domain-specific, and health/system data.
+ A&A : Implement identity from the start. Consider RBAC
features.
58
Modern Design ++
• Twelve Factor App
• +3 more:API First + Telemetry + A&A
• Microservice challenge:
– Communication: from function-call to ?
– Resiliency: from in-process to out-of-process
network
– Distributed Data: how to query data or implement
a transaction across multi services?
– Secrets: how to store & manage services
59
Important Pillars
Company Experience
Netflix Has 600+ services in production. Deploys hundred times per day.
Uber Has 1,000+ services in production. Deploys several thousand times each week.
WeChat Has 3,000+ services in production. Deploys 1,000 times a day.
Design consideration
+ Resilient
+ Distributed Data
+ Identity
Twelve Factor App + Communication
+ API First
+ Telemetry
+ A&A
Detail: https://docs.microsoft.com/en-us/dotnet/architecture/cloud-native/definition
Container
• Containerizing a microservice is simple and
straightforward. The code, its dependencies, and
runtime are packaged into a binary called
a container image. Images are stored in
a container registry, which acts as a repository or
library for images.
• Factor #2 specifies that "Each microservice
isolates and packages its own dependencies,
embracing changes without impacting the entire
system.“
Container Runtime
containerd
CRI-O
Docker
Container Orchestration
Important Pillars
Company Experience
Netflix Has 600+ services in production. Deploys hundred times per day.
Uber Has 1,000+ services in production. Deploys several thousand times each week.
WeChat Has 3,000+ services in production. Deploys 1,000 times a day.
Design consideration
+ Resilient
+ Distributed Data
+ Identity
Twelve Factor App + Communication
+ API First
+ Telemetry
+ A&A
Detail: https://docs.microsoft.com/en-us/dotnet/architecture/cloud-native/definition
Backing Services
• Common services ?
• attached resource, statelessness
?
Important Pillars
Company Experience
Netflix Has 600+ services in production. Deploys hundred times per day.
Uber Has 1,000+ services in production. Deploys several thousand times each week.
WeChat Has 3,000+ services in production. Deploys 1,000 times a day.
Design consideration
+ Resilient
+ Distributed Data
+ Identity
Twelve Factor App + Communication
+ API First
+ Telemetry
+ A&A
Detail: https://docs.microsoft.com/en-us/dotnet/architecture/cloud-native/definition
Automation
• Infra as code
• Policy as code
• X as code
• CI / CD
Release Train vs Taxi
Technology trend…
MSA everywhere
Tons of knowledge areas for tech-lead
SAGA ?
You know what pod is ?
Don’t build MSA for your CV
MSA is also an architecture whose value comes
from managing change. If there is no change in
the system, the loosely coupled, independently
deployed and distributed nature of the
architecture is adding little value. In fact, it
becomes overhead
Think of Delivery capability
Why platform team ?
Keep attention on Cncf
• Trail Map :
https://github.com/cncf/landscape/blob/mast
er/README.md#trail-map
• Landscape:
https://landscape.cncf.io
As developer where to start…
• Dapr
The shift of focus
• Performance
• Scale
• Reliability
• Latency
Cloud Design Pattern
Pattern Pattern Pattern
Ambassador CQRS Materialized View
Anti-Corruption Layer Deployment Stamps Pipes and Filters
Asynchronous Request-Reply Event Sourcing Priority Queue
Backends for Frontends External Configuration Store Publisher/Subscriber
Bulkhead Federated Identity Queue-Based Load Leveling
Cache-Aside Gatekeeper Retry
Choreography Gateway Aggregation Scheduler Agent Supervisor
Circuit Breaker Gateway Offloading Sequential Convoy
Claim Check Gateway Routing Sharding
Compensating Transaction Geodes Sidecar
Competing Consumers Health Endpoint Monitoring Static Content Hosting
Compute Resource Consolidation Index Table Strangler Fig
Leader Election Throttling
Valet Key
Circuit Breaker
- Compliment with Retry Pattern
Command / Query / Event
CQRS
• When we need two model ?
Sharding
SAGA
• Choreography vs Orchestration
• Problem of 2PC
TOPIC NAME
Not a memorize issue
Final Exam
• Open Topic
1.Big Picture of solution (Context / container
/component)
2.Use Case Diagram (All functions)
3.Architect that scale (Logical & Physical diagram)
4.Key function & problem (Non functional)
– Cloud Design Pattern that solve (3)
• 3 - 4 members: 2 pattern : 10 mins
• > 4 members: 4 pattern : 15 mins
Final Exam
• Closed Topic
What if you are the CTO that started building the
following company:
Netflix
Uber
WeChat
Can you pitch the architect with the implementation
team ? What do you pitch ? > 3 items