Azure Service Fabric reliable actors vs reliable services

spdev picture spdev · Apr 6, 2016 · Viewed 8.2k times · Source

I am new to Azure Service Fabric and the biggest questions I have are

  1. When should I use reliable actors? Give me practical examples please.
  2. When should I use reliable services? Give me practical examples please.

Answer

Pascal Naber picture Pascal Naber · Apr 6, 2016

Taken a look at the differences:

  • State analogy : Actors work on a single instance of an object graph. Services usually have state for multiple callers.
  • Scope : Actors can’t work alone, because of their size (more like objects).
  • Life-cycle : Actors are only active when used, so more will fit on your available server resources
  • Concurrency : Actors enforce single threaded access
  • State : Actors just modify the aggregate, services work on sets so often use transactions on sets for ACID behavior.
  • Communication : Actors communicate through channels provided by the platform. Services may choose otherwise.
  • Access : Actors in the cluster can’t be reached from the outside by default. You’ll probably need a Service that provides access.

Samples when to use an actor:

  • For every user of your mobile app you could have one actor.
  • For every thermostat that sends information to your application you could have one actor.
  • For every customer of your e-commerce site, you could have one shopping-basket actor.

Create a service in the cases that you are probably used to. Create a reliable service that provides a service for multiple users at once. For example a weather service.