From 2f03f547594d85df5f2c0e588fe8481be7e0e22c Mon Sep 17 00:00:00 2001 From: Sebastian Burckhardt Date: Fri, 9 Dec 2022 08:12:09 -0800 Subject: [PATCH] update deployment scripts for consumption plan (#204) * update deployment script to include consumption plan, and add a consumption series * fix run-scalemonitor.ps1 --- test/PerformanceTests/scripts/deploy.ps1 | 38 +++++++++++++------ .../scripts/run-scalemonitor.ps1 | 2 +- test/PerformanceTests/series/consumption.ps1 | 22 +++++++++++ 3 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 test/PerformanceTests/series/consumption.ps1 diff --git a/test/PerformanceTests/scripts/deploy.ps1 b/test/PerformanceTests/scripts/deploy.ps1 index 3a9ec25..78559c0 100644 --- a/test/PerformanceTests/scripts/deploy.ps1 +++ b/test/PerformanceTests/scripts/deploy.ps1 @@ -36,11 +36,21 @@ if (-not ((az functionapp list -g $groupName --query "[].name"| ConvertFrom-Json { # look up connection strings $eventHubsConnectionString = (az eventhubs namespace authorization-rule keys list --resource-group $groupName --namespace-name $namespaceName --name RootManageSharedAccessKey | ConvertFrom-Json).primaryConnectionString + $corpusConnectionString = (az storage account show-connection-string --name gutenbergcorpus | ConvertFrom-Json).connectionString Write-Host "Creating $Plan Function App..." - az functionapp plan create --resource-group $groupName --name $functionAppName --location $location --sku $Plan - az functionapp create --name $functionAppName --storage-account $storageName --plan $functionAppName --resource-group $groupName --functions-version 4 - az functionapp config set -n $functionAppName -g $groupName --use-32bit-worker-process false + + if ($Plan -eq "Consumption") + { + az functionapp create --name $functionAppName --storage-account $storageName --consumption-plan-location $location --resource-group $groupName --functions-version 4 + } + else + { + az functionapp plan create --resource-group $groupName --name $functionAppName --location $location --sku $Plan + az functionapp create --name $functionAppName --storage-account $storageName --plan $functionAppName --resource-group $groupName --functions-version 4 + } + + az functionapp config set -n $functionAppName -g $groupName --use-32bit-worker-process false az functionapp config appsettings set -n $functionAppName -g $groupName --settings EventHubsConnection=$eventHubsConnectionString az functionapp config appsettings set -n $functionAppName -g $groupName --settings CorpusConnection=$corpusConnectionString } @@ -49,16 +59,20 @@ else Write-Host "Function app already exists." } -Write-Host "Configuring Function App Scale=$MinNodes-$MaxNodes" -az functionapp plan update -g $groupName -n $functionAppName --max-burst $MaxNodes --number-of-workers $MinNodes --min-instances $MinNodes -az resource update -n $functionAppName/config/web -g $groupName --set properties.minimumElasticInstanceCount=$MinNodes --resource-type Microsoft.Web/sites -if ($MinNode -eq $MaxNodes) + +if (-not ($Plan -eq "Consumption")) { - az resource update -n $functionAppName/config/web -g $groupName --set properties.functionsRuntimeScaleMonitoringEnabled=0 --resource-type Microsoft.Web/sites -} -else -{ - az resource update -n $functionAppName/config/web -g $groupName --set properties.functionsRuntimeScaleMonitoringEnabled=1 --resource-type Microsoft.Web/sites + Write-Host "Configuring Function App Scale=$MinNodes-$MaxNodes" + az functionapp plan update -g $groupName -n $functionAppName --max-burst $MaxNodes --number-of-workers $MinNodes --min-instances $MinNodes + az resource update -n $functionAppName/config/web -g $groupName --set properties.minimumElasticInstanceCount=$MinNodes --resource-type Microsoft.Web/sites + if ($MinNode -eq $MaxNodes) + { + az resource update -n $functionAppName/config/web -g $groupName --set properties.functionsRuntimeScaleMonitoringEnabled=0 --resource-type Microsoft.Web/sites + } + else + { + az resource update -n $functionAppName/config/web -g $groupName --set properties.functionsRuntimeScaleMonitoringEnabled=1 --resource-type Microsoft.Web/sites + } } if ($DeployCode) diff --git a/test/PerformanceTests/scripts/run-scalemonitor.ps1 b/test/PerformanceTests/scripts/run-scalemonitor.ps1 index c1b23a0..7e13e54 100644 --- a/test/PerformanceTests/scripts/run-scalemonitor.ps1 +++ b/test/PerformanceTests/scripts/run-scalemonitor.ps1 @@ -11,4 +11,4 @@ $Env:AzureWebJobsStorage = (az storage account show-connection-string --name $st $Env:EventHubsConnection = (az eventhubs namespace authorization-rule keys list --resource-group $groupName --namespace-name $namespaceName --name RootManageSharedAccessKey | ConvertFrom-Json).primaryConnectionString # open visual studio -dotnet run -p ..\..\ScalingTests\ScalingTests.csproj +dotnet run --project ..\ScaleMonitor\ScaleMonitor.csproj diff --git a/test/PerformanceTests/series/consumption.ps1 b/test/PerformanceTests/series/consumption.ps1 new file mode 100644 index 0000000..193249a --- /dev/null +++ b/test/PerformanceTests/series/consumption.ps1 @@ -0,0 +1,22 @@ +#!/usr/bin/pwsh +param ( + $ResultsFile="./results.csv", + $PrintColumnNames=$true, + $tu=20 +) + +# read the settings that are common to all scripts +. ./settings.ps1 + +if ($PrintColumnNames) +{ + Add-Content -path $ResultsFile -value "plan,nodes,tag,test,tu,starttime,iteration,size,duration" +} + +./series/runsingle -Tag neth -HubName CX0 -Plan Consumption -NumReps 4 -Orchestration FileHash -Data 5000 -DelayAfterRun 40 -ResultsFile $ResultsFile -ThroughputUnits $tu +./series/runmany -Tag neth -HubName CX1 -Plan Consumption -NumReps 4 -Orchestration BankTransaction -NumOrchestrations 3000 -PortionSize 0 -DelayAfterRun 60 -ResultsFile $ResultsFile -ThroughputUnits $tu +./series/runmany -Tag neth -HubName CX2 -Plan Consumption -NumReps 4 -Orchestration FanOutFanInOrchestration -Data "/1000" -NumOrchestrations 200 -PortionSize 0 -DelayAfterRun 60 -ResultsFile $ResultsFile -ThroughputUnits $tu +./series/runmany -Tag neth -HubName CX3 -Plan Consumption -NumReps 4 -Orchestration HelloSequence5 -NumOrchestrations 10000 -PortionSize 200 -DelayAfterRun 50 -ResultsFile $ResultsFile -ThroughputUnits $tu +./series/runsingle -Tag neth -HubName CX4 -Plan Consumption -NumReps 4 -Orchestration WordCount -Data "15x40" -ResultsFile $ResultsFile -ThroughputUnits $tu +./series/runsingle -Tag neth -HubName CX5 -Plan Consumption -NumReps 4 -Orchestration CollisionSearch/divide-and-conquer -Data 400 -DelayAfterRun 40 -ResultsFile $ResultsFile -ThroughputUnits $tu +./series/runsingle -Tag neth -HubName CX6 -Plan Consumption -NumReps 4 -Orchestration CollisionSearch/flat-parallel -Data 400 -DelayAfterRun 40 -ResultsFile $ResultsFile -ThroughputUnits $tu -DeleteAfterTests $true