I want to create a service that is hosted using Azure Service Fabric with ASP.NET Core as the frontend.
If I have read the documentation correctly then there seem to be only two real options here for handling my session data...
1 - Create a stateless service that uses an external database such as Azure SQL for storing the session information. I can then scale by simply increasing the instance count and get more services running across the nodes. As long as the Azure SQL database can cope with the load then all is good. This is appealing because it is simple to understand and implement. But it has the extra cost of the external database.
2 - Create a stateful service that uses a reliable collection (dictionary) for storing session information. I do not want to split my sessions over multiple partitions because of the extra complication that would entail. But with a single partition I am stuck with having just a single primary server instance. This reduces the cost of having an external database. But does not scale to two or more server instances.
My reading of the documentation means you can only have a single primary server for a stateful service partition. Have I got that right? If I can have more primaries then would it be fine to have 100 primaries?
No you can't have 100 primaries. In a stateful service, partitions are how you scale. You can only perform writes against the primary replica, and the primary replica is responsible for replicating that state to the secondaries.
I'm not really sure what you mean by extra complication of multiple partitions. How would that be any different than multiple primaries. You'd still have to know which primary to save/retrieve data to/from and this would be no different than partitioning.