Azure Application Architecture Guide

masashin 1,767 views 66 slides Mar 25, 2017
Slide 1
Slide 1 of 66
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66

About This Presentation

Azure Application Architecture Guide Overview


Slide Content

A3G Overview Masashi Narumoto Principal lead PM AzureCAT patterns & practices Azure Application A rchitecture Guide

Traditional vs. Modern application Traditional on-premises Modern cloud Relational database Polyglot persistence Strong consistency Eventual consistency Design for predictable scalability Design for unbound scalability Serial and synchronized processing Parallel and asynchronous processing Monolithic, centralized Decomposed, de-centralized Snowflake servers Immutable infrastructure Integrated authentication Federated authentication Design to keep app running (MTBF) Design for failure (MTTR) Big bang release Frequent small update Manual management Automated self-management

Process of Software development Business alignment Technology alignment

Process of Software development Architecture style guide Design principles Compute selection guide Storage selection guide Best practices Design patterns Design review checklist Business capability Domain driven Data driven End to end traceability

Process of Software development

Analyzing business domain Functional – Domain driven or data centric Ubiquitous language to model business domains Bounded context shows service boundary Context map visualizes to service dependency Aggregate, Domain service/event lead to microservices and inter service comm Non-functional - RTO/RPO/MTO, SLO/SLA, Security, Operation RTO leads to failover period RPO leads to backup interval SLA leads to choice of services w/ level of redundancy Throughput/Latency leads to choice of SKU w/ partitioning and topology Security leads to authN / authZ , encryption (transit, at rest) Operation leads to automated monitoring, management solutions

What if we don’t model around business? Spending too much time on the features nobody’s going to use Wrong assumptions are baked into data and service model Change in technology directly affects service model System is not scalable nor secure SLA target is not met System health is not visible to operators

What if we don’t model around business?

Example – Drone delivery service

Accounts Drone management 3 rd party transportation Call center Video surveillance Drone sharing Drone management Drone sharing 3 rd party transportation Shipping (Core) Call center Shipping Context map – Drone delivery service Surveyllance Accounts

Drone management Accounts Drone sharing 3 rd party transportation Shipping (Core) Call center Context map – Problem and Solution space Surveyllance Accounts Drone management 3 rd party transportation Call center Video surveillance Drone sharing Shipping

Accounts Drone management 3 rd party transportation Call center Video surveillance Drone sharing Drone management Drone sharing 3 rd party transportation Shipping (Core) Call center Shipping Context map – Drone delivery service Surveyllance Shipping Accounts

A ggregates and services in shipping domain Shipping Drone Package Delivery DeliveryScheduler DeliverySupervisor Account 3 rd party transportation Authentication Aggregate Domain service

Non-functional requirements – Shipping 10K to 100K rps to delivery scheduler 1M write/sec to geospatial index (geo-data / 4 sec / drone) Latency in 99 percentile has to be within 1 sec 99.99% uptime for delivery scheduler Daily update for ETA/Drone optimization algorithm CI/CD to support daily deployment Recovery time objective (RTO) should be 10 mins Recovery point objective should be an hour Drones and PII need to be protected from malicious attack Monitor the system for RCA and system health

Process of Software development

Choosing architecture style Domain Model Monolith? Microservices? CQRS? Web-queue-worker?

What if we don’t c hoose right architecture?

Architecture imposes constraints f or desirable outcome

Constraints in microservices - A service represents a single responsibility - Services don’t share its data Service calls only via API Every service has to be independently deployable R elease pipeline has to be de-centralized

Applying architecture style Business Domain Data access Business logic API

Choosing architecture style Business domain (Functional, Non-functional) Type/Complexity of domain Prerequisites Skillset, Team, Culture Benefits vs. Challenges Does benefits justify taking challenges? Degree of conformity Purist vs. Pragmatist

When to choose Microservices? Benefits Independent deployment Fault isolation Diverse technology Small focused team Separate scalability Challenges Complexity Network congestion Data integrity/consistency Testing Reliability Business domain Complex domain Deployment at high velocity Many independent teams Prerequisites Skill set for distributed system Domain knowledge DevOps culture M onitoring capability

Degree of distribution Monolith (Big ball of mud) microservices Corse grained Somewhat decomposed

Choosing architecture styles Dependency management Domain type/complexity N-Tier+ Horizontal layers (open/close) Traditional business domain Frequency of update is low Web-Queue-Worker Front/Backend jobs Decoupled by async messaging Relatively simple domain with some resource intensive tasks Microservices Vertical (functional) decoupling Service calls via API Complicated domain Frequent update is required CQRS R/W segregation Schema/Scale are optimized separately Collaborative domain where lots of users access the same data EDA Data ingested into streaming Independent view per sub-system Internet of things Big data Divide huge dataset into small chunks Parallel processing on local dataset Batch and real-time data analysis Predictive analysis using ML Big compute Data allocation to thousands of cores Embarrassingly parallel processing Compute intensive domain such as simulation, number crunching

User Business logic Polyglot Storage Device Gateway Streaming & analytics Device control Device State & Mgmt Business System Hot & Cold Storage Serving & BI Device API Gateway Web/Mobile application IIoT Data analysis Batch Analysis Near Real-time Analysis Notification Remote Service Cloud application architecture User management

User Business logic Polyglot Storage Device Gateway Streaming & analytics Device control Device State & Mgmt Business System Hot & Cold Storage Serving & BI Device API Gateway Web/Mobile application IIoT Data analysis Batch Analysis Near Real-time Analysis Notification Remote Service User management Microservices Cloud application architecture SPA Event Driven Big data N-Tier Web-Queue-Worker CQRS Big compute Lift & Shift

User Business logic Polyglot Storage Device Gateway Streaming & analytics Device control Device State & Mgmt Business System Hot & Cold Storage Serving & BI Device API Gateway Web/Mobile application IIoT Data analysis Batch Analysis Near Real-time Analysis Notification Remote Service Cloud application architecture User management

N-Tier+ architecture

N−Tier+ architecture Web tier Database Storage Remote service NVA Middle tier 2 Messaging Cache Middle tier 1 Jump Box User Admin

Best practices for N−Tier+ architecture Web tier Database Storage Remote service NVA Middle tier 2 Messaging Cache Middle tier 1 Jump Box User Admin Place multiple NVA for HA Use messaging to decouple tiers Cache semi-static data Protect internet access by NVA Restrict access to data tier Admin tasks via jump box Use separate subnet/availability set per tier with multi VMs Configure redundancy such as SQL AlwaysOn AG

N-Tier+ When to use : Migration scenario with m inimum refactoring from existing app Simple web applications(e.g. admin web site) You need unified development/management across on-premises and cloud Benefits : High portability Less learning curve Natural evolution from traditional model Open to heterogeneous environment (Windows/Linux) Challenges : Monolith prevents independent deployment Manageability is not optimal Versioning of each service running on VMs Configuring network security is not trivial Conforming to industry regulations (e.g. PCI, SOX, HIPPA)

Web-Queue-Worker architecture

Web-Queue-Worker architecture SPA & Mobile Web frontend services SQL NoSQL CDN Remote service Cache Worker s Messaging IdP

Best practices for Web-Queue-Worker SPA & Mobile Web frontend services SQL NoSQL CDN Remote service Cache Workers Messaging IdP Partition data Use polyglot storage Auto-scale instances Decouple resource intensive jobs Host static content Expose consumer friendly API Retry transient faults Cache semi-static data

SPA & Mobile Web frontend services SQL NoSQL CDN Remote service Cache Workers Blob Messaging IdP Design patterns for Web-Queue-Worker Throttling Circuit breaker Cache aside Federated authentication Index table Sharding Static content hosting Competing consumers Load leveling Valet key

SPA & Mobile Web frontend services SQL NoSQL CDN Remote service Cache Workers Messaging IdP Anti-patterns in Web-Queue-Worker Busy frontend No Cache Synchronous IO Improper instantiation Busy database Monolithic persistence Serial message processing Chatty IO Extraneous fetching

Web-Queue-Worker When to use Web applications with straightforward business logic You want to take advantage of managed services Benefits : Very first Azure architecture  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 Challenges Without careful design, the web 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.

Microservices architecture

Microservices SPA & Mobile Microservices SQL NoSQL API Gateway CDN Remote Service Blob IdP

Microservices – Best practices SPA & Mobile Microservices SQL NoSQL API Gateway Remote Service IdP DevOps Release process Release process Each service has a single responsibility Don’t share the data directly Every request goes through GW Model service around business domain Isolate failure Decentralize all things Don’t leak implementation details Service calls via API Offload cross cutting concerns to GW Use polyglot storage

Microservices When to use Requires continuous innovation Requires d eployment at high velocity Deals with complex domain Benefits Independent deployment Fault isolation Diverse technology Small focused team Separate scalability Challenges Complexity Network congestion Data integrity/consistency Testing Reliability

CQRS architecture

Microservices + CQRS SPA & Mobile Microservices SQL NoSQL API Gateway CDN Remote Service Cache Read model Write model Microservices Blob Command Query Messaging IdP

Decoupling data by CQRS Delivery Account DeliveryID PackageID Drones 1234 0011 003154 DeliveryID PackageID Date Delivered 1234 0011 99 01/19/2017 Write model ( Event sourcing) Read model (Materialized View) Eventually consistent Account Delivery history Drone Message Broker PackageDelivered

SPA & Mobile Microservices SQL NoSQL API Gateway CDN Remote Service Cache Read model Write model Microservices Blob Command Query Messaging IdP Design patterns for microservices/CQRS Read model GW- aggregation Bulkhead Sidecar Backend for frontend Event sourcing Materialized view Ambassodar GW- offloading

CQRS When to use Collaborative domain with lots of operations to the same data R/W mismatch causes issues High scalability is required Benefits Separate scalability for R/W Decoupling Read from Write Optimal schema for read and write Challenges Data consistency issues Complex implementation

User Business logic Polyglot Storage Device Gateway Streaming & analytics Device control Device State & Mgmt Business System Hot & Cold Storage Serving & BI Device API Gateway Web/Mobile application IIoT Data analysis Batch Analysis Near Real-time Analysis Notification Remote Service IIoT User management

Event Driven Event ingestion Event producers Event consumers Event consumers Event consumers

Event Driven When to use Multiple subsystems process the same event Real-time processing with minimum time lag Complex event processing such as pattern matching Event processing with high ingestion rate such as IoT Benefits No point to point Integrations Immediate actions at consumer (minimum time lag) Very well decoupling producers from consumers Highly scalable and distributable Challenges Reliability, losing a single event could make system unstable (guaranteed delivery) Order of processing Exact once processing

EDA( IoT ) Reference Architecture Device Serving layer Application backend Cloud gateway Device gateway Provisioning API Identity and registry store Device state store Stream processors Storage Analytics & Machine learning BI Adaptor to External system

EDA( IoT ) Reference Architecture Device Serving layer Application backend Cloud gateway Device gateway Provisioning API Identity and registry store Device state store Stream processors Storage Analytics & Machine learning BI Adaptor to External system Car Machine e tc. IoT Hub EvenytHub IoT Hub Azure storage Custom app Azure stream analysis Storm Spark Azure storage ADLS Azure ML Spark HBase SQL DB SQL DWH Spark Cassandra Power BI Excel SSAS Tableau Qlikview Custom app Actor FW Azure Batch Custom app

Cloud Design Patterns ‘Cloud Design Patterns’ http://aka.ms/cloud-design-patterns

User Business logic Polyglot Storage Device Gateway Streaming & analytics Device control Device State & Mgmt Business System Hot & Cold Storage Serving & BI Device API Gateway Web/Mobile application IIoT Data analysis Batch Analysis Near Real-time Analysis Notification Remote Service Big Data User management

Big data architecture

Big data reference architecture Data source Batch processing Stream analysis Serving layer Data streaming Business intelligence Orchestration Data storage

Data ingestion pattern Data source Batch processing Stream analysis Serving layer Data streaming Business intelligence Orchestration Data storage

Best practices for Big data Data source Batch processing Stream analysis Serving layer Data streaming Business intelligence Orchestration Data storage Implement retention policy Upload large dataset using multiple threads in parallel Scrub sensitive data before publishing Partition the data Automate data ingestion and process by orchestration tools Provision a separate cluster for Hbase /Storm than batch processing Prevent data skew issue Use protocol conversion to speed up

Big data – service mapping Data source B atch processing Stream analysis Serving layer Data streaming Business intelligence Orchestration Data storage Device Weblogs Click stream OLTP Azure Data Lake Store Azure storage EventHub IoT Hub Kafka ASA Spark Storm ADLA HDInsight HBase Cassandra DocumentDB SQL DB/DWH Spark Power BI Excel SSAS Tableau Qlikview Custom app Azure Data Factory Oozie SSIS

Big data When to use Process TB ~ PB of data in a timely manner Pre-process raw data and pass the aggregated results to BI Real-time processing Experiment new data type quickly Predictive analysis Benefits Cost effective solution for large dataset High performance by parallel processing with data locality Challenges Data ingestion Numerous combination of technologies Too many knobs to optimize performance Security

Example – Drone delivery service

Accounts Drone management 3 rd party transportation Call center Video surveillance Drone sharing Drone management Accounts Drone sharing 3 rd party transportation Shipping (Core) Call center Shipping Context map – Drone delivery service Surveyllance

A ggregates and services in shipping domain Shipping Drone Package Delivery DeliveryScheduler DeliverySupervisor Account 3 rd party transportation Authentication DeliveryScheduler DeliverySupervisor Delivery Package Authentication Drone Account 3 rd party transportation Microservices Microservices In different BC

DeliveryScheduler Package Drone Delivery Mobile app Event sourcing Delivery Supervisor DeliveryEvents RequestEvents GW Status 3 rd party Service Account Service DroneMgmt Service Microservices in Shipping BC Account Service Auth Service 3 rd party transportation Account Account Service

DeliveryScheduler Package Drone Delivery Mobile app Delivery Supervisor GW Design patterns Auth Service 3 rd party transportation Account Load leveling GW- routing Throttling Scheduler-Agent-Supervisor Event sourcing Circuit breaker Competing consumers Bulkhead Sidecar Ambassador GW- offloading Federated auth Sharding Ambassador 3 rd party Service Account Service DroneMgmt Service Account Service Pub-Sub

User Business logic Polyglot Storage Device Gateway Streaming & analytics Device control Device State & Mgmt Business System Hot & Cold Storage Serving & BI Device API Gateway Web/Mobile application IIoT Data analysis Batch Analysis Near Real-time Analysis Notification Remote Service Drone delivery application architecture User management Drone geolocation and ETA User device geolocation Account management Drone scheduling ETA Drone placement
Tags