user1496062
user1496062

Reputation: 1317

ReliableDictionary <key, List>

Is there any nice way to do a IReliableDictionary<key,List> ? I would imagine that the list would not be atomic and run into concurrency issues. Is there any nice way to do this ? I could imagine it would be useful for building indexes as well. eg IReliableDictionary<index,List<Guid>>.

Upvotes: 1

Views: 331

Answers (1)

Vaclav Turecek
Vaclav Turecek

Reputation: 9050

Not just concurrency issues, but data corruption and poor replication performance as well if you're not careful. Read through this guide for a detailed explanation: https://azure.microsoft.com/en-us/documentation/articles/service-fabric-work-with-reliable-collections/

tl;dr:

  • Every time you commit a transaction, the entire list is replicated and saved. If the list grows indefinitely, then so does replication time and cost.
  • Your list better be immutable. If you make local changes directly to the list reference inside a transaction, and the transaction aborts (exception or something), your local changes will not be rolled back. If some other part of your code has a reference to the list and makes changes to the list outside of a transaction, those changes won't replicated and saved.

Upvotes: 2

Related Questions