Service Fabric 應用程式案例Service Fabric application scenarios

Azure Service Fabric 提供可靠且彈性的平臺, 可讓您撰寫及執行許多類型的商務應用程式和服務。Azure Service Fabric offers a reliable and flexible platform where you can write and run many types of business applications and services. 這些應用程式和微服務可以是無狀態或具狀態的, 而且它們會在虛擬機器之間進行資源平衡, 以達到最高效率。These applications and microservices can be stateless or stateful, and they're resource-balanced across virtual machines to maximize efficiency.

Service Fabric 的獨特架構可讓您在應用程式中執行接近即時的資料分析、記憶體中計算、平行交易和事件處理。The unique architecture of Service Fabric enables you to perform near real-time data analysis, in-memory computation, parallel transactions, and event processing in your applications. 您可以輕鬆地根據變更的資源需求上下調整 (其實是收發) 您的應用程式。You can easily scale your applications up or down (really in or out), depending on your changing resource requirements.

如需建立應用程式的設計指引, 請參閱Azure 上的微服務架構 Service Fabric使用 Service Fabric 進行應用程式設計的最佳作法For design guidance on building applications, read Microservices architecture on Azure Service Fabric and Best practices for application design using Service Fabric.

針對下列類型的應用程式, 請考慮使用 Service Fabric 平臺:Consider using the Service Fabric platform for the following types of applications:

  • 資料收集、處理和 IoT:Service Fabric 會透過其具狀態服務來處理大規模且延遲較低。Data gathering, processing, and IoT: Service Fabric handles large scale and has low latency through its stateful services. 它可協助處理數百萬個裝置上的資料, 其中裝置和計算的資料會共置。It can help process data on millions of devices where the data for the device and the computation are colocated.

    已使用 Service Fabric 建立 IoT 服務的客戶包括HoneywellPCL 建築Crestron寶馬Schneider 電動網狀網格系統Customers who have built IoT services by using Service Fabric include Honeywell, PCL Construction, Crestron, BMW, Schneider Electric, and Mesh Systems.

  • 遊戲和以會話為基礎的互動式應用程式:如果您的應用程式需要低延遲的讀取和寫入 (例如線上遊戲或立即訊息), Service Fabric 會很有用。Gaming and session-based interactive applications: Service Fabric is useful if your application requires low-latency reads and writes, such as in online gaming or instant messaging. Service Fabric 可讓您建立這些互動式、具狀態的應用程式, 而不需要建立個別的存放區或快取。Service Fabric enables you to build these interactive, stateful applications without having to create a separate store or cache. 請造訪Azure 遊戲解決方案, 以取得在遊戲服務中使用 Service Fabric的設計指引。Visit Azure gaming solutions for design guidance on using Service Fabric in gaming services.

    已建立遊戲服務的客戶包括下一場遊戲DigamoreCustomers who have built gaming services include Next Games and Digamore. 已建立互動式會話的客戶包括Honeywell 與 HololensCustomers who have built interactive sessions include Honeywell with Hololens.

  • 資料分析和工作流程處理:必須可靠地處理事件或資料流程的應用程式, 會從優化的讀取和寫入 Service Fabric 中獲益。Data analytics and workflow processing: Applications that must reliably process events or streams of data benefit from the optimized reads and writes in Service Fabric. Service Fabric 也支援應用程式處理管線, 其中的結果必須可靠並傳遞至下一個處理階段, 而不會遺失。Service Fabric also supports application processing pipelines, where results must be reliable and passed on to the next processing stage without any loss. 這些管線包括交易式和財務系統, 其中的資料一致性和計算保證都是必要的。These pipelines include transactional and financial systems, where data consistency and computation guarantees are essential.

    已建立商務工作流程服務的客戶包括Zeiss 群組仲裁商務解決方案Société一般Customers who have built business workflow services include Zeiss Group, Quorum Business Solutions, and Société General.

  • 資料的計算:Service Fabric 可讓您建立執行大量資料計算的具狀態應用程式。Computation on data: Service Fabric enables you to build stateful applications that do intensive data computation. Service Fabric 允許在應用程式中進行處理 (計算) 和資料的共置。Service Fabric allows the colocation of processing (computation) and data in applications.

    一般來說, 當您的應用程式需要存取資料時, 與外部資料快取或儲存層相關聯的網路延遲會限制計算時間。Normally, when your application requires access to data, network latency associated with an external data cache or storage tier limits the computation time. 具狀態 Service Fabric 服務會消除該延遲, 以提供更優化的讀取和寫入。Stateful Service Fabric services eliminate that latency, enabling more optimized reads and writes.

    例如, 假設有一個應用程式會為客戶執行近乎即時的建議選擇, 而來回時間需求則小於100毫秒。For example, consider an application that performs near real-time recommendation selections for customers, with a round-trip time requirement of less than 100 milliseconds. 相較于必須從遠端存放裝置提取必要資料的標準執行模型, Service Fabric 服務的延遲和效能特性可為使用者提供回應式體驗。The latency and performance characteristics of Service Fabric services provide a responsive experience to the user, compared with the standard implementation model of having to fetch the necessary data from remote storage. 系統會更有回應, 因為建議選取專案的計算與資料和規則共存。The system is more responsive because the computation of recommendation selection is colocated with the data and rules.

    具有內建計算服務的客戶包括Solidsoft 回復InfosupportCustomers who have built computation services include Solidsoft Reply and Infosupport.

  • 高可用性服務:Service Fabric 藉由建立多個次要服務複本來提供快速容錯移轉。Highly available services: Service Fabric provides fast failover by creating multiple secondary service replicas. 如果節點、處理序或個別服務因為硬體或其他故障而停機,其中一個次要複本會升級為主要複本,以便將服務損失降到最低。If a node, process, or individual service goes down due to hardware or other failure, one of the secondary replicas is promoted to a primary replica with minimal loss of service.

  • 可調整的服務:可以分割個別服務,以便在叢集中擴充狀態。Scalable services: Individual services can be partitioned, allowing for state to be scaled out across the cluster. 您也可以即時建立和移除個別服務。Individual services can also be created and removed on the fly. 您可以從數個節點上的幾個實例向外延展服務, 並在多個節點上將數千個實例相應放大, 然後視需要再重新調整。You can scale out services from a few instances on a few nodes to thousands of instances on many nodes, and then scale them in again as needed. 您可以使用 Service Fabric 來建立這些服務, 並管理其完整的生命週期。You can use Service Fabric to build these services and manage their complete life cycles.

應用程式設計個案研究Application design case studies

示範如何使用 Service Fabric 來設計應用程式的個案研究, 會在客戶案例和 Azure 網站的微服務上發佈。Case studies that show how Service Fabric is used to design applications are published on the Customer stories and Microservices in Azure sites.

設計由無狀態和具狀態微服務組成的應用程式Designing applications composed of stateless and stateful microservices

使用 Azure 雲端服務背景工作角色建立應用程式是無狀態服務的範例。Building applications with Azure Cloud Services worker roles is an example of a stateless service. 相較之下,具狀態的微服務會維護要求及其回應以外的授權狀態。In contrast, stateful microservices maintain their authoritative state beyond the request and its response. 這項功能透過簡單的 Api 提供高可用性和狀態的一致性, 提供複寫所支援的交易保證。This functionality provides high availability and consistency of the state through simple APIs that provide transactional guarantees backed by replication.

中的具狀態服務 Service Fabric 將高可用性帶入所有類型的應用程式, 而不只是資料庫和其他資料存放區。Stateful services in Service Fabric bring high availability to all types of applications, not just databases and other data stores. 這是自然的進展。This is a natural progression. 針對高可用性,應用程式已經從使用單純的關聯式資料庫進展到 NoSQL 資料庫的境界。Applications have already moved from using purely relational databases for high availability to NoSQL databases. 現在應用程式就能在其本身內管理它們的「熱門」狀態和資料,以便進一步提高效能,而不需犧牲可靠性、一致性或可用性。Now the applications themselves can have their "hot" state and data managed within them for additional performance gains without sacrificing reliability, consistency, or availability.

當您正在建立包含微服務的應用程式時, 您通常會有無狀態 web 應用程式 (例如 ASP.NET 和 node.js) 的組合, 可在無狀態和具狀態的 business 中介層服務上呼叫。When you're building applications that consist of microservices, you typically have a combination of stateless web apps (like ASP.NET and Node.js) calling onto stateless and stateful business middle-tier services. 應用程式和服務全都會透過 Service Fabric 部署命令, 部署在相同的 Service Fabric 叢集中。The apps and services are all deployed in the same Service Fabric cluster through the Service Fabric deployment commands. 這些服務各自獨立于規模、可靠性和資源使用方式。Each of these services is independent with regard to scale, reliability, and resource usage. 此獨立性可改善開發和生命週期管理的靈活性和彈性。This independence improves agility and flexibility in development and life-cycle management.

具狀態的微服務簡化了應用程式設計,因此不需要傳統上為滿足純無狀態應用程式的可用性與延遲需求時所需的其他佇列與快取。Stateful microservices simplify application designs because they remove the need for the additional queues and caches that have traditionally been required to address the availability and latency requirements of purely stateless applications. 因為具狀態服務有高可用性和低延遲, 所以在您的應用程式中管理的詳細資料較少。Because stateful services have high availability and low latency, there are fewer details to manage in your application.

下圖說明設計無狀態的應用程式與可設定狀態的應用程式之間的差異。The following diagrams illustrate the differences between designing an application that's stateless and one that's stateful. 藉由運用 Reliable ServicesReliable Actors 程式設計模型,具狀態服務既可降低應用程式複雜度,又可提高輸送量和降低延遲。By taking advantage of the Reliable Services and Reliable Actors programming models, stateful services reduce application complexity while achieving high throughput and low latency.

以下是使用無狀態服務的範例應用程式:使用無狀態服務的應用程式Here's an example application that uses stateless services: Application that uses stateless services

以下是使用具狀態服務的範例應用程式:使用無狀態服務的應用程式Here's an example application that uses stateful services: Application that uses stateless services

後續步驟Next steps