540 likes | 742 Views
使用 ASP.NET MVC 搭配 Windows Azure 建構可擴展網站. Sky Chang 天空的垃圾場 Blog.sanc.idv.tw. Sky Chang. Windows Azure 微軟最有價值專家. s ky.chang@mentortrust.com. 天空的垃圾場. ASP.NET MVC ALM Windows Azure. b log.sanc.idv.tw. 資料來源. Windows Azure : http://www.windowsazure.com 天空的垃圾場 : http:// blog.sanc.idv.tw
E N D
使用ASP.NET MVC搭配Windows Azure建構可擴展網站 Sky Chang 天空的垃圾場 Blog.sanc.idv.tw
Sky Chang Windows Azure 微軟最有價值專家 sky.chang@mentortrust.com 天空的垃圾場 • ASP.NET MVC • ALM • Windows Azure blog.sanc.idv.tw
資料來源 Windows Azure : http://www.windowsazure.com 天空的垃圾場 :http://blog.sanc.idv.tw Study4.TW : http://study4.tw Windows Azure 雲端平台開發夥伴社群https://www.facebook.com/cloudexpert Azure Taiwan User Group : https://www.facebook.com/groups/AzureTWUG/ MSDN:http://social.msdn.microsoft.com/Forums/zh-tw/home
Cloud Service Demo
!!警告!! 今天沒有笑話,如過程中有任何睡意,屬於正常現象
Agenda Cloud Service SLA 99.95 Storage ( 程式架構 ) Scaling - Cloud Service Cache ( LB 、 Session) Azure架構 ( Web Role and Work Role )
Windows Azure • Your Datacenter • Virtual Machines • Cloud Services • Web Sites Applications Applications Applications Applications Data Data Data Data Firewall Firewall Rules Firewall Rules Network Virtual Network Virtual Network O/S O/S Virtualization Hardware Focus on the Application
What is a Cloud Service? 此容器包含了關聯的Service Roles Web Role Worker Role
Web Role 就是 -> IIS 7, 7.5 or IIS 8.0* ASP.NET 3.5 SP1, 4.0 or 4.5* – 64bit Hosts • Web Forms or MVC • FastCGI applications (e.g. PHP)
Worker Role Patterns Queue Polling Worker • Poll and Pop Messages 透過while(true)進行迴圈 • E.g. 背景處理大量資料 Listening Worker Role • 建立TCP Listener或WCF Service 、Web API Host • E.g. 執行.NET SMTP server 或WCF Service External Process Worker Role • 利用OnStart或 Run method 執行Process.Start() • 啟動Task在背景工作 • E.g. 執行database server, web server,分散式cache
Cloud Service Demo
守則一 不要想著放上雲 要想著如何放 Web Role和Work Role各有不同的效能,請選擇適合的家
Web Role or Work Role 共享 實體 保留實體 :-) 1
Web Role or Work Role 實體 實體 實體 :-) :-) 2
Web Role or Work Role 共享 實體 實體 實體 :-) :-) :-) :-) :-) :-) :-) :-) 2
auto-scaling CPU 使用率 實體 實體 實體 :-) :-) :-)
Scaling Demo
守則二 架構更勝於擴充 雖然可以輕易擴展,但不代表不用背負app的效能。
Cloud Service loadbalance Network Load Balancer Web Role instance Web Role instance Web Role instance :-) :-) :-)
Cloud Service loadbalance Network Load Balancer Web Role instance Web Role instance Web Role instance :-) :-) :-) SQL Database ( Azure Cache )
Cloud Service Cache Demo
守則三 設計無狀態的網站 天然的尚好!!!
Persistent Disks and Highly Durable Windows Azure Storage (Disaster Recovery) Windows Azure Storage Virtual Machine
Persistent Disks and Highly Durable Windows Azure Storage (Disaster Recovery) Windows Azure Storage Virtual Machine Virtual Machine
洋蔥架構 • 應用程式係圍繞著一個獨立的物件模型來建構。 • 內層定義介面,外層實作介面。 • 耦合的方向是朝向中央。 • 應用程式的所有核心程式碼可以在與基礎建設分離的情況下正常運行。 • (By 蔡煥麟老師翻譯 ) • 核心 : IOC & DI
架構Demo Demo
守則四 要Interface化 隔離…才是自保之道
Service Level Agreements Availability set 99.95% for multiple role instances 4.38 hours of downtime 每一年 Server 2 Server 1 包含項目 Compute Hardware 故障(disk, cpu, memory) Datacenter 故障 - Network 故障, power 故障 Hardware 升級, Software 維護– Host OS 升級 不包含項目 VM容器崩潰, 客戶OS自行升級 SLA 99.95
Fault Domains 代表有可能一起失敗的同一組資源 例如同一個機架、同一台Server Update Domains 代表一起更新的同一組資源 例如OS更新 Fault and Update Domains
Fault and Update Domains Fault Domain Fault Domain Rack Rack Web Role UD #1 UD #2 INSTANCE INSTANCE INSTANCE INSTANCE Worker Role UD #1 UD #2 INSTANCE INSTANCE INSTANCE INSTANCE
Virtual Machine Availability SetsUpdate Domains are honored by host OS updates Fault Domain Fault Domain Rack Rack Virtual Machine Virtual Machine Availability Set IIS2 IIS1 UD #2 UD #1 Availability Set Virtual Machine Virtual Machine SQL1 SQL2 UD #1 UD #2
End to End Highly Available SolutionRedundancy at every level SQL Server1 SQL-AVSET IIS-AVSET IIS Web Application Internet • Web Role • SQL Mirroring LB IIS Web Application SQL Server2 • Web Role
守則五 真的需要99.95!? 事情沒有你想的那麼簡單….
Azure 架構 Demo
And then !? • User Story、Test Case、BDD、TDD、Unit Test • SQL Server AlwaysOn ( HA ) • Windows Azure Active Directory
Thank You 天空的垃圾場
提醒 上滿4堂課 交回問卷 問卷禮