Cosmos DB State Store documentation should include a performance optimisation section #3698
Labels
area/components
content/incorrect-information
Content in the docs is incorrect
help wanted
Extra attention is needed
Describe the issue
For those who are using Dapr as their only mechanism for interacting with Cosmos DB, unless they are specifically using the
QueryStateAsync
method (from the .NET SDK), or their language equivalent, they have no specific need to index the entire document in Cosmos DB. This process of indexing the document is an expensive operation, increases the amount of RU/s used and ultimately increases the latency of update (PUT) operations. The Dapr documentation should mention that for anyone looking to optimise the performance of their Cosmos installation, they can exclude property indexing from the indexing pattern. This is helped by the fact that theid
andpartitionKey
fields are automatically indexed. This allows us to skip indexing the entire document with each update.Further extending the above, the indexing mode can be changed from
consistent
tolazy
with relative safety when using actors as the actor nature protects the system from any issues arising around the indexing mode.For example, in Terraform, by default it reads as follows:
URL of the docs
https://docs.dapr.io/reference/components-reference/supported-state-stores/setup-azure-cosmosdb/
Expected content
A specific section detailing techniques for performance optimisations should be added to the page guiding users on ways to improve performance. The above Terraform could read as follows:
Screenshots
N/A
Additional context
It should be noted that the performance of queries, stored procedures, etc. will be slowed down by excluding all properties from indexing. If that is part of the users workflow, they should not make this change. They should only consider this if they are running into any performance issues with Cosmos DB latencies and are deliberately only using the Dapr state store interactions for
GetStateAsync
,SaveStateAsync
, etc. (from .NET land).The text was updated successfully, but these errors were encountered: