作者:Mark Fussell 更新:2016/9/22
翻譯:朱濤峰 2016/10/9
Service Fabric is a distributed systems platform that makes it easy to package, deploy, and manage scalable and reliable microservices. Service Fabric also addresses the significant challenges in developing and managing cloud applications. Developers and administrators can avoid solving complex infrastructure problems and focus instead on implementing mission-critical, demanding workloads knowing that they are scalable, reliable, and manageable. Service Fabric represents the next-generation middleware platform for building and managing these enterprise-class, Tier-1 cloud-scale applications.
Service Fabric是一個分布式的系統(tǒng)平臺,可幫助人們更容易地打包、 部署、管理高伸縮性和高可靠的微服務(wù)(microservices)。同時Service Fabric還可幫助人們處理一些云應(yīng)用開發(fā)和管理中遇到的重大挑戰(zhàn)。開發(fā)人員和管理員可以不再將精力放在解決復(fù)雜的基礎(chǔ)設(shè)施問題、要求苛刻的高負載問題,而將精力集中在處理業(yè)務(wù)領(lǐng)域關(guān)鍵問題,因為Service Fabric代表著可伸縮、高可靠和易于管理。Service Fabric是下一代中間件平臺,可用于構(gòu)建并管理企業(yè)級規(guī)模的、一級云規(guī)模的應(yīng)用。
一、微服務(wù)組成的應(yīng)用(Applications composed of microservices)
Service Fabric enables you to build and manage scalable and reliable applications composed of microservices running at very high density on a shared pool of machines (referred to as a cluster). It provides a sophisticated runtime for building distributed, scalable stateless and stateful microservices. It also provides comprehensive application management capabilities for provisioning, deploying, monitoring, upgrading/patching, and deleting deployed applications.
通過Service Fabric可以構(gòu)建和管理由大量microservices 組成的高伸縮性和高可用的應(yīng)用,這些應(yīng)用將運行在由大量機器組成的服務(wù)器共享池(稱為群集)。它可以提供原本復(fù)雜的在線的構(gòu)建分布式、 高伸縮性的無狀態(tài)/有狀態(tài) microservices。它還能為資源調(diào)配、 部署、 監(jiān)控、 升級/打補丁等提供全面的應(yīng)用管理功能,還能刪除已部署應(yīng)用。
Why is a microservices approach important? The two main reasons are:
1.They enable you to scale different parts of your application depending on its needs.
2.Development teams are able to be more agile in rolling out changes and thus provide features to your customers faster and more frequently.
有人會問: microservices 重要嗎?有兩個原因︰
1.它們能夠根據(jù)需要擴展的應(yīng)用的不同部分。
2.開發(fā)團隊能夠更加敏捷,更加適應(yīng)變化,并能向客戶更快、 更頻繁地提交功能。
Service Fabric powers many Microsoft services today, including Azure SQL Database, Azure DocumentDB, Cortana, Power BI, Microsoft Intune, Azure Event Hubs, Azure IoT, Skype for Business, and many core Azure services.
Service Fabric支持當今許多微軟服務(wù),包括 Azure SQL 數(shù)據(jù)庫,Azure DocumentDB、 柯塔娜Cortana、 Power BI、 微軟 Intune,Azure 事件中心、 Azure 物聯(lián)網(wǎng)、 Skype 商業(yè)版本,和許多核心 Azure 服務(wù)。
Service Fabric is tailored to creating “born in the cloud” services that can start small, as needed, and grow to massive scale with hundreds or thousands of machines.
Service Fabric是專為打造“誕生于云”的應(yīng)用服務(wù),可以支持應(yīng)用從微小規(guī)模一直成長到數(shù)百或數(shù)千臺計算機的大規(guī)模。
Today's Internet-scale services are built of microservices. Examples of microservices include protocol gateways, user profiles, shopping carts, inventory processing, queues, and caches. Service Fabric is a microservices platform that gives every microservice a unique name that can be either stateless or stateful.
當今的互聯(lián)網(wǎng)規(guī)模的服務(wù)是由微服務(wù)構(gòu)成的。例如協(xié)議網(wǎng)關(guān),用戶配置文件,購物車,庫存處理,隊列和高速緩存。Service Fabric是一種微服務(wù)平臺,它賦于每個微服務(wù)一個唯一名稱,無論微服務(wù)是基于無狀態(tài)的、還是基于有狀態(tài)的。
Service Fabric provides comprehensive runtime and lifecycle management capabilities to applications composed of these microservices. It hosts microservices inside containers deployed and activated across the Service Fabric cluster. Moving from VMs to containers makes possible an order-of-magnitude increase in density. Similarly, another order of magnitude in density becomes possible by moving from containers to microservices. For example, a single Azure SQL Database cluster comprises hundreds of machines running tens of thousands of containers hosting a total of hundreds of thousands of databases. Each database is a Service Fabric stateful microservice. The same is true of the other services previously mentioned, which is why the term "hyperscale" is used to describe Service Fabric capabilities. If containers give you high density, then microservices give you hyperscale.
Service Fabric對由微服務(wù)組成的應(yīng)用提供全面的在線管理、全生命周期管理功能。它承載各類容器(containers)以部署和激活跨Service Fabric集群的微服務(wù)。如果從虛擬機進化為容器使得服務(wù)密度能數(shù)量級增加,那么,從容器進化為微服務(wù)能進一步數(shù)量級地增加可管理的服務(wù)的密度。舉個例子,一個單一的Azure SQL數(shù)據(jù)庫群集由數(shù)百臺的服務(wù)器、數(shù)以萬計的容器、數(shù)以十萬計的數(shù)據(jù)庫組成的,其中每個數(shù)據(jù)庫都是Service Fabric上持有狀態(tài)的微服務(wù)。前面提到的其他微軟服務(wù)也是類似的,這就是為什么用“超大規(guī)?!币辉~來描述Service Fabric的容量,因為如果容器能給你高密度,那么微服務(wù)能給你超大規(guī)模。
For more on the microservices approach, readWhy a microservices approach to building applications?
欲了解更多關(guān)于微服務(wù)的方法,閱讀Why a microservices approach to building applications?
二、兼容多種環(huán)境Create Service Fabric clusters anywhere
You can create Service Fabric clusters in many environments, including Azure or on premises, on Windows Server or on Linux. In addition, the development environment in the SDK is identical to the production environment with no emulators involved. In other words, if it runs on your local development cluster it deploys to the same cluster in other environments.
在許多環(huán)境中,包括 Azure 或本地,Windows 或 Linux,你都可以創(chuàng)建Service Fabric集群。此外,開發(fā)環(huán)境的 SDK 與生產(chǎn)環(huán)境的SDK是一樣的(中間不需要仿真器轉(zhuǎn)換)。換句話說,如果它能在本地開發(fā)環(huán)境上運行,它就能直接部署到其他環(huán)境運行。
For more information on creating clusters on-premise, readcreating a cluster on Windows Server or Linuxor for Azure creating a clustervia the Azure portal.
關(guān)于創(chuàng)建本地集群,閱讀creating a cluster on Windows Server or Linux
關(guān)于創(chuàng)建Azure集群,閱讀via the Azure portal.
三、支持創(chuàng)建無狀態(tài)和有狀態(tài)的微服務(wù)Stateless and stateful Service Fabric microservices
Service Fabric enables you to build applications consisting of microservices. Stateless microservices (protocol gateways, web proxies, etc.) do not maintain a mutable state outside of any given request and its response from the service. Azure Cloud Services worker roles are an example of a stateless service. Stateful microservices (user accounts, databases, devices, shopping carts, queues, etc.) maintain a mutable, authoritative state beyond the request and its response. Today's Internet-scale applications consist of a combination of stateless and stateful microservices.
Service Fabric使您能夠建立一個支持微服務(wù)的應(yīng)用程序。無狀態(tài)微服務(wù)(協(xié)議網(wǎng)關(guān),Web代理,等)不保持任何請求的響應(yīng)處理期外的狀態(tài)。Azure云服務(wù)工作者角色是一個無狀態(tài)服務(wù)的例子。有狀態(tài)微服務(wù)(用戶帳戶,數(shù)據(jù)庫,設(shè)備,購物車,隊列等)保持請求的狀態(tài)。當今互聯(lián)網(wǎng)規(guī)模的應(yīng)用都包括了無狀態(tài)、有狀態(tài)微服務(wù)的組合。
Why have stateful microservices along with stateless ones? The two main reasons are:
1.The ability to build high-throughput, low-latency, failure-tolerant online transaction processing (OLTP) services by keeping code and data close on the same machine. Some examples are interactive storefronts, search, Internet of Things (IoT) systems, trading systems, credit card processing and fraud detection systems, and personal record management.
2.Application design simplification. Stateful microservices remove the need for additional queues and caches, traditionally required to address the availability and latency requirements of a purely stateless application. Stateful services are naturally high-availability and low-latency, reducing the number of moving parts to manage in your application as a whole.
為何要將有狀態(tài)和無狀態(tài)的微服務(wù)一同使用?因為
1.構(gòu)建高吞吐量、 低延遲、 故障容錯的聯(lián)機事務(wù)處理 (OLTP) 服務(wù)的需要。通過“有狀態(tài)”讓同一臺計算機上的代碼和數(shù)據(jù)盡可能靠近,有力地保證了這些能力。一些例子:交互式店面、 搜索、 物聯(lián)網(wǎng) (IoT) 系統(tǒng)、 交易系統(tǒng)、 信用卡處理、欺詐檢測系統(tǒng)、個人記錄管理。
2.應(yīng)用程序設(shè)計的簡化。有狀態(tài)的微服務(wù)不再需要額外的隊列和緩存方案,這些手段是解決純粹無狀態(tài)導(dǎo)致用戶體驗問題和響應(yīng)延遲問題的傳統(tǒng)方案。減少了這些部件,作為一個整體,等于減少了管理的數(shù)量,有狀態(tài)服務(wù)的應(yīng)用自然是提高了可用性和降低了延遲。
For more information on application patterns with Service Fabric, readApplication scenariosandChoosing a programming model frameworkfor your service
有關(guān)使用Service Fabric應(yīng)用模式的更多信息,閱讀Application scenarios、Choosing a programming model framework
四、應(yīng)用程序生命周期管理Application lifecycle management
Service Fabric provides first-class support for the full application lifecycle management (ALM) of cloud applications--from development through deployment, daily management, and maintenance to eventual decommissioning.
Service Fabric對云應(yīng)用完整的應(yīng)用程序生命周期管理 (ALM) 提供一流的支持 — — 從開發(fā)到部署、 日常管理和維護對最終退役。
The Service Fabric ALM capabilities enable application administrators/IT operators to use simple, low-touch workflows to provision, deploy, patch, and monitor applications. These built-in workflows greatly reduce the burden on IT operators to keep applications continuously available.
Service Fabric ALM功能讓應(yīng)用管理員/ IT 運營人員使用簡單的、“較少的面對面的接觸”的工作流來提供、部署、修補和監(jiān)控應(yīng)用程序。這些內(nèi)置的工作流大大減少 IT 運營人員維護高可用應(yīng)用的負擔。
Most applications consist of a combination of stateless and stateful microservices and other executables/runtimes deployed together. By having strong types on the applications and packaged microservices, Service Fabric enables the deployment of multiple application instances. Each instance is managed and upgraded independently. Importantly, Service Fabric is able to deployanyexecutables or runtime and make them reliable. For example, Service Fabric deploys ASP.NET Core 1, Node.js, Java VMs, scripts, or anything else that makes up your application.
大多數(shù)應(yīng)用程序是由無/有狀態(tài)微服務(wù)、可執(zhí)行文件/運行時,部署在一起的組合。通過強類型,Service Fabric可部署應(yīng)用副本、打包微服務(wù)的副本到多個應(yīng)用實例。每個實例獨立管理和獨立升級。更重要的是,Service Fabric可支持各種可執(zhí)行文件/運行時,如ASP.NET 核心 1、 Node.js、Java Vm、腳本等,對于這些可執(zhí)行文件/運行時,不僅支持部署,還提高了可靠性。
For more information on application lifecycle management, readApplication lifecycleand on deploying any code seeDeploy a guest executable
關(guān)于應(yīng)用程序生命周期管理的詳細信息,請閱讀Application lifecycle。
部署、代碼請參見Deploy a guest executable
五、關(guān)鍵功能Key capabilities
By using Service Fabric, you can:
通過使用Service Fabric,您可以︰
1.Develop massively scalable applications that are self-healing.
1.開發(fā)具有自我恢復(fù)功能的大規(guī)模的可伸縮的應(yīng)用。
2.Develop applications composed of microservices using the Service Fabric programming model. Or, simply host guest executables and other application frameworks of your choice, such as ASP.NET Core 1, or Node.js.
2.用Service Fabric編程模型可開發(fā)微服務(wù)應(yīng)用,或只是簡單承載客戶端應(yīng)用、應(yīng)用程序框架,如ASP.NET Core 1、 Node.js。
3.Develop highly reliable stateless and stateful microservices.
3.開發(fā)高可靠的無/有狀態(tài)微服務(wù)。
4.Simplify the design of your application by using stateful microservices in place of caches and queues.
4.通過有狀態(tài)微服務(wù)(取消使用緩存和隊列) 簡化應(yīng)用程序的設(shè)計。
5.Deploy to Azure or to on-premises clouds running Windows Server or Linux with zero code changes. Write once and then deploy anywhere to any Service Fabric cluster.
5.無需為切換 Azure 或私有云、或 Windows 或 Linux部署而寫代碼。寫代碼一次,可部署到任何Service Fabric群集。
6.Develop with a "datacenter on your machine" approach. The local development environment is the same code that runs in the Azure datacenters.
6.可用 "datacenter on your machine"方式開發(fā)。同一套代碼無需變更就可運行在本地開發(fā)環(huán)境和Azure 數(shù)據(jù)中心。
7.Deploy applications in seconds.
7.在幾秒鐘內(nèi)可完成應(yīng)用部署。
8.Deploy applications at higher density than virtual machines, deploying hundreds or thousands of applications per machine.
8.能比虛擬機方式部署部署更高密度的應(yīng)用,可每服務(wù)器部署數(shù)百或數(shù)以千計的應(yīng)用。
9.Deploy different versions of the same application side by side, each independently upgradable.
9.可同時部署同一應(yīng)用的不同版本,每個應(yīng)用副本可獨立升級。
10.Manage the lifecycle of your stateful applications without any downtime, including breaking and nonbreaking upgrades.
10.讓你的有狀態(tài)應(yīng)用沒有停機時間,即使中斷升級或升級中。
11.Manage applications using .NET APIs, PowerShell, or REST interfaces.
11.可通過.NET API、 PowerShell、 REST接口管理應(yīng)用。
12.Upgrade and patch microservices within applications independently.
12.可獨立升級和修補應(yīng)用內(nèi)的各微服務(wù)。
13.Monitor and diagnose the health of your applications and set policies for performing automatic repairs.
13.可監(jiān)視和診斷應(yīng)用的健康狀況,可設(shè)置策略來執(zhí)行應(yīng)用的自動修理。
14.Scale up or scale down your Service Fabric cluster easily, knowing that the applications scale according to available resources.
14.易于擴展或縮小Service Fabric群集,易于根據(jù)現(xiàn)有資源判斷是否滿足應(yīng)用規(guī)模的增長。在根據(jù)可用的資源了解應(yīng)用程序規(guī)模的情況下,輕松增加或減少 Service Fabric 群集。
15.Watch the self-healing resource balancer orchestrate the redistribution of applications across the cluster. Service Fabric recovers from failures and optimizes the distribution of load based on available resources.
15.Service Fabric能通過重新編排、分配現(xiàn)有可用的資源,來恢復(fù)故障節(jié)點,或進行負載優(yōu)化,而且這種重新分配是跨集群進行的。這種機制就是所謂的“具有自我恢復(fù)能力的資源平衡器”。觀看可自我修復(fù)的資源平衡器如何在群集間協(xié)調(diào)重新分發(fā)應(yīng)用程序。Service Fabric 可從故障中恢復(fù),并基于可用資源優(yōu)化負載分布。
六、相關(guān)內(nèi)容Next steps
For more information:
Why a microservices approach to building applications?
Terminology overview
Setting up your Service Fabricdevelopment environment
Choosing a programming model frameworkfor your service
1.為何要用微服務(wù)?
2.Service Fabric 術(shù)語
3.配置Service Fabric開發(fā)環(huán)境
4.為你的服務(wù)選擇編程模型框架