Meneghino
Meneghino

Reputation: 1021

PDFs in Azure Blob Storage; better block or page blobs?

I have read this article, but I am still not sure whether I should store PDFs as page or block blobs in Azure Blob Storage.

The documents are just corporate documents for archiving, i.e. they will never be modified but need to be accessed via web and downloaded. The size of each document varies between 50 kB and 5 MB.

Any insights would be greatly appreciated.

Upvotes: 3

Views: 1111

Answers (2)

@Meneghino Using Block blob would be best for objects such as PDFs. Page blobs are suitable for VHDs, basically, by default when you create a VM resource, the VHDs get stored on Page blobs due to its optimization to read and write operations.

Page Blob: are a collection of 512-byte pages optimized for random read and write operations. To create a page blob, you initialize the page blob and specify the maximum size the page blob will grow. To add or update the contents of a page blob, you write a page or pages by specifying an offset and a range that align to 512-byte page boundaries. A write to a page blob can overwrite just one page, some pages, or up to 4 MB of the page blob. Writes to page blobs happen in-place and are immediately committed to the blob. The maximum size for a page blob is 8 TB.

Block blobs: let you upload large blobs efficiently. Block blobs are comprised of blocks, each of which is identified by a block ID. You create or modify a block blob by writing a set of blocks and committing them by their block IDs. Each block can be a different size, up to a maximum of 100 MB (4 MB for requests using REST versions before 2016-05-31), and a block blob can include up to 50,000 blocks. The maximum size of a block blob is therefore slightly more than 4.75 TB (100 MB X 50,000 blocks). For REST versions before 2016-05-31, the maximum size of a block blob is a little more than 195 GB (4 MB X 50,000 blocks). If you are writing a block blob that is no more than 256 MB (64 MB for requests using REST versions before 2016-05-31) in size, you can upload it in its entirety with a single write operation;

More information can be found here: https://learn.microsoft.com/en-us/rest/api/storageservices/understanding-block-blobs--append-blobs--and-page-blobs

Upvotes: 2

Martin Brandl
Martin Brandl

Reputation: 59021

You should use block blobs since you don't need random read or write operations. If you really only need to archive files, consider using Azure Archive storage, which is the lowest-priced storage offer in Azure.

Upvotes: 3

Related Questions