question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RU calculation from ItemResponse

See original GitHub issue

Hello, we’re kind of confused by tracking the RU spent with RequestCharge from ItemResponse using current SDK v3, we’ve referred the documentation via here, however, in our scenario, we found our RU from reading one document is always 1…so for reading 80 items the total RU is 80…And it never changes no matter how many documents existed in our collection or if our document schema changes… Which doesn’t seem to be correct number compared to use SQL Query within azure portal.

Here is a screenshot of our code implementation and output result: image

image

Thank you very much for your help!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bartelinkcommented, Aug 27, 2019

A point read of one item of < 1024b is literally defined as being 1 RU (1 RU per KiB or part thereof), and intentionally is not affected by amount of records etc. Perhaps you’re comparing with charges for queries? even a query that yields a single document with a basic query has a completely different set of charges - definitely strongly recommend reading the charging model docs - its the real instructions on how to best use CosmosDB.

0reactions
bartelinkcommented, Aug 27, 2019

CosmosExceptions have RU counts as a property too (one reason being if you invoke a stored proc etc., it can incur plenty cost before failing).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Find request unit charge for a SQL query in Azure Cosmos ...
The cost of all database operations is normalized by Azure Cosmos DB and is expressed by request units (RU). Request charge is the...
Read more >
Find RequestCharge when using LINQ query in ...
When I use CreateItemAsync then I get an ItemResponse which allows me to access the RequestCharge in RU and possibly log it so...
Read more >
Troubleshooting Azure Cosmos DB Performance
To get the most accurate estimate for RU/s needs for your applications, you can follow the same pattern to estimate RU/s needs for...
Read more >
Calculating Cosmos DB Request Units (RU ... - Maxime Rouiller
Request units are a normalized number that represents the amount of computing power (read: CPU) required to serve the request. Inserting new ...
Read more >
Calculating Cosmos DB Request Units (RU) for ... - YouTube
Calculating Cosmos DB Request Units ( RU ) for CRUD and Queries · Comments2.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found