0

Our Cosmos DB has 3 global regions and multi-master is enabled. We only index few things, so I think the indexing won't cost much. The calculator shows that upserting one 2MB document should cost 1250 RU per region. enter image description here However, the request charge we get from response is 7512.58.

RequestStartTime: 2020-05-12T00:22:59.1387647Z, RequestEndTime: 2020-05-12T00:22:59.2492807Z, Number of regions attempted:1 ResponseTime: 2020-05-12T00:22:59.2492807Z, StoreResult: StorePhysicalAddress: rntbd://sn4prdddc07-docdb-2.documents.azure.com:14090/apps/f5b76cfe-f8cb-4079-8e0a-f1d5062ab650/services/584a5bbb-51ba-4911-b85f-65cb3d036d77/partitions/eacdf9bb-7b21-43ec-892c-f9d39360bec4/replicas/132323144644691971p/, LSN: 37839654, GlobalCommittedLsn: 37839653, PartitionKeyRangeId: 53, IsValid: True, StatusCode: 200, SubStatusCode: 0, RequestCharge: 7512.58, ItemLSN: -1, SessionToken: 48#37839654#2=19712326#5=20410763, UsingLocalLSN: False, TransportException: null, ResourceType: Document, OperationType: Upsert

The second weird thing is the normalized RU consumption can reach 100% sometimes even the provisioned throughput is 11.72k RU/s on each physical partition but we only upsert 2MB document for 2 times on one same partition in one second.

My questions are:

  1. How to understand the request charge of 7512.58? It's about 6 times as the capacity calculator shows. So I guess the number takes the 3 global regions(x3) and multi-master(x2) into consideration?

  2. Why RU consumption can reach 100% when we provision 11.72k RU/s per physical partition and there are only 2 upsert on one physical partition in one second? Is this expected?

Similar question: How does CosmosDb charge RUs for write operations in a multi-master enironment?

David Makogon
  • 69,407
  • 21
  • 141
  • 189
Yue Xu
  • 131
  • 1
  • 6
  • 1
    Your error message implies that you're performing an *upsert*, vs an *insert*, which likely explains the additional cost. What happens if you just do an *insert*? Also - just an aside, I'd re-examine your data schema to see if you can reduce document size. 2MB seems excessively large (I usually only see documents that large when there is binary, non-metadata content, or unbounded arrays). – David Makogon May 12 '20 at 15:12
  • @DavidMakogon Our scenario needs both update and insert, so we have to use upsert. The reported cost is 6 times as estimated, which should not only be "additional cost". And yes, we are working on reducing our document size. – Yue Xu May 13 '20 at 06:45

0 Answers0