Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit 6a45f09

Browse files
authored
Merge pull request #245 from mirobers/fixedlength
Set fixed length streaming mode for request path in executor.
2 parents fab3d2f + cc03c5f commit 6a45f09

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

ChangeLog.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
XXXX.XX.XX Version X.X.X
2+
* Improved performance of blob uploadFromFile APIs to avoid unnecessary buffering.
3+
* Improved performance when streaming directly from a FileInputStream to avoid unnecessary buffering.
4+
* Switched to using fixed length streaming mode in the HTTP client to avoid unnecessary buffering.
5+
16
2017.11.01 Version 6.1.0
27
* Added support for the last time the tier was modified.
38

microsoft-azure-storage/src/com/microsoft/azure/storage/core/ExecutionEngine.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ public static <CLIENT_TYPE, PARENT_TYPE, RESULT_TYPE> RESULT_TYPE executeWithRet
8787
try {
8888
if (task.getSendStream() != null) {
8989
Logger.info(opContext, LogConstants.UPLOAD);
90+
91+
// Always set fixed length streaming mode when we know the length in advance.
92+
// This sets the Content-Length of the request and allows the request payload to
93+
// be streamed from the source. Otherwise, the HTTP layer will buffer the entire
94+
// request and compute the Content-Length itself.
95+
if (task.getLength() >= 0) {
96+
request.setFixedLengthStreamingMode(task.getLength());
97+
}
98+
9099
final StreamMd5AndLength descriptor = Utility.writeToOutputStream(task.getSendStream(),
91100
request.getOutputStream(), task.getLength(), false /* rewindStream */,
92101
false /* calculate MD5 */, opContext, task.getRequestOptions());

0 commit comments

Comments
 (0)