cosmosDB RU 吞吐量如何強制執行 (How is cosmosDB RU throughput enforced)


問題描述

cosmosDB RU 吞吐量如何強制執行 (How is cosmosDB RU throughput enforced)

我有一個設置為 400 RU/s 的 cosmosGB gremlin API。如果我必須運行一個需要 800 RU 的查詢,這是否意味著該查詢需要 2 秒才能執行?如果我將吞吐量增加到 1600 RU/s,這個查詢會在半秒內執行嗎?通過使用 RU,我沒有看到查詢性能有任何顯著變化。


參考解法

方法 1:

As I explained in a different, but somewhat related answer here, Request Units are allocated on a per‑second basis. In the event a given query will cost more than the number of Request Units available in that one‑second window:

  • The query will be executed
  • You will now be in "debt" by the overage in Request Units
  • You will be throttled until your "debt" is paid off

  • </ul>

    Let's say you had 400 RU/sec, and you executed a query that cost 800 RU. It would complete, but then you'd be in debt for around 2 seconds (400 RU per second, times two seconds). At this point, you wouldn't be throttled anymore.

    The speed in which a query executes does not depend on the number of RU allocated. Whether you had 1,000 RU/second OR 100,000 RU/second, a query would run in the same amount of time (aside from any throttle time preventing the query from running initially). So, aside from throttling, your 800 RU query would run consistently, regardless of RU count.

    方法 2:

    A single query is charged a given amount of request units, so it's not quite accurate to say "query needs 800 RU/s". A 1KB doc read is 1 RU, and writing is more expensive starting around 10 RU each. Generally you should avoid any requests that would individually be more than say 50, and that is probably high. In my experience, I try to keep the individual charge for each operation as low as possible, usually under 20‑30 for large list queries.

    The upshot is that 400/s is more than enough to at least complete 1 query. It's when you have multiple attempts that combine for overage in the timespan that Cosmos tells you to wait some time before being allowed to succeed again. This is dynamic and based on a more or less black box formula. It's not necessarily a simple division of allowance by charge, and no individual request would be faster or slower based on the limit.

    You can see if you're getting throttled by inspecting the response, or monitor by checking the Azure dashboard metrics.

    (by Michael ScottDavid MakogonNoah Stahl)

    參考文件

    1. How is cosmosDB RU throughput enforced (CC BY‑SA 2.5/3.0/4.0)

#azure #azure-cosmosdb-gremlinapi #azure-cosmosdb






相關問題

將屬性添加到 Azure 表存儲中的實體似乎會將空屬性添加到表中的所有實體 (Adding property to entity in Azure Table Storage seems to add null property to all entities in table)

帶有 Azure WCF 服務的 Windows 8 應用 (Windows 8 App with Azure WCF Service)

當我嘗試查看連接到 TFS 的網站的部署選項卡時,無法檢索部署歷史記錄 (Failed to retrieve deployment history when I try to view the deployment tab of a web site connected to TFS)

是否可以在單個 Azure 項目中同時使用 New Relic 和 Azure Application Insights? (Is it possible to use both New Relic and Azure Application Insights together in single Azure project?)

有沒有辦法從 Azure 中獲取所有 DocumentDb 資源? (Is there a way to fetch all DocumentDb resoruces from Azure?)

Azure Search .Net SDK 中的複雜類型支持 (Complex Types support in Azure Search .Net SDK)

遠程服務器返回錯誤:(400) 錯誤請求。在 C:\Program Files\WindowsPowerShell\Modules\CosmosDB\3.1.0.293\CosmosDB.psm1 (The remote server returned an error: (400) Bad Request. At C:\Program Files\WindowsPowerShell\Modules\CosmosDB\3.1.0.293\CosmosDB.psm1)

如何從狀態“False(MissingEndpoints)”啟用 kube-system/metrics-server? (How to enable kube-system/metrics-server from status "False (MissingEndpoints)"?)

通過 smtp 從安裝為 azure 中的 IaaS 的服務器發送電子郵件 (sending emails via smtp from a server installed as IaaS in azure)

cosmosDB RU 吞吐量如何強制執行 (How is cosmosDB RU throughput enforced)

在使用 azure 流量管理器和 azure 應用程序網關與 WAF 時實現國家級阻止 (Achieve country level blocking while using azure traffic manager and azure application gateway with WAF)

Azure 計算機視覺將圖像旋轉 180 度 (Azure Computer Vision Rotating the image By 180 degrees)







留言討論