Kurubaran
Kurubaran

Reputation: 8902

Restrict to one service instance within all the service fabric nodes

I have a stateless service fabric service which basically does a batch processing at specified time interval. So having multiple instances would complicate things as each instance would try to do the same batch job.

I strictly want to run a single batch process. Currently I have set the InstanceCount of this service to 1 in ApplicationManifest.xml. What will happen if there are multiple nodes? Would I still have single instance of this service? or how do I make sure this service has single instance regardless or number of Nodes/Partitions?

Upvotes: 3

Views: 735

Answers (1)

Peter Bons
Peter Bons

Reputation: 29800

Currently I have set the InstanceCount of this service to 1 in ApplicationManifest.xml. What will happen if there are multiple nodes? Would I still have single instance of this service?

If there are multiple nodes only one will contain the primary, active instance. Other nodes may host replica's that will take over when needed, for example when the node where the primary instance lives goes down.

how do I make sure this service has single instance regardless or number of Nodes/Partitions?

We have covered multiple nodes in the first part of the answer. Regarding partitions: stateless services only have 1 partition so it does not play a role regarding to your question.

For more background material read the docs about the service lifecycle and about replica lifecycles

Upvotes: 3

Related Questions