Azure Service Fabric usage

前端 未结 3 1050
执笔经年
执笔经年 2020-12-21 05:53

Service Fabric was just announced at the build conference. I was reading the scarce documentation about it and I have a question.

I\'m evaluating Service Fabric for

相关标签:
3条回答
  • 2020-12-21 06:28

    Service Fabric enables the creation of both stateless and stateful microservices.

    As the name suggests, any state maintained by an an instance of a stateless service will be lost if the node goes down. A new, fresh instance will simply be spun up elsewhere in the cluster.

    Stateful services offer the ability to persist state without relying on an external store. Any data stored in a Reliable Collection will be automatically replicated across multiple nodes in the cluster, ensuring that the state is resilient to failures.

    A common pattern is to use a stateless service as the client-facing gateway to the application and then have that service direct traffic to the app's partitioned stateful services. This hides the work of resolving partitions from clients, allowing them to to target one logical endpoint with all requests.

    Take a look at the WordCount sample for an example of how this works. The WordCount.WebService stateless service acts as the front end to the application. It simply resolves the partition based on the incoming request and then sends it on. The WordCount.Service stateful service (partitioned based on the first letter of the word) immediately puts those incoming requests in a ReliableQueue and then processes them in the background, storing the results in a ReliableDictionary.

    For more details, see the Reliable Services Overview.

    Note: for now, the best way to expose WebAPI endpoints to clients is to self-host an OWIN server in the stateless service. ASP.NET 5 projects will soon be supported as well.

    0 讨论(0)
  • 2020-12-21 06:30

    If you don't have state (or have it externally), Stateless Service is the way to start.

    Answer to the original question is "both". Basically, anything that have main() function (with couple of more extended contract methods to talk to Service Fabric) can be a service in Service Fabric world.

    0 讨论(0)
  • 2020-12-21 06:48

    This video answers my own question: http://channel9.msdn.com/Events/Build/2015/2-704. In summary, we should use Stateless Services to host ASP.NET based sites or API's which persist data to external data stores.

    0 讨论(0)
提交回复
热议问题