This article describes how to use Azure Load Testing to test a multi-tenant service based on Azure App Service. It also describes how to run the Load Testing scenario from either:
For this scenario, Azure Load Testing is used to test the performances of a Multi-Tenant service hosted on Azure. The Load Testing resources are only deployed during the tests and can be managed from an Azure DevOps pipeline or a Github Action.
Multi-tenant architectures are commonly used for building SaaS applications, where multiple customers share the same application instance while keeping their data isolated.
For instance, applications like project management tools or customer relationship management systems, where multiple users collaborate and share data, can benefit from a multi-tenant architecture. Some Microsoft Teams applications can also provide Multi-Tenant Services.
The architecture diagram below describes a minimal architecture to provide a multi-tenant service. The multi-tenant service is composed of:
This architecture could be extended with an Azure Front Door to support a distributed application in several regions. Azure Front Door routes client traffic to the correct region, moreover it can fail over to the second region if a regional failure happens, and it can secure the internet-facing entry point via Azure Web Application Firewall.
Application Gateway could also be deployed to route and load-balances traffic internally. Application Gateway has awareness of the load on individual services within a group.
Azure Front Door and Application Gateway combine to provide complex load-balancing at all levels in a multitenant solution.
The load testing of this infrastructure requires the deployment of Azure Load Testing service to test the multi-tenant service through the REST API endpoint.
As this REST API is protected and requires an authentication, each client will send a token to get access to the service. Those tokens will be stored in the Azure Key Vault.
Moreover, a Microsoft Entra ID Test Renant could be created to provision temporary users. Using those users' credentials the load testing preparation script will store the access token of each user in an Azure Key Vault secret.
You can get a test tenant in joining the Microsoft 365 Developer Program:
https://learn.microsoft.com/en-us/entra/identity-platform/test-setup-environment#get-a-test-tenant
This paragraph describes all the steps to load test the Multi-Tenant service.
Beyond Azure Load Testing, this paragraph describes the list of services which could be deployed on Azure to offer a multi-tenant service.
After installing the Azure Load Testing component from the Azure DevOps Market Place, it’s possible to run the same load testing scenario from an Azure DevOps pipeline.
Below the load testing task:
- task: AzureLoadTest@1
displayName: 'Step Run Load Testing Multi-Tenant Web App'
inputs:
azureSubscription: $(SERVICE_CONNECTION)
loadTestConfigFile: '$(TEMP_DIR)/load-testing.yaml'
resourceGroup: $(LOAD_TESTING_RESOURCE_GROUP)
loadTestResource: $(LOAD_TESTING_NAME)
secrets: |
[
]
env: |
[
{
"name": "hostname",
"value": "$(LOAD_TESTING_TARGET_HOSTNAME)"
},
{
"name": "path",
"value": "$(LOAD_TESTING_TARGET_PATH)"
},
{
"name": "duration",
"value": "${{ parameters.duration }}"
},
{
"name": "threads",
"value": "${{ parameters.threads }}"
},
$(LOAD_TESTING_USERS)
]
From a Github Action it’s also possible to run the same load testing scenario.
Below the load testing task:
- name: 'Step Run Load Testing Multi-Tenant Web App'
uses: azure/load-testing@v1
with:
loadTestConfigFile: '${{ steps.configureloadtest.outputs.TEMP_DIR }}/load-testing.yaml'
resourceGroup: ${{ steps.deployloadtest.outputs.LOAD_TESTING_RESOURCE_GROUP }}
loadTestResource: ${{ steps.deployloadtest.outputs.LOAD_TESTING_NAME }}
secrets: |
[
]
env: |
[
{
"name": "hostname",
"value": "${{ steps.configureloadtest.outputs.LOAD_TESTING_TARGET_HOSTNAME }}"
},
{
"name": "path",
"value": "${{ steps.configureloadtest.outputs.LOAD_TESTING_TARGET_PATH }}"
},
{
"name": "duration",
"value": "${{ github.event.inputs.duration }}"
},
{
"name": "threads",
"value": "${{ github.event.inputs.threads }}"
},
${{ steps.configureloadtest.outputs.LOAD_TESTING_USERS }}
]
These considerations implement the pillars of the Azure Well-Architected Framework, which is a set of guiding tenets that can be used to improve the quality of a workload. For more information, see Microsoft Azure Well-Architected Framework.
Cost optimization is about looking at ways to reduce unnecessary expenses and improve operational efficiencies. For more information, see Overview of the cost optimization pillar.
Use the Azure pricing calculator to get customized pricing estimates.
- Get started with this Using Azure Load Testing to test services running on Azure
- A sample implementation here load testing a multi-tenant service composed of:
The performances of this service can be tested from either a dev container in Visual Studio Code or an Azure DevOps pipeline or a Github Action using a Microsoft Entra Id Test Tenant.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.