简体   繁体   中英

Azure Storage Account Blobs container size

Is there a way to get the total size of the blobs in a storage account blobs container without iterating over them and summing up the length?

Preferably from the Java API or CLI.

We are required to get the up to date size on a regular basis and will have a large amount of blobs in the container, and we will have a lot of containers, therefore its not feasible to iterate over the blobs every time to get the sizes.

I am afraid it's not possible to bypass blob listing and summing up operation to get the size of container(ie blobs inside it). All SDKs are based on REST API , which includes all operation interfaces exposed to us. According to those APIs, we can only get the list of blobs and sum up their content length.

See an official example. There's a Calculate size on Azure portal, right click on our container and click Container properties , we can see panel as below. Try to catch the http traffic, we can see it calls list blob operation. The Learn more link shows a powershell script to realize the unavoidable process. (Note that once blob count is over 5000, Calculate size displays Blob Count>5000 and Size>XXMiB).

计算大小

也许您可以使用Azure Monitor API,而该API本身将使用Azure Metrics,因此可以通过REST调用其API,随着时间的推移它会保留统计信息,因此也许您可以通过它来获得所需的信息,否则我看不到任何其他方法。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM