user1932923
user1932923

Reputation: 384

Composite Partitioning using .NET SDK (Document DB)

We are looking to implement Lookup-Hash portioning strategy and I was wondering if this is possible using .NET SDK.

Essentially, we were thinking of creating a lookup map and create a resolver based on that and then use same collections used in lookup and generate the hash resolver. Is this the right approach?

Upvotes: 0

Views: 169

Answers (1)

Kirat P.
Kirat P.

Reputation: 76

Generally speaking, if you can, you should use the PartitionResolver in the DocumentDB SDKs. That resolver uses a consistent hashing algorithm which will evenly spread your data against the available collections.

If, however, your data is structured where you know that certain documents need to be either in the same collection or evenly partitioned (consistency vs. load balancing/perf.) then rolling your own lookup-based resolver would work.

If you do want to roll your own, the strategy your described would work well. The things to think through would be

  • You can put lookup items in a single collection but that will create a bottleneck in lookups. A good strategy would be to fan out your lookups using the SDK ParitionResolver
  • Using the lookup fan out I described above, you can chose to intermingle your lookup objects and lookup data in the same database account/set of collections.

Upvotes: 2

Related Questions