A developer is implementing a new feature for a web application that allows users to upload large files (up to several GBs) to Azure Blob Storage. To improve upload reliability and performance, especially over unreliable networks, the developer wants to use a mechanism that uploads parts of a file concurrently and allows for resuming uploads if interrupted.
- AUse `Put Block` and `Put Block List` operations.
- BUse the `Append Block` operation.
- CUse the `Upload` method for the entire file.
- DUse `UploadFromFile` with `AccessCondition.GenerateIfNoneMatchCondition()`.
Show answer & explanationAnswer & explanation
Correct answer: A. Use `Put Block` and `Put Block List` operations.
For uploading large files with improved reliability, performance, and resumability, Azure Blob Storage's block blobs are used with `Put Block` and `Put Block List` operations. `Put Block` uploads individual chunks (blocks) of the file, which can be done concurrently. `Put Block List` then commits these blocks in the correct order to form the complete blob, allowing for interruption and resumption.
Why the other options are wrong
- B. The `Append Block` operation is used for append blobs, which are optimized for append operations (like log files), not for updating or uploading large, complete files in a resumable manner.
- C. The `Upload` method (or `UploadAsync`) is suitable for smaller files but may be less reliable and performant for very large files over unstable networks, as it uploads the entire file in one go or relies on the SDK's internal chunking without explicit block management.
- D. While `UploadFromFile` is a convenience method, the `AccessCondition.GenerateIfNoneMatchCondition()` is for optimistic concurrency control, not for segmenting large file uploads or resumability.
Azure Blob Storage Block Blobs (Put Block List)
Block blobs in Azure Blob Storage are composed of blocks of data, each identified by a block ID. The `Put Block` operation uploads individual blocks, and `Put Block List` commits a list of blocks to form a complete blob, enabling efficient, concurrent, and resumable uploads of large files.
- Ideal for large files (up to ~190.7 TiB).
- Allows concurrent upload of file chunks (blocks).
- Supports resumable uploads by committing a list of blocks.
Memory trick: Blocks for Big files, List for Linking them right.