5
votes

We are using Azure storage to store lots of small files (~200 bytes each). Each of these files are on block blobs. If I store 1000 such files on separate block blobs, what is my storage usage: 1000 * 200 = 200KB or 1000 * 4MB (block blob size) = 4GB? There are many info on storage dashboard, however I couldn't find any info about total space used.

1

1 Answers

4
votes

It will be 200KB (total size of all files).

Regarding finding total size of space occupied by these files, you can make use of storage analytics. Blob storage size information is stored in $MetricsCapacityBlob table (Please note that this is a special table which is not included in the result when you try to list the tables in your storage account). You can find more information about the schema of this table here: https://msdn.microsoft.com/en-us/library/azure/hh343264.aspx.

If you use .Net Storage Client library, you can find the Blob Storage size for a date using code below:

        var account = new CloudStorageAccount(new StorageCredentials(accountName, accountKey), true);
        var cloudAnalyticsClient = account.CreateCloudAnalyticsClient();
        var yesterday = DateTime.UtcNow.AddDays(-1).Date;
        var query = cloudAnalyticsClient.CreateCapacityQuery().Where(f => f.PartitionKey == yesterday.ToString("yyyyMMddT0000") && f.RowKey == "data").AsTableQuery();
        var queryResult = cloudAnalyticsClient.GetCapacityTable().ExecuteQuery(query);
        foreach (var item in queryResult)
        {
            Console.WriteLine(item.PartitionKey + " : " + item.RowKey + " : " + ((double)item.Capacity / (1024 * 1024 * 1024)) + " GB");
        }