From 0fb13b2fbe76bf9a175f44d194f4fffec466680d Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Fri, 24 Oct 2025 14:38:55 -0700 Subject: [PATCH 1/4] Look for bias in C++ perf test --- CMakePresets.json | 4 ++- sdk/core/perf/src/program.cpp | 14 +++++++++ .../azure-storage-blobs/perf-resources.bicep | 29 ++++++++++++++++++- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 50bd12939a..c6ff3f420a 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -808,6 +808,7 @@ "inherits": [ "linux-basic-g++", "debug-build" + ] }, { @@ -815,7 +816,8 @@ "inherits": [ "linux-basic-g++", "debug-build", - "enable-tests" + "enable-tests", + "enable-perf" ], "displayName": "Linux g++, Debug+Tests" }, diff --git a/sdk/core/perf/src/program.cpp b/sdk/core/perf/src/program.cpp index fac6dec3f7..b33da31d54 100644 --- a/sdk/core/perf/src/program.cpp +++ b/sdk/core/perf/src/program.cpp @@ -212,10 +212,24 @@ inline std::vector ZipAvg( { auto size = operations.size(); std::vector s(size); + std::cout << "=== Zip Avg Results ===" << std::endl; for (size_t index = 0; index != operations.size(); index++) { + std::cout + << "ops: " << operations[index] << " time: " + << static_cast( + std::chrono::duration_cast(timeResults[index]).count()) + / 1000.0f + << std::endl; + s[index] = operations[index] / std::chrono::duration(timeResults[index]).count(); } + for (size_t index = 0; index != s.size(); index++) + { + std::cout << "Avg[" << index << "]: " << s[index] << " ops/s" << std::endl; + } + std::cout << "=======================" << std::endl; + std::cout << "=== End Zip Avg Results ===" << std::endl; return s; } diff --git a/sdk/storage/azure-storage-blobs/perf-resources.bicep b/sdk/storage/azure-storage-blobs/perf-resources.bicep index f05d353d74..8b57320aaa 100644 --- a/sdk/storage/azure-storage-blobs/perf-resources.bicep +++ b/sdk/storage/azure-storage-blobs/perf-resources.bicep @@ -1,13 +1,40 @@ param baseName string = resourceGroup().name +param testApplicationOid string param location string = resourceGroup().location -resource storageAccount 'Microsoft.Storage/storageAccounts@2019-06-01' = { + +var blobDataContributorRoleId = 'ba92f5b4-2d11-453d-a403-e96b0029c9fe' +var blobDataOwnerRoleId = 'b7e6dc6d-f1e8-4753-8033-0f276bb0955b' + +resource blobDataContributor 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + name: guid(blobDataContributorRoleId, resourceGroup().id) + properties: { + roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', blobDataContributorRoleId) + principalId: testApplicationOid + } +} + +resource blobDataOwner 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + name: guid(blobDataOwnerRoleId, resourceGroup().id) + properties: { + roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', blobDataOwnerRoleId) + principalId: testApplicationOid + } +} + +resource storage 'Microsoft.Storage/storageAccounts@2024-01-01' = { name: '${baseName}blob' location: location kind: 'BlockBlobStorage' sku: { name: 'Premium_LRS' } + properties: { + allowSharedKeyAccess: false + publicNetworkAccess: null + supportsHttpsTrafficOnly: true + + } } var name = storageAccount.name From 93617eeb82b4d09084938561bf1488c1184537e8 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Fri, 24 Oct 2025 14:52:15 -0700 Subject: [PATCH 2/4] Fixed typo in bicep file --- sdk/storage/azure-storage-blobs/perf-resources.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/storage/azure-storage-blobs/perf-resources.bicep b/sdk/storage/azure-storage-blobs/perf-resources.bicep index 8b57320aaa..f809a2fe0e 100644 --- a/sdk/storage/azure-storage-blobs/perf-resources.bicep +++ b/sdk/storage/azure-storage-blobs/perf-resources.bicep @@ -22,7 +22,7 @@ resource blobDataOwner 'Microsoft.Authorization/roleAssignments@2022-04-01' = { } } -resource storage 'Microsoft.Storage/storageAccounts@2024-01-01' = { +resource storageAccount 'Microsoft.Storage/storageAccounts@2024-01-01' = { name: '${baseName}blob' location: location kind: 'BlockBlobStorage' From a6f3596ef24519b260ae62e24e68d4ea1c94cae6 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Fri, 24 Oct 2025 15:51:00 -0700 Subject: [PATCH 3/4] Allow shared key access --- sdk/storage/azure-storage-blobs/perf-resources.bicep | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/storage/azure-storage-blobs/perf-resources.bicep b/sdk/storage/azure-storage-blobs/perf-resources.bicep index f809a2fe0e..1ed63ae6c8 100644 --- a/sdk/storage/azure-storage-blobs/perf-resources.bicep +++ b/sdk/storage/azure-storage-blobs/perf-resources.bicep @@ -30,7 +30,6 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2024-01-01' = { name: 'Premium_LRS' } properties: { - allowSharedKeyAccess: false publicNetworkAccess: null supportsHttpsTrafficOnly: true From 1a91eb4377227e8f0ce10a1787dc31741cbfc740 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Fri, 24 Oct 2025 16:59:12 -0700 Subject: [PATCH 4/4] Noise reduction --- sdk/core/perf/src/program.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/sdk/core/perf/src/program.cpp b/sdk/core/perf/src/program.cpp index b33da31d54..0d8afff868 100644 --- a/sdk/core/perf/src/program.cpp +++ b/sdk/core/perf/src/program.cpp @@ -212,24 +212,10 @@ inline std::vector ZipAvg( { auto size = operations.size(); std::vector s(size); - std::cout << "=== Zip Avg Results ===" << std::endl; for (size_t index = 0; index != operations.size(); index++) { - std::cout - << "ops: " << operations[index] << " time: " - << static_cast( - std::chrono::duration_cast(timeResults[index]).count()) - / 1000.0f - << std::endl; - s[index] = operations[index] / std::chrono::duration(timeResults[index]).count(); } - for (size_t index = 0; index != s.size(); index++) - { - std::cout << "Avg[" << index << "]: " << s[index] << " ops/s" << std::endl; - } - std::cout << "=======================" << std::endl; - std::cout << "=== End Zip Avg Results ===" << std::endl; return s; } @@ -307,6 +293,13 @@ inline void RunTests( std::cout << std::endl << "=== Results ==="; auto totalOperations = Sum(completedOperations); + for (auto completionTime : lastCompletionTimes) { + if (completionTime > deadLineSeconds + std::chrono::milliseconds(500)) { + std::cout << "Warning: One of the tests ran for " << static_cast(std::chrono::duration_cast(completionTime).count()) / 1000 << "s, longer than the specified duration of " + << durationInSeconds << " seconds." << std::endl; + } + + } auto operationsPerSecond = Sum(ZipAvg(completedOperations, lastCompletionTimes)); auto secondsPerOperation = 1 / operationsPerSecond; auto weightedAverageSeconds = totalOperations / operationsPerSecond;