Say I created a stateful service fabric service with 5 partitions on a 5 node cluster. I see that each node gets 1 partition per node. When I debug the service in VS, I notice that service fabric is creating exactly 5 instances of the stateful service [essentially 1 static instance per partition] across all 5 partitions. No mater how many calls the clients make, there are only 5 instances of this class to serve requests from. Are the following statements true?
Any class level member variables in the stateful service are essentially static [since it resolves to a singleton instance on that partition] and therefore require "lock" semantics when updating?
Since the client always resolves to a the "same" instance of the class all the time for a given partition, the client can re-use the "proxy" instance?
Confirmation from Microsoft. Service fabric indeed creates 1 [ONE] instance of a "reliable service" per partition. This "singleton" instance will service all client remoting/http calls. If a failover happens to a replica, a new instance will be created.