Skip to content

Commit

Permalink
update deployment scripts for consumption plan (#204)
Browse files Browse the repository at this point in the history
* update deployment script to include consumption plan, and add a consumption series

* fix run-scalemonitor.ps1
  • Loading branch information
sebastianburckhardt authored Dec 9, 2022
1 parent b910e0e commit 2f03f54
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 13 deletions.
38 changes: 26 additions & 12 deletions test/PerformanceTests/scripts/deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
{
az resource update -n $functionAppName/config/web -g $groupName --set properties.functionsRuntimeScaleMonitoringEnabled=0 --resource-type Microsoft.Web/sites
}
else

if (-not ($Plan -eq "Consumption"))
{
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)
Expand Down
2 changes: 1 addition & 1 deletion test/PerformanceTests/scripts/run-scalemonitor.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 22 additions & 0 deletions test/PerformanceTests/series/consumption.ps1
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2f03f54

Please sign in to comment.