0

The service fabric documentation doesn't explicitly define the ordering of keys in a Reliable Dictionary during enumeration. A quick test enumerates this using key-order, regardless of insertion order.

  1. Is the key-ordering intentional? Can I write my services assuming that the first key will always be the smallest value?
  2. What is the data structure that powers the key index?
  3. If its not a well-known data structure, what is the time complexity of add/delete/get/update?
  4. Is efficient enumeration from the reverse possible?
  5. Are key-range queries possible?
tejas
  • 607
  • 6
  • 11

1 Answers1

1

Writes and Point Gets: Commits go into a hashtable initially and then gets moved into a sorted data structure post checkpoint. So your Adds/Updates/Deletes will have best case runtime of O(1) and worst case runtime of O(log n)(validation to check the presence of your key might make it O(log n)since we do not do blind writes)

Gets might be O(1) or O(log n) depending on whether you are reading from a recent commit or from an older commit.

Enumeration: To make enumeration efficient, contents of the hahstable get added into a temporary sorted data structure until it is moved into the main sorted data structure post checkpoint. So it is O(log n).

Key range queries are possible. You can use the overload that takes in a filter.

In our next version, we will expose the api with start range and end range and sorting (ascending and descending).

  • Can you comment on the efficiency of doing a key range query right now? i.e. if I do "where key < N", is this smart enough to stop the iteration when key exceeds N, given that your keys are ordered in the data structure? – tejas May 10 '18 at 10:01