Replies: 1 comment
-
For further reference the original stack question is here: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Our cosmos charges are going off the rails so we looked into trying to manage these charges better. We were going off the following documentation to attempt to get things under control. https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/how-to-dotnet-read-item. Within the documentation it states that using 'ReadManyItemsAsync' would be our cheapest option where requesting multiple items back from the collection. Our current implementation is using the 'GetItemLingQueryable'. https://docs.microsoft.com/azure/cosmos-db/sql-query-linq-to-sql
In order to test these theories, we benchmarked our original response from cosmos container...Sending 25 items that contain both the partition and ids returns us an IOrderedQueryable collection of 25 items. The total request charge is 6.75 RU.
Next Test:
Within the same method we then called the ReadManyItems and, (sending both partition[] and Ids[]) we get back the same collection of 25 items in the roughly the same amount of time +- a few ms ... but this time the cost is 9.05 RU! ??
Using the recommended 'cheaper' and 'faster' method seems to overall cost us 30% more than using the linq iterrator?? Why?
This is extremely troubling as it seems very misleading from a documentation perspective we are being recommended to use a baked in method but in reality it is 30% more overall.
A rough example of our test code is below:
It would be nice to know what the correct thing to do in the case of:
Any help of advice would be appreciated. We use IOT devices so we are hitting Cosmos thousands of times an hour. Cutting down any of our cosmos costs is paramount to us.
Beta Was this translation helpful? Give feedback.
All reactions