Allow using provisioned throughput
I want to be able to deploy multiple copies of my application, all using the same Cosmos DB with provisioned and shared throughput.
Currently I'm getting "[DocumentClientException]: Provisioned throughput collection should have a partition key" if I try to point the config to a DB with provisioned throughput.
Unfortunately, by default, the cosmos provider does not configure itself to take advantage of partitioning. And for compatibility, we cannot update the default behavior.
You can opt in to recommended partitioning behavior quite easily though. On your cosmos provider declaration in config, set these two options - partitionKey="pKey" partitionNumUsedByProvider="*" - and you're good to go. You will get the maximum number of partitions, which is ok because partitioning is free in cosmos. And the more partitions you have, the easier it is to leverage and scale using Cosmos DB's provisioning controls.
(This applies to the most recent release of the cosmos provider, uploaded to nuget about a month ago.)
Thank you for your response. I'm afraid I'm just not properly understanding the use of the Cosmos DB provider.
What I need to accomplish is the ability to have a fixed cost of a multi-app deployment (think of a k8s cluster with dozens of versions of an app using the provider), with the ability to clearly identify data entries which belong to a given app for cleanup, debug or security regulation purposes.
I thought I'd be able to accomplish that by giving each app their own collection on a provisioned throughput DB, but alas it's not possible. I either need to create separately provisioned collections (way too expensive) or to have all the apps use the same collection (but then I'm not sure how to configure individual apps to tell their records apart).
What is the way to accomplish my goal?
UPD: Submitted PR https://github.com/aspnet/AspNetSessionState/pull/33
Merged #68 (Guided by #33)