Skip to content

Commit 1c74eef

Browse files
edits
1 parent a6f5f26 commit 1c74eef

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

articles/storage/blobs/storage-blobs-tune-upload-download-javascript.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ The Storage REST layer doesn’t support picking up a REST upload operation wher
8787

8888
## Performance tuning for downloads
8989

90-
Properly tuning data transfer options is key to reliable performance for downloads. Storage transfers are partitioned into several subtransfers based on the values defined in [BlobDownloadToBufferOptions](/javascript/api/@azure/storage-blob/blobdownloadtobufferoptions).
90+
Tuning data transfer options for downloads is available only when using the [downloadToBuffer](/javascript/api/@azure/storage-blob/blobclient#@azure-storage-blob-blobclient-downloadtobuffer) method. This method downloads a blob in parallel to a buffer based on the values defined in [BlobDownloadToBufferOptions](/javascript/api/@azure/storage-blob/blobdownloadtobufferoptions). Other download methods don't support tuning data transfer options.
9191

9292
### Set transfer options for downloads
9393

@@ -98,9 +98,24 @@ The following values can be tuned for downloads based on the needs of your app:
9898

9999
### Performance considerations for downloads
100100

101-
During a download, the Storage client libraries split a given download request into multiple subdownloads based on the configuration options defined by `BlobDownloadToBufferOptions`. Each subdownload has its own dedicated call to the REST operation. Depending on transfer options, the client libraries manage these REST operations in parallel to complete the full download.
101+
During a download using `downloadToBuffer`, the Storage client libraries split a given download request into multiple subdownloads based on the configuration options defined by `BlobDownloadToBufferOptions`. Each subdownload has its own dedicated call to the REST operation. Depending on transfer options, the client libraries manage these REST operations in parallel to complete the full download.
102102

103-
## Next steps
103+
#### Code example
104+
105+
The following code example shows how to set values for [BlobDownloadToBufferOptions](/javascript/api/@azure/storage-blob/blobdownloadtobufferoptions) and include the options as part of a [downloadToBuffer](/javascript/api/@azure/storage-blob/blobclient#@azure-storage-blob-blobclient-downloadtobuffer) method call. The values provided in the samples aren't intended to be a recommendation. To properly tune these values, you need to consider the specific needs of your app.
106+
107+
```javascript
108+
// Specify data transfer options
109+
const downloadToBufferOptions = {
110+
blockSize: 4 * 1024 * 1024, // 4 MiB max block size
111+
concurrency: 2, // maximum number of parallel transfer workers
112+
}
113+
114+
// Download data to buffer
115+
const result = await client.downloadToBuffer(offset, count, downloadToBufferOptions);
116+
```
117+
118+
## Related content
104119

105120
- To understand more about factors that can influence performance for Azure Storage operations, see [Latency in Blob storage](storage-blobs-latency.md).
106121
- To see a list of design considerations to optimize performance for apps using Blob storage, see [Performance and scalability checklist for Blob storage](storage-performance-checklist.md).

0 commit comments

Comments
 (0)