@@ -3,31 +3,40 @@ parameters:
3
3
type : string
4
4
- name : description
5
5
type : string
6
- - name : storeResultsInDatabase
7
- type : boolean
8
- default : false
9
- - name : additionalCrankArgs
10
- type : string
11
- default : ' '
12
- - name : agentName
6
+ - name : os
13
7
type : string
8
+ default : Windows
9
+ values :
10
+ - Windows
11
+ - Linux
14
12
15
13
jobs :
16
- - job : ${{ parameters.functionAppName }}
17
-
14
+ - job : ${{ parameters.functionAppName }}_${{ parameters.os }}
15
+
16
+ ${{ if eq(parameters.os, 'Linux') }} :
17
+ pool :
18
+ name : 1es-pool-azfunc-benchmarking-large
19
+ image : 1es-ubuntu-22.04-benchmark-runner-vanilla
20
+ os : linux
21
+ ${{ else }} :
22
+ pool :
23
+ name : 1es-pool-azfunc-benchmarking-large
24
+ image : 1es-windows-2022-benchmark-runner-vanilla
25
+ os : windows
26
+
18
27
variables :
19
- agentName : ${{ parameters.agentName }}
28
+ agentId : ${{ parameters.functionAppName }}${{ parameters.os }}
20
29
runDescription : ${{ parameters.description }}
21
30
functionApp : ${{ parameters.functionAppName }}
22
- benchmarkArtifactName : benchmark_results_$(functionApp)
31
+ benchmarkArtifactName : benchmark_results_$(Agent.OS)_$( functionApp)
23
32
functionAppOutputPath : $(Build.ArtifactStagingDirectory)/FunctionApps/$(functionApp)
24
33
benchmarkResultsJsonPath : $(Build.ArtifactStagingDirectory)/BenchmarkResults/$(Build.BuildNumber)_$(functionApp).json
25
34
functionsWorkerRuntime : ' dotnet-isolated'
26
35
configFilePath : " ./eng/perf/http.benchmarks.yml"
27
36
hostLocation : " ./../../"
28
37
baselineBenchmarkResultFilePath : ' '
29
38
baselineBenchmarkResultsDownloadDir : $(Pipeline.Workspace)/BenchmarkBaselineResult
30
- appAgentIpAddress : ' '
39
+ appAgentHostName : ' '
31
40
32
41
templateContext :
33
42
inputs :
46
55
steps :
47
56
48
57
- task : AzureKeyVault@2
49
- condition : and(succeeded(), eq('${{ parameters.storeResultsInDatabase }}' , true))
58
+ condition : and(succeeded(), eq(variables['storeBenchmarkResultsInDatabase'] , true))
50
59
inputs :
51
60
azureSubscription : Azure-Functions-Host-CI-internal
52
61
KeyVaultName : functions-perf-crank-kv
@@ -61,27 +70,13 @@ jobs:
61
70
- script : dotnet tool install -g Microsoft.Crank.Controller --version "0.2.0-*"
62
71
displayName : Install Microsoft.Crank.Controller tool
63
72
64
- - pwsh : Start-Process powershell -ArgumentList '-NoExit', '-Command', 'crank-agent'
65
- displayName : Start crank-agent
66
-
67
- - task : CopyFiles@2
68
- displayName : Copy benchmark apps to temp location
69
- inputs :
70
- SourceFolder : ' $(Build.SourcesDirectory)/test/Performance/Apps'
71
- Contents : ' **/*'
72
- TargetFolder : ' $(Build.ArtifactStagingDirectory)/PerformanceTestApps'
73
- CleanTargetFolder : true
74
-
75
- - task : DotNetCoreCLI@2
76
- displayName : Publish $(functionApp) app
77
- inputs :
78
- command : publish
79
- publishWebProjects : false
80
- zipAfterPublish : false
81
- modifyOutputPath : false
82
- projects : ' $(Build.ArtifactStagingDirectory)/PerformanceTestApps/$(functionApp)/HelloHttp.csproj'
83
- arguments : -c Release -o $(functionAppOutputPath) -f net9.0
84
- workingDirectory : $(Build.ArtifactStagingDirectory)/PerformanceTestApps/$(functionApp)
73
+ - ${{ if eq(parameters.os, 'Windows') }} :
74
+ - pwsh : Start-Process powershell -ArgumentList '-NoExit', '-Command', 'crank-agent'
75
+ displayName : Start crank-agent
76
+ - ${{ else }} :
77
+ - script : |
78
+ nohup crank-agent &
79
+ displayName: Start crank-agent
85
80
86
81
- task : AzureCLI@2
87
82
displayName : Get Remote Agent IP Address
@@ -99,12 +94,12 @@ jobs:
99
94
--auth-mode login `
100
95
--table-name $(BenchmarkAgentInfoTableName) `
101
96
--partition-key $(Build.BuildNumber) `
102
- --row-key $(agentName ) `
103
- --select AgentIPAddress
97
+ --row-key $(agentId ) `
98
+ --select HostName
104
99
105
100
if ($Entity) {
106
- $AgentIPAddress = ($Entity | ConvertFrom-Json).AgentIPAddress
107
- Write-Host "##vso[task.setvariable variable=appAgentIpAddress]$AgentIPAddress "
101
+ $HostName = ($Entity | ConvertFrom-Json).HostName
102
+ Write-Host "##vso[task.setvariable variable=appAgentHostName]$HostName "
108
103
break
109
104
} else {
110
105
Write-Host "Entity not found. Retrying in 30 seconds..."
@@ -120,25 +115,24 @@ jobs:
120
115
121
116
- pwsh : |
122
117
$crankArgs = "--config $(configFilePath) --scenario hellohttp --profile win2022 --load.options.reuseBuild true --description `"$(runDescription)`" --command-line-property --no-measurements --json $(benchmarkResultsJsonPath) --property sourceVersion=$(Build.SourceVersion) --property buildNumber=$(Build.BuildNumber) --property buildId=$(Build.BuildId) --property sourceBranch=$(Build.SourceBranch) --variable FunctionsWorkerRuntime=$(functionsWorkerRuntime) --variable HostLocation=$(hostLocation) --variable FunctionAppPath=$(functionAppOutputPath)"
123
- $crankArgs += " --variable CrankAgentAppVm=$(appAgentIpAddress ) --variable CrankAgentLoadVm=localhost --variable AspNetUrls=http://$(appAgentIpAddress ):5000"
124
- $crankArgs += " ${{ parameters.additionalCrankArgs }} "
118
+ $crankArgs += " --variable CrankAgentAppVm=$(appAgentHostName ) --variable CrankAgentLoadVm=localhost --variable AspNetUrls=http://$(appAgentHostName ):5000"
119
+ $crankArgs += " $(AdditionalCrankArguments) "
125
120
$command = "crank $crankArgs"
126
121
127
- if ('${{ parameters.storeResultsInDatabase }}' -eq 'true') {
122
+ if ('${{ variables['storeBenchmarkResultsInDatabase'] }}' -eq 'true') {
128
123
$command += " --table HttpBenchmarks --sql `"$(BenchmarkResultsSqlConnectionString)`""
129
124
}
130
125
131
126
Write-Host "Running command: $command"
132
127
Invoke-Expression $command
133
- displayName: ' Run Benchmark'
128
+ displayName: Run Benchmark
134
129
135
- # Retrieve function host logs
136
130
- pwsh : |
137
- $url = "http://$(appAgentIpAddress ):5010/jobs/1/output"
131
+ $url = "http://$(appAgentHostName ):5010/jobs/1/output"
138
132
Write-Host "Fetching logs from: $url"
139
133
$response = Invoke-WebRequest -Uri $url -Method GET -UseBasicParsing
140
134
Write-Host $response.Content
141
- displayName: ' Fetch Function Host Logs'
135
+ displayName: Fetch Function Host Logs
142
136
143
137
# Tag the build as a baseline if it originates from the specified branch.
144
138
# Baseline builds serve as reference points for performance comparisons in future builds.
@@ -152,13 +146,18 @@ jobs:
152
146
- pwsh : |
153
147
$baselineDir = "$(baselineBenchmarkResultsDownloadDir)"
154
148
$fileNamePattern = "*_$(functionApp).json"
155
- $baselineFile = Get-ChildItem -Path $baselineDir -Filter $fileNamePattern | Select-Object -First 1
156
149
157
- if ($baselineFile) {
158
- Write-Host "Found baseline benchmark result file: $($baselineFile.FullName)"
159
- Write-Host "##vso[task.setvariable variable=baselineBenchmarkResultFilePath]$($baselineFile.FullName)"
150
+ if (Test-Path $baselineDir -PathType Container) {
151
+ $baselineFile = Get-ChildItem -Path $baselineDir -Filter $fileNamePattern | Select-Object -First 1
152
+
153
+ if ($baselineFile) {
154
+ Write-Host "Found baseline benchmark result file: $($baselineFile.FullName)"
155
+ Write-Host "##vso[task.setvariable variable=baselineBenchmarkResultFilePath]$($baselineFile.FullName)"
156
+ } else {
157
+ Write-Host "No baseline benchmark result file matching the pattern '$fileNamePattern' found in directory '$baselineDir'."
158
+ }
160
159
} else {
161
- Write-Host "No baseline benchmark result file found ."
160
+ Write-Host "The specified directory '$baselineDir' does not exist ."
162
161
}
163
162
displayName: 'Set Baseline Benchmark Result File Path'
164
163
0 commit comments