官术网_书友最值得收藏!

Reliable Services

The Reliable Services framework is used for writing Microservices using traditional .NET constructs. The framework helps Service Fabric provide reliability, availability, consistency and scalability to your service. Using the Reliable Services model, you can create both stateless and stateful Microservices.

  • Stateless Reliable Service: A stateless Microservice in Service Fabric does not contain any state data that needs to be stored reliably or made highly available. There is no affinity of requests to the services, therefore stateless services store any state data in external store such as Azure SQL database or Redis cache.
  • Stateful Reliable Service: A stateful Microservice in Service Fabric can reliably maintain state that is co-located with the executing code of the Microservice. The Service Fabric platform ensures that the state data is replicated, consistent and highly available. The Service Fabric application programming framework provides a few collection types that can be used to store state data with reliability guarantees. These collection classes are part of Microsoft.ServiceFabric.Data.Collections namespace and are called Reliable Collections. High availability and strong consistency of state data in these collections is guaranteed by writing transactional state data to a majority quorum of replicas, including the primary replica.

At the time of writing, the namespace Microsoft.ServiceFabric.Data.Collections contains three collections:

  • ReliableDictionary: ReliableDictionary is similar to the ConcurrentDictionary collection in the System.Collections.Concurrent namespace. However, unlike the ConcurrentDictionary collection, it represents a replicated, transactional, and asynchronous collection of key-value pairs. Similar to ConcurrentDictionary, both the key and the value can be of any type.
  • ReliableQueue: ReliableQueue is similar to the ConcurrentQueue collection in the System.Collections.Concurrent namespace. Just like the ReliableDictionary collection, it represents a replicated, transactional, and asynchronous collection of values. However, it is a strict first-in, first-out (FIFO) queue. The value stored in a ReliableQueue can be of any type.
  • ReliableConcurrentQueue: ReliableConcurrentQueue is a new Reliable Collection of persisted, replicated values that allows concurrent reads and writes with best-effort. FIFO ordering. ReliableConcurrentQueue supports higher throughput and therefore does not guarantee FIFO behavior like the ReliableQueue does. Also, while ReliableQueue restricts concurrent consumers and producers to a maximum of one each, ReliableConcurrentQueue imposes no such restriction, allowing multiple concurrent consumers and producers.

We will learn more about Reliable Services in the next chapter.

主站蜘蛛池模板: 平顺县| 汕头市| 富宁县| 宝清县| 如皋市| 保亭| 江油市| 应城市| 建阳市| 柳林县| 邻水| 黄梅县| 西丰县| 遂宁市| 栾城县| 于田县| 嵊州市| 托里县| 嵊州市| 宁波市| 金塔县| 搜索| 都安| 沁阳市| 温宿县| 阳泉市| 新安县| 隆子县| 无锡市| 桓台县| 邻水| 道孚县| 化州市| 汕头市| 英超| 安达市| 巴彦淖尔市| 柳州市| 瓮安县| 石屏县| 紫金县|