50
雲雲雲雲雲雲雲 雲雲雲 ( 雲雲 ) Microsoft MVP of Windows Azure MCSD: Web Applications 雲雲雲雲雲雲雲雲

雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

雲端的架構開發朱明中 ( 小朱 )Microsoft MVP of Windows AzureMCSD: Web Applications台灣微軟資深講師

Page 2: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

大綱• 雲端和本地是有差異的• 故障防護 (Failsafe)• 擴展性 (Scalability)• 整合度 (Integration)• 應用程式架構樣式 (Patterns)

Page 3: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

雲端和本地是有差異的

Page 4: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

為雲端而設計• 錯誤防護• 任何東西都會發生錯誤。

• 擴展• 擴展能力並不是自動的。

• 整合• 您的雲端應用會需要與其他本地系統一起工作。

Page 5: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

錯誤防護

Page 6: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

可用度

• 贅餘配置

𝐴𝑣𝑎𝑖𝑙𝑎𝑏𝑖𝑙𝑖𝑡𝑦=𝑢𝑝𝑡𝑖𝑚𝑒

𝑢𝑝𝑡𝑖𝑚𝑒+𝑑𝑜𝑤𝑛𝑡𝑖𝑚𝑒

= 99.9%

A (90%)

B (90%)

C (90%)

• 組合配置

A (99.9%) B (99.9%) C (99.9%)

= 99.7%

Page 7: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

Windows Azure 內的贅餘配置 • Windows Azure Storage 具備複本能力。• SQL Database 內建備份伺服器• Windows Azure Caching 具有高可用能力。• 利用多執行個體的 Windows Azure Web Sites 與 Cloud

Services 。• 設定負載平衡的 Virtual Machines 。• Windows Azure Virtual Network 閘道已內建贅餘配置 。• 使用 Windows Azure Traffic Manager 達到容錯能力。

Page 8: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

穩定性MTTF

MTTR

MTBF

可用

MTTR First:

MTTF First:

不可用

MTTF ( Mean Time To Failure ,平均正常運作時間)MTTR ( Mean Time To Repair ,平均修復時間)MTBF ( Mean Time Between Failure ,平均故障間隔時間 )

Page 9: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

Windows Azure 的穩定性• 自動復原 已當機或未回應的執行個體。• 錯誤域 (Fault Domain) 跨機櫃配置執行個體。• 虛擬機器的可用集 (Availability set) 將虛擬機器配置於錯誤域

內。• 更新域 (Upgrade domain) 防止所有執行個體在同一時間內關

機。• VIP 交換 (swap) 允許將轉換環境提升到生產環境。• 模擬器與 Intellitrace 與強化的診斷功能。• 對 遠端監測 (telemetry) 的第一方與第三方支援。• 使用 Transient Fault Handling Application block 處理瞬間

錯誤。

Page 10: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

對我的應用程式而言,什麼是錯誤防護?• 運用 Windows Azure 功能的優點。• 預防單點失敗 (single point of failure) 。• 失敗模式分析。• 瞬間錯誤。• 優雅降級。• 降低人因問題。

Page 11: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

擴展

Page 12: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

擴展力• 向上或向外擴展

0 1 2 3 4 5 6 7 8

執行個體

產量

執行個體能量

配額

Page 13: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

容量規劃與擴展單元

Time

容量

工作負載

服務 x 個客戶,我需要 i 個運算節點, j 個工作佇列, k 個儲存帳戶,…

𝑡𝑢 ,∆𝑊 (𝑡)≤𝐶𝑢

Page 14: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

Windows Azure 的擴展力• 向上擴展:處理不同的虛擬機器大小。• 向外擴展:加入更多執行個體。• 自動擴展:運用 Windows Azure 本身的功能或撰寫自已的規

則。• 資料庫抽象化 (shading) :將多個資料庫抽象為一個• 向外擴展:運用多個服務實體。• CDN :分散使用者流量。• 快取:處理伺服器的工作負載。

Page 15: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

對我的應用程式而言,什麼是擴展?•容量規劃•適當的的系統分解•無狀態設計•在任何層次都能做擴展•節流

Page 16: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

擴展的不同等級無狀態 共享狀態 全域狀態

R

R

R

R

R

R

R

R

R

R

S

S

R

R

R

R

R

S

R

R

R

R

R

R

R

R

R

R

R

R

R

SR

RS

R

R

R

R

R

S

R

R

R

R

R

S

Router

移除全域狀態分離狀態與動作

Page 17: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

分離動作與狀態• 外部化狀態 ( 將狀態移到分散式快取區 )• Cache session state provider

(Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache)

• 分離動作與狀態• Job creator• Job queue• Job Handler

Job Creator

Job Handler

Job Queue

Job Handler

Page 18: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

與本地系統整合

Page 19: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

移轉到雲端的決策圖雲端是否

真有幫助 ?定義 / 精煉目標 建立底線

估計收益

相依分析

商業影響分析

值得做嗎 ?

同意 ?

相依嗎 ?

開始

影響分析

同意 ?

整合策略

Page 20: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

一般性的整合策略• 與資料整合• 直接互動• 中間層

Page 21: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

Windows Azure 內的整合• 訊息通訊為主的整合:使用 Windows Azure 服務匯流排• 連線能力:使用 Windows Azure Virtual Network• 整合您的 本地 AD :使用 Windows Azure Active Directory• 單一簽入:使用 Windows Azure 存取控制服務• 包容性生態系統:支援異質性環境• 擁抱 標準 如 HTTP, Oauth, oData, ws-*

Page 22: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

對我的應用程式而言,什麼是整合?•鬆散耦合•讓暴露在外的服務或資料最小化•整合隔離•預設就是安全的•使用標準

Page 23: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

與本地系統整合• 訊息為主的整合

System A System B

Queue

System C

TopicSystem D

System E

System FSystem G

System H

Page 24: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

與本地系統整合• 虛擬網路

LAN VNet

Site-to-Site

Point-to-Site

Page 25: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

Windows Azure Active Directory• 提供應用程式的存取控制能力。• 應用程式內的單一簽入。• 跨企業的社群連線。• 整合您的本地 AD 。

1

WAADTenant

ApplicationWIF

AppLogin Page

2

3

4

AD

ApplicationWIF

App

Page 26: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

雲端應用程式架構

Page 27: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

WIF ASP.NET

MVC 3

Web RoleCustom STS

Access Control

Web SiteUser Web Application

ASP.NET MVC 4

Web SiteBack office Web Application

ASP.NET MVC 4

Virtual MachineFed Net Protocol

Socket Server

Web SiteNative Protocol

ASP.NET Web API

Ationet Gateway

SQL Database

DBAzure Tables

Vending Machines

PoS

Dispenser controller.NET Micro

framework

ATIONet

Page 28: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

雲端應用程式架構樣式• 基本應用程式架構樣式 (Basic Application

Architecture Pattern)• 彈性樣式 (Elasticity Pattern)• 可用度樣式 (Availability Pattern)• 多租戶樣式 (Multi-tenancy Pattern)

Page 29: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

基本應用程式架構樣式組合式應用程式(Composite Application)

將應用程式的功能切分,各個部份以一個組合語言 (composition language) 來整合,讓它合成為一個獨立的應用程式。

Page 30: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

基本應用程式架構樣式鬆散耦合(Loosely-Coupled)

將元件之間的直接通訊去除,以一個中間通訊的方式來提供,並且讓元件可以自主運作。

Page 31: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

基本應用程式架構樣式無狀態元件(State-less Component)

將元件的內部狀態 (internal

state) 去除,移到外部的狀態儲存地,以支援擴展情境。

Page 32: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

基本應用程式架構樣式鑒一性元件(Idempotent Component)

實作元件對於訊息的處理必須保持鑒一性 ( 一定只處理一次 ) ,以保護應用程式不會重覆處理相同的訊息。

Page 33: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

彈性樣式分解 -歸納模式(Map-Reduce)

將資料打散給一定數量的資料處理服務各自處理後,將結果組合起來成為最終結果。

Page 34: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

彈性樣式彈性化元件(Elasticity Component)

由系統自動偵測服務的負載,並自動處理擴展的模式與類型。

Page 35: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

彈性樣式彈性化負載平衡(Elasticity Load Balancing)

由系統自動偵測應用程式的流量,並將流量分配給負載較輕的處理器。而負載平衡的工作由系統自動調配。

Page 36: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

彈性樣式彈性化佇列(Elasticity Queue)

由系統偵測目前佇列以及服務負載的情況,自動將佇列內的要求分派給負載較輕的服務處理,並且可自動處理擴展的情境。

Page 37: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

可用性樣式看門狗(Watchdog)

在系統中佈建數個監控服務或網站健康狀態的運算節點,以偵測並回報系統內服務或網站的健康狀態,以支援自動復原的機制。

Page 38: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

可用性樣式更新遞移(Updating Transition)

由系統監控軟體更新的過程,並且自動更新目前服務對外的連線,以支援軟體的版本更新,且又不會讓服務中斷。

Page 39: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

多租戶樣式單一執行個體元件(Single Instance Component)

部署單一元件,並設計共享機制讓所有租戶能共享此元件的功能。

Page 40: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

多租戶樣式單一可組態執行個體元件(Single Configurable Instance Component)

部署單一元件,但針對個別租戶設計組態隔離機制,讓個別使用者能依各自的組態於單一元件上執行。

Page 41: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

多租戶樣式多執行個體元件(Multiple Instances Component)

為個別租戶部署元件,並以各自的組態來設定並執行元件。

Page 42: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

總結1. 雲端不是本地環境,請用雲端思維來分析與設計應用程式。2. Windows Azure 有許多資源可協助開發分散式應用程式。3. 擴展力,整合力與錯誤防護力是雲端應用的基本特性。4. 運用 Pattern 協助您規劃與發展雲端應用。

Page 43: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

參考資源Windows Azure Application Architectures: http://www.windowsazure.com/en-us/develop/net/architecture/Cloud Application Architecture Patterns: http://cloudcomputingpatterns.org

Page 44: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

44

提醒

上滿 4 堂課 交回問卷 問卷禮

Page 45: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

Microsoft MVP Award報名申請 : [email protected]

參加美國微軟產品組線上會議 MVP logo

使用權

提供產品建議給微軟產品組

美國MVP全球年會

MSDN Online combo Subscription

MVP 專屬討論區 Knowledge Base

Technical Support3 個專業資訊人員技術支援服務

MVP 專屬 live meeting account

Page 46: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

MVA 學習資源 ( 持續更新中文課程 )• 立即上手 Windows Azure

http://aka.ms/mva-azure-overview • SQL Server 2014 線上交易記憶體內資料庫簡介

http://aka.ms/mva-sql2014 • 針對網站開發人員的 Visual Studio 使用技巧

http://aka.ms/vstips4web • Web Services 開發實戰 : 使用 ASP.NET Web API 2

http://aka.ms/mva-webapi2 • Visual Studio Online 與 Git 版本控管實戰

http://aka.ms/mva-vso-git • 使用 App Studio 快速開發 Windows Phone 應用程式

http://aka.ms/mva-appstudio

Page 47: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

MVA 學習資源 (Windows Azure 中文課程 )

• Windows Azure 虛擬機器服務 (Virtual Machine) 入門 http://tinyurl.com/naao7a8

• Windows Azure 雲端服務 (PaaS) 入門 http://tinyurl.com/o9s4h9y

• Windows Azure 網站服務 (Website) 入門 http://tinyurl.com/l55m34c

• Windows Azure 雲端開發者日 (Developer Days) http://tinyurl.com/qcdatx2

Page 48: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)
Page 49: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)
Page 50: 雲端的架構開發 (Designing Cloud Application Architecture with Windows Azure Platform)

© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to

be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.