作者: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是一個(gè)分布式的系統(tǒng)平臺(tái)红省,可幫助人們更容易地打包推捐、 部署、管理高伸縮性和高可靠的微服務(wù)(microservices)滑沧。同時(shí)Service Fabric還可幫助人們處理一些云應(yīng)用開發(fā)和管理中遇到的重大挑戰(zhàn)。開發(fā)人員和管理員可以不再將精力放在解決復(fù)雜的基礎(chǔ)設(shè)施問題涯肩、要求苛刻的高負(fù)載問題屡江,而將精力集中在處理業(yè)務(wù)領(lǐng)域關(guān)鍵問題,因?yàn)镾ervice Fabric代表著可伸縮岔擂、高可靠和易于管理位喂。Service Fabric是下一代中間件平臺(tái),可用于構(gòu)建并管理企業(yè)級(jí)規(guī)模的乱灵、一級(jí)云規(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)用將運(yùn)行在由大量機(jī)器組成的服務(wù)器共享池(稱為群集)规婆。它可以提供原本復(fù)雜的在線的構(gòu)建分布式、 高伸縮性的無狀態(tài)/有狀態(tài) microservices蝉稳。它還能為資源調(diào)配抒蚜、 部署、 監(jiān)控耘戚、 升級(jí)/打補(bǔ)丁等提供全面的應(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.
有人會(huì)問: microservices 重要嗎毕莱?有兩個(gè)原因︰
1.它們能夠根據(jù)需要擴(kuò)展的應(yīng)用的不同部分器贩。
2.開發(fā)團(tuán)隊(duì)能夠更加敏捷颅夺,更加適應(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支持當(dāng)今許多微軟服務(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ī)模一直成長(zhǎng)到數(shù)百或數(shù)千臺(tái)計(jì)算機(jī)的大規(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.
當(dāng)今的互聯(lián)網(wǎng)規(guī)模的服務(wù)是由微服務(wù)構(gòu)成的。例如協(xié)議網(wǎng)關(guān)伸蚯,用戶配置文件摩渺,購物車,庫存處理剂邮,隊(duì)列和高速緩存摇幻。Service Fabric是一種微服務(wù)平臺(tái),它賦于每個(gè)微服務(wù)一個(gè)唯一名稱挥萌,無論微服務(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對(duì)由微服務(wù)組成的應(yīng)用提供全面的在線管理瑞眼、全生命周期管理功能。它承載各類容器(containers)以部署和激活跨Service Fabric集群的微服務(wù)棵逊。如果從虛擬機(jī)進(jìn)化為容器使得服務(wù)密度能數(shù)量級(jí)增加伤疙,那么,從容器進(jìn)化為微服務(wù)能進(jìn)一步數(shù)量級(jí)地增加可管理的服務(wù)的密度辆影。舉個(gè)例子徒像,一個(gè)單一的Azure SQL數(shù)據(jù)庫群集由數(shù)百臺(tái)的服務(wù)器、數(shù)以萬計(jì)的容器蛙讥、數(shù)以十萬計(jì)的數(shù)據(jù)庫組成的锯蛀,其中每個(gè)數(shù)據(jù)庫都是Service Fabric上持有狀態(tài)的微服務(wù)。前面提到的其他微軟服務(wù)也是類似的次慢,這就是為什么用“超大規(guī)呐缘樱”一詞來描述Service Fabric的容量翔曲,因?yàn)槿绻萜髂芙o你高密度,那么微服務(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)境上運(yùn)行肚菠,它就能直接部署到其他環(huán)境運(yù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使您能夠建立一個(gè)支持微服務(wù)的應(yīng)用程序靴庆。無狀態(tài)微服務(wù)(協(xié)議網(wǎng)關(guān)时捌,Web代理,等)不保持任何請(qǐng)求的響應(yīng)處理期外的狀態(tài)炉抒。Azure云服務(wù)工作者角色是一個(gè)無狀態(tài)服務(wù)的例子奢讨。有狀態(tài)微服務(wù)(用戶帳戶,數(shù)據(jù)庫焰薄,設(shè)備拿诸,購物車,隊(duì)列等)保持請(qǐng)求的狀態(tài)塞茅。當(dāng)今互聯(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ù)一同使用野瘦?因?yàn)?br>
1.構(gòu)建高吞吐量描沟、 低延遲、 故障容錯(cuò)的聯(lián)機(jī)事務(wù)處理 (OLTP) 服務(wù)的需要鞭光。通過“有狀態(tài)”讓同一臺(tái)計(jì)算機(jī)上的代碼和數(shù)據(jù)盡可能靠近吏廉,有力地保證了這些能力。一些例子:交互式店面惰许、 搜索席覆、 物聯(lián)網(wǎng) (IoT) 系統(tǒng)、 交易系統(tǒng)汹买、 信用卡處理佩伤、欺詐檢測(cè)系統(tǒng)聊倔、個(gè)人記錄管理。
2.應(yīng)用程序設(shè)計(jì)的簡(jiǎn)化畦戒。有狀態(tài)的微服務(wù)不再需要額外的隊(duì)列和緩存方案方库,這些手段是解決純粹無狀態(tài)導(dǎo)致用戶體驗(yàn)問題和響應(yīng)延遲問題的傳統(tǒng)方案。減少了這些部件障斋,作為一個(gè)整體纵潦,等于減少了管理的數(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對(duì)云應(yīng)用完整的應(yīng)用程序生命周期管理 (ALM) 提供一流的支持 — — 從開發(fā)到部署寥院、 日常管理和維護(hù)對(duì)最終退役。
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 運(yùn)營人員使用簡(jiǎn)單的涛目、“較少的面對(duì)面的接觸”的工作流來提供秸谢、部署、修補(bǔ)和監(jiān)控應(yīng)用程序霹肝。這些內(nèi)置的工作流大大減少 IT 運(yùn)營人員維護(hù)高可用應(yīng)用的負(fù)擔(dān)估蹄。
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í)行文件/運(yùn)行時(shí)沫换,部署在一起的組合臭蚁。通過強(qiáng)類型,Service Fabric可部署應(yīng)用副本讯赏、打包微服務(wù)的副本到多個(gè)應(yīng)用實(shí)例垮兑。每個(gè)實(shí)例獨(dú)立管理和獨(dú)立升級(jí)。更重要的是漱挎,Service Fabric可支持各種可執(zhí)行文件/運(yùn)行時(shí)系枪,如ASP.NET 核心 1、 Node.js磕谅、Java Vm私爷、腳本等,對(duì)于這些可執(zhí)行文件/運(yùn)行時(shí)怜庸,不僅支持部署当犯,還提高了可靠性垢村。
For more information on application lifecycle management, readApplication lifecycleand on deploying any code seeDeploy a guest executable
關(guān)于應(yīng)用程序生命周期管理的詳細(xì)信息割疾,請(qǐng)閱讀Application lifecycle。
部署嘉栓、代碼請(qǐng)參見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)用麻昼,或只是簡(jiǎn)單承載客戶端應(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ù)(取消使用緩存和隊(duì)列) 簡(jiǎn)化應(yīng)用程序的設(shè)計(jì)叉抡。
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ā)。同一套代碼無需變更就可運(yùn)行在本地開發(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.能比虛擬機(jī)方式部署部署更高密度的應(yīng)用,可每服務(wù)器部署數(shù)百或數(shù)以千計(jì)的應(yīng)用撵颊。
9.Deploy different versions of the same application side by side, each independently upgradable.
9.可同時(shí)部署同一應(yīng)用的不同版本宇攻,每個(gè)應(yīng)用副本可獨(dú)立升級(jí)。
10.Manage the lifecycle of your stateful applications without any downtime, including breaking and nonbreaking upgrades.
10.讓你的有狀態(tài)應(yīng)用沒有停機(jī)時(shí)間秦驯,即使中斷升級(jí)或升級(jí)中尺碰。
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.可獨(dú)立升級(jí)和修補(bǔ)應(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)用的自動(dòng)修理题篷。
14.Scale up or scale down your Service Fabric cluster easily, knowing that the applications scale according to available resources.
14.易于擴(kuò)展或縮小Service Fabric群集,易于根據(jù)現(xiàn)有資源判斷是否滿足應(yīng)用規(guī)模的增長(zhǎng)厅目。在根據(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é)點(diǎn),或進(jìn)行負(fù)載優(yōu)化拗馒,而且這種重新分配是跨集群進(jìn)行的路星。這種機(jī)制就是所謂的“具有自我恢復(fù)能力的資源平衡器”。觀看可自我修復(fù)的資源平衡器如何在群集間協(xié)調(diào)重新分發(fā)應(yīng)用程序诱桂。Service Fabric 可從故障中恢復(fù)洋丐,并基于可用資源優(yōu)化負(fù)載分布呈昔。
六、相關(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ù)選擇編程模型框架