Search code examples
azureazure-storageazure-blob-storage

Azure Blob Storage - What exactly does "Write Operations" mean?


I'm using the Azure Pricing Calculator for estimating storage costs for files (more specifically, SQL backups).

I'm currently selecting Block Blob Storage with Blob Storage account type.

There's a section in the pricing calculator that shows the cost of Write Operations and describes which API calls are Write Ops:

The following API calls are considered Write Operations: PutBlob, PutBlock, PutBlockList, AppendBlock, SnapshotBlob, CopyBlob and SetBlobTier (when it moves a Blob from Hot to Cool, Cool to Archive or Hot to Archive).

I looked at the docs for PutBlob and PutBlock, but both don't really seem to mention "file" at all anywhere (except for PubBlob which mentions a filename).

The PutBlob description says:

The Put Blob operation creates a new block, page, or append blob, or updates the content of an existing block blob.

The PutBlock description says:

The Put Block operation creates a new block to be committed as part of a blob.

Is it 1 block per file or is a file multiple blocks?

Are those 2 Put commands used for uploading files?

Does a write operation effectively mean 1 operation per 1 file? For example, if i have 100 files is that 100 write operations? Or can 1 write operation write multiple files in a single op?

Write Operations


Solution

  • Let me try to explain it with a couple of scenarios. Considering you are using block blobs, I will explain using them only.

    1. Uploading a 1 MB File: Assuming you have a 1 MB local file that you wish to save as block blob. Considering the file size is relatively small, you can upload this file in blob storage using Put Blob operation. Since you're calling this operation only once, you will be performing one write operation.
    2. Uploading a 1 GB File: Now let's assume that you have a 1 GB local file that you wish to save as block blob. Considering the file size is big, you decide to logically split the file in 1 MB chunks (i.e. you logically split your 1 GB local file in 1024 chunks). BTW, these chunks are also known as blocks. Now you upload each of these blocks using Put Block operation and then finally stitch these blocks together using Put Block List operation to create your blob. Since you're calling 1024 put block operations (one for each block) and then 1 put block list operation, you will be performing 1025 write operations (1024 + 1).

    Now to answer your specific questions:

    Is it 1 block per file or is a file multiple blocks?

    It depends on whether you used Put Blob operation or Put Block operation to upload the file. In scenario 1 above, it is just 1 block per file (or blob) because you used put blob operation however in scenario 2, it is 1024 blocks per file (or blob) because you used put block operation.

    Are those 2 Put commands used for uploading files?

    Yes. Again depending on the file size you may decide to use either put blob or put block/put block list operation to upload files. Maximum size of a file that can be uploaded by a put blob operation is 100 MB. What that means is that if the file size is greater than 100 MB, then you must use put block/put block list operation to upload a file. However if the file size is less than 100 MB, then you can use either put blob or put block/put block list operation.

    Does a write operation effectively mean 1 operation per 1 file? For example, if i have 100 files is that 100 write operations?

    At the minimum, yes. If each of the 100 files is uploaded using put blob operation, then it would amount to 100 write operations.

    Or can 1 write operation write multiple files in a single op?

    No, that's not possible.