您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

Service Fabric 应用程序方案Service Fabric application scenarios

Azure Service Fabric 提供了一个可靠而灵活的平台,可用于编写和运行多种类型的商业应用程序和服务。Azure Service Fabric offers a reliable and flexible platform that enables you to write and run many types of business applications and services. 这些应用程序和微服务可以为无状态或有状态,并且它们在各虚拟机间的资源平衡,可最大限度提高工作效率。These applications and microservices can be stateless or stateful, and they are 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 平台非常适合于以下应用程序类型:The Service Fabric platform is ideal for the following types of applications:

  • 数据收集、 处理和 IoT:由于 Service Fabric 处理大规模并且已通过其有状态服务的低延迟,因此它非常适用于数以百万计的设备上的数据处理位置设备和计算的数据位于相同位置。Data gathering, processing, and IoT: Since Service Fabric handles large scale and has low latency through its stateful services, it is ideal for data processing on millions of devices where the data for the device and the computation are colocated.

    构建 IoT 服务使用 Service Fabric 的客户包括HoneywellPCL ConstructionCrestronBMWSchneider Electric,并网格系统Customers who have built IoT services 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 ideal 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 FabricVisit Azure gaming solutions for design guidance on using Service Fabric in gaming services

    构建游戏服务的客户包括Next GamesDigamoreCustomers who have built gaming services include Next Games and Digamore. 已生成的交互式会话的客户包括与 Hololens HoneywellCustomers 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 also benefit from the optimized reads and writes in Service Fabric. 此外,Service Fabric 支持应用程序处理管道,其中结果必须可靠地传递到下一处理阶段不会丢失任何。Furthermore, Service Fabric supports application processing pipelines, where results must be reliable and passed on to the next processing stage without any loss. 这包括交易和财务系统,其中的数据一致性和计算保证至关重要。These include transactional and financial systems, where data consistency and computation guarantees are essential.

    构建业务工作流服务的客户包括Zeiss 组DigamoreCustomers who have built business workflow services include Zeiss Group and Digamore

  • 数据计算:Service Fabric,可以生成数据计算密集型有状态应用程序。Computation on data: Service Fabric enables you to build data computation intensive stateful applications. Service Fabric 允许在应用程序的处理 (计算) 和数据归置。Service Fabric allows the co-location 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 服务,可消除该延迟,从而使进一步优化读取和写入。With stateful Service Fabric services, that latency is eliminated, 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 (where the computation of recommendation selection is colocated with the data and rules) provides a responsive experience to the user compared with the standard implementation model of having to fetch the necessary data from remote storage.

    已生成计算服务的客户包括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. 此外,还可以动态创建并删除单独的服务。In addition, individual services can be created and removed on the fly. 服务可以快速轻松地将从几个节点上的几个实例扩展到数千个多个节点上的实例,然后再次缩小,具体取决于你的资源需求。Services can quickly and easily be scaled out from a few instances on a few nodes to thousands of instances on many nodes, and then scaled in again, depending on your resource needs. Service Fabric 可用于构建这些服务和管理其完整的生命周期。You can use Service Fabric to build these services and manage their complete life cycles.

应用程序设计案例研究Application design case studies

案例研究介绍如何使用 Service Fabric 设计应用程序的大量发布在客户案例微服务解决方案站点A number of case studies showing how Service Fabric is used to design applications are published on customer stories and the microservices solutions site.

设计由无状态和有状态微服务组成的应用程序Design applications composed of stateless and stateful microservices

具有 Azure 云服务辅助角色的生成应用程序是无状态服务的一个示例。Building applications with Azure Cloud Service 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 的有状态服务使高可用性变得大众化,将其引入所有类型的应用程序,而不仅仅是数据库和其他数据存储。Service Fabric's stateful services democratize high availability, bringing it 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 等)组合调用应用于无状态和有状态业务中间层服务,这些服务使用 Service Fabric 部署命令全部部署到了同一 Service Fabric 群集中。When building applications consisting of microservices, you typically have a combination of stateless web apps (ASP.NET, Node.js, etc.) calling onto stateless and stateful business middle-tier services, all deployed into the same Service Fabric cluster using the Service Fabric deployment commands. 每个服务是独立缩放、 可靠性和资源使用情况,从而大大提高敏捷性和灵活性在开发和生命周期管理方面。Each of these services is independent with regard to scale, reliability, and resource usage, greatly improving 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. 由于有状态服务自然具有高可用性和低延迟,有作为一个整体应用程序中管理的移动部件更少。Since stateful services naturally have high availability and low latency, there are fewer moving parts to manage in your application as a whole. 下图说明了设计有状态应用程序与无状态应用程序之间的差异。The diagrams below illustrate the differences between designing an application that is stateless and one that is 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.

使用无状态服务生成的应用程序An application built using stateless services

使用无状态服务的应用程序

使用有状态服务生成的应用程序An application built using stateful services

使用无状态服务的应用程序

后续步骤Next steps