Skip to content

Commit 031c5a0

Browse files
authored
Change default parallelism of Storage SDK (#7190)
1 parent 8d9b8c6 commit 031c5a0

9 files changed

Lines changed: 36 additions & 5 deletions

File tree

sdk/storage/azure-storage-blobs/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
### Other Changes
1212

13+
- Updated the default concurrency for upload and download operations. It now scales with the number of hardware threads available, clamped between 8 and 96 (previously a fixed value of 5).
14+
1315
## 12.18.0 (2026-06-11)
1416

1517
### Features Added

sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_options.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
#include <azure/core/modified_conditions.hpp>
1212
#include <azure/storage/common/access_conditions.hpp>
1313
#include <azure/storage/common/crypt.hpp>
14+
#include <azure/storage/common/internal/concurrent_transfer.hpp>
1415

16+
#include <algorithm>
1517
#include <chrono>
1618
#include <cstdint>
1719
#include <memory>
@@ -776,7 +778,7 @@ namespace Azure { namespace Storage { namespace Blobs {
776778
/**
777779
* @brief The maximum number of threads that may be used in a parallel transfer.
778780
*/
779-
int32_t Concurrency = 5;
781+
int32_t Concurrency = (std::min)(96, (std::max)(8, _internal::GetHardwareConcurrency()));
780782
} TransferOptions;
781783

782784
/**
@@ -1023,7 +1025,7 @@ namespace Azure { namespace Storage { namespace Blobs {
10231025
/**
10241026
* @brief The maximum number of threads that may be used in a parallel transfer.
10251027
*/
1026-
int32_t Concurrency = 5;
1028+
int32_t Concurrency = (std::min)(96, (std::max)(8, _internal::GetHardwareConcurrency()));
10271029
} TransferOptions;
10281030

10291031
/**

sdk/storage/azure-storage-common/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ set(
7070
set(
7171
AZURE_STORAGE_COMMON_SOURCE
7272
src/account_sas_builder.cpp
73+
src/concurrent_transfer.cpp
7374
src/crypt.cpp
7475
src/file_io.cpp
7576
src/private/package_version.hpp

sdk/storage/azure-storage-common/inc/azure/storage/common/internal/concurrent_transfer.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
namespace Azure { namespace Storage { namespace _internal {
1515

16+
int GetHardwareConcurrency();
17+
1618
inline void ConcurrentTransfer(
1719
int64_t offset,
1820
int64_t length,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
#include "azure/storage/common/internal/concurrent_transfer.hpp"
5+
6+
#include <thread>
7+
8+
namespace Azure { namespace Storage { namespace _internal {
9+
10+
int GetHardwareConcurrency()
11+
{
12+
static int c = static_cast<int>(std::thread::hardware_concurrency());
13+
return c;
14+
}
15+
16+
}}} // namespace Azure::Storage::_internal

sdk/storage/azure-storage-files-datalake/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
### Other Changes
1212

13+
- Updated the default concurrency for upload and download operations. It now scales with the number of hardware threads available, clamped between 8 and 96 (previously a fixed value of 5).
14+
1315
## 12.16.0 (2026-06-11)
1416

1517
### Features Added

sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_options.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
#include <azure/core/nullable.hpp>
1010
#include <azure/storage/blobs/blob_options.hpp>
1111
#include <azure/storage/common/access_conditions.hpp>
12+
#include <azure/storage/common/internal/concurrent_transfer.hpp>
1213

14+
#include <algorithm>
1315
#include <cstdint>
1416
#include <memory>
1517
#include <string>
@@ -1040,7 +1042,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
10401042
/**
10411043
* The maximum number of threads that may be used in a parallel transfer.
10421044
*/
1043-
int32_t Concurrency = 5;
1045+
int32_t Concurrency = (std::min)(96, (std::max)(8, _internal::GetHardwareConcurrency()));
10441046
} TransferOptions;
10451047

10461048
/**

sdk/storage/azure-storage-files-shares/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
### Other Changes
1212

13+
- Updated the default concurrency for upload and download operations. It now scales with the number of hardware threads available, clamped between 8 and 96 (previously a fixed value of 5).
14+
1315
## 12.18.0 (2026-06-11)
1416

1517
### Features Added

sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
#include <azure/core/internal/extendable_enumeration.hpp>
1010
#include <azure/core/nullable.hpp>
1111
#include <azure/storage/common/access_conditions.hpp>
12+
#include <azure/storage/common/internal/concurrent_transfer.hpp>
1213

14+
#include <algorithm>
1315
#include <memory>
1416
#include <string>
1517
#include <vector>
@@ -1353,7 +1355,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
13531355
/**
13541356
* The maximum number of threads that may be used in a parallel transfer.
13551357
*/
1356-
int32_t Concurrency = 5;
1358+
int32_t Concurrency = (std::min)(96, (std::max)(8, _internal::GetHardwareConcurrency()));
13571359
} TransferOptions;
13581360
};
13591361

@@ -1422,7 +1424,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
14221424
/**
14231425
* The maximum number of threads that may be used in a parallel transfer.
14241426
*/
1425-
int32_t Concurrency = 5;
1427+
int32_t Concurrency = (std::min)(96, (std::max)(8, _internal::GetHardwareConcurrency()));
14261428
} TransferOptions;
14271429
};
14281430

0 commit comments

Comments
 (0)