Skip to content

Commit

Permalink
MQTT Perf Tests improvements. (Azure#4527)
Browse files Browse the repository at this point in the history
There are few small improvements I propose for MQTT perf tests:
- use `--security-opt apparmor=unconfined` flag to disable apparmor that sometimes causes problems restarting the containers
- use `docker rm -f` && `docker run` instead of `docker restart`
- save image name into local file, for ease of use in later steps.
- make all stages always run even if previous failed.
  • Loading branch information
vadim-kovalyov authored Mar 4, 2021
1 parent 17d7cad commit 4a0c169
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
3 changes: 3 additions & 0 deletions builds/misc/mqtt-perf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ stages:
clientDop: 4 # the number of max threads that can execute mqtt-benchmark tool code simultaneously

pool: $(pool.name)
condition: always() # run stage even if previous failed
jobs:
- template: templates/mqtt-perf-setup.yaml
- template: templates/mqtt-perf-run.yaml
Expand All @@ -67,6 +68,7 @@ stages:
clientDop: 4 # the number of max threads that can execute mqtt-benchmark tool code simultaneously

pool: $(pool.name)
condition: always() # run stage even if previous failed
jobs:
- template: templates/mqtt-perf-setup.yaml
- template: templates/mqtt-perf-run.yaml
Expand All @@ -82,6 +84,7 @@ stages:
clientDop: 4 # the number of max threads that can execute mqtt-benchmark tool code simultaneously

pool: $(pool.name)
condition: always() # run stage even if previous failed
jobs:
- template: templates/mqtt-perf-setup.yaml
- template: templates/mqtt-perf-run.yaml
12 changes: 6 additions & 6 deletions builds/misc/templates/mqtt-perf-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
sshEndpoint: iotedge-mqtt-perf-amd64-conn
runOptions: commands
commands: |
docker stop mqtt-broker ; docker system prune -a -f
echo $(brokerImageName) > brokerImageName.txt ; docker stop mqtt-broker ; docker system prune -a -f
# ignore cleanup errors if no containers running
continueOnError: true
condition: eq(variables['arch'], 'amd64')
Expand All @@ -42,8 +42,8 @@ jobs:
runOptions: commands
commands: |
echo "$(registry.password)" | docker login $(registry.address) --username $(registry.user) --password-stdin 2>/dev/null
docker pull $(brokerImageName)
docker run -d --network=host --name=mqtt-broker $(brokerImageName)
docker pull $(cat brokerImageName.txt)
docker run -d --network=host --security-opt apparmor=unconfined --name=mqtt-broker $(cat brokerImageName.txt)
docker logout
condition: eq(variables['arch'], 'amd64')

Expand All @@ -54,7 +54,7 @@ jobs:
sshEndpoint: iotedge-mqtt-perf-arm32v7-conn
runOptions: commands
commands: |
docker stop mqtt-broker ; docker system prune -a -f
echo $(brokerImageName) > brokerImageName.txt ; docker stop mqtt-broker ; docker system prune -a -f
# ignore cleanup errors if no containers running
continueOnError: true
condition: eq(variables['arch'], 'arm32v7')
Expand All @@ -66,8 +66,8 @@ jobs:
runOptions: commands
commands: |
echo "$(registry.password)" | docker login $(registry.address) --username $(registry.user) --password-stdin 2>/dev/null
docker pull $(brokerImageName)
docker run -d --network=host --name=mqtt-broker $(brokerImageName)
docker pull $(cat brokerImageName.txt)
docker run -d --network=host --security-opt apparmor=unconfined --name=mqtt-broker $(cat brokerImageName.txt)
docker logout
condition: eq(variables['arch'], 'arm32v7')

Expand Down
24 changes: 20 additions & 4 deletions builds/misc/templates/mqtt-perf-test-case.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,38 @@ jobs:

# AMD64 Cleanup
- task: SSH@0
displayName: Restart broker AMD64
displayName: Remove broker AMD64
inputs:
sshEndpoint: iotedge-mqtt-perf-amd64-conn
runOptions: commands
commands: |
docker restart mqtt-broker
docker rm -f mqtt-broker || true
continueOnError: true
condition: eq(variables['arch'], 'amd64')
- task: SSH@0
displayName: Restart broker AMD64
inputs:
sshEndpoint: iotedge-mqtt-perf-amd64-conn
runOptions: commands
commands: |
docker run -d --network=host --security-opt apparmor=unconfined --name=mqtt-broker $(cat brokerImageName.txt)
condition: eq(variables['arch'], 'amd64')

# ARM32 Cleanup
- task: SSH@0
displayName: Restart broker ARM32
displayName: Remove broker ARM32
inputs:
sshEndpoint: iotedge-mqtt-perf-arm32v7-conn
runOptions: commands
commands: |
docker restart mqtt-broker
docker rm -f mqtt-broker || true
continueOnError: true
condition: eq(variables['arch'], 'arm32v7')
- task: SSH@0
displayName: Restart broker ARM32
inputs:
sshEndpoint: iotedge-mqtt-perf-arm32v7-conn
runOptions: commands
commands: |
docker run -d --network=host --security-opt apparmor=unconfined --name=mqtt-broker $(cat brokerImageName.txt)
condition: eq(variables['arch'], 'arm32v7')

0 comments on commit 4a0c169

Please sign in to comment.