Multi region load tests using Azure Load Testing
Published Jul 13 2023 08:34 AM 3,530 Views
Microsoft

Azure Load Testing is a fully managed load testing service that enables you to easily generate high scale load and gain actionable insights into the performance and scalability of your applications. So, what if you have users spread across multiple geos? Are some users negatively impacted by latency? In this blogpost, you'll learn how to use Azure Load Testing to get insights about the client-side performance metrics for global applications. We will demonstrate how you can set up and run a multi-region load test using the automation options available for Azure Load Testing. If you haven’t used the service yet, you can get started and run your first load test in less than 10 minutes.

 

Test scenario

For this demo, let’s consider a sample .NET podcasts web application where users can explore different categories, search for podcasts, and listen to them. Let’s say this web application has users predominantly in the United States, the United Kingdom, Asia, and Australia. Whenever a new podcast is published, the application experiences higher than usual load from users across geographies. Now, we’d like to ensure that the users from any of the locations do not experience longer response times.

 

For this scenario, we have set up a JMeter script to simulate a load of 100 concurrent virtual users to multiple pages in the web application – homepage, discover page, podcasts page etc. for a duration of 400 seconds (almost 7 minutes).

Nagarjuna_V_0-1689256274909.png

 

We want this load to be simulated from all the four geographies where this application is used from. Let’s see how Azure Load Testing can be leveraged to set up this multi-region load test scenario.

 

Set up and run a multi-region load test

While creating an Azure Load Testing resource, we select an Azure region. When a load test is run from that resource, the load generating engine instances get deployed in the selected Azure region and the test run simulates user traffic from that region.

 

In this scenario, we need to simulate user traffic from four regions. To do that manually, we need to create Azure Load Testing resources in four regions – East US, UK South, East Asia, and Australia East to cover the four areas of our interest. We then have to create a test using the JMeter script that we set up for our scenario, in all the four resources and start the test run from the four resources at the same time. This is tedious and involves repetitive steps.

 

To simplify this, we can use the automation options available for Azure Load Testing – REST APIs, SDKs and Azure CLI. For this demo, we will use the Azure Load Testing Python SDK to create a script that automatically runs a multi-region load test.

The Python script does the following actions:

  1. Create an Azure Load Testing resource in each of the 4 regions – East US, UK South, East Asia, and Australia East.
  2. Creates a load test in the load testing resources.
  3. Runs the load tests in parallel (from each of the 4 regions).
  4. Uploads the load test results to Azure Blob storage.

The test results in the storage account can then be used to create custom dashboards for visualization and analysis.

 

When we run this script, four Azure Load Testing resources get created in the resource group specified. In each of these resources, a load test is created using the JMX script and other artifacts as per the test plan created for this scenario. The four tests are then run in parallel. While the script is running, on the Azure Portal, you can see the resources, tests and test runs getting created. You can view the individual test run results, specific to an Azure region, on the Azure Load Testing dashboard and analyze the metrics to identify performance bottlenecks. Here, Azure Load Testing enabled us to generate high scale load in all the regions where our users are located. 

 

Nagarjuna_V_1-1689256274919.png

 

However, in this scenario, we want to compare the client-side metrics across regions. To enable this analysis, an additional column indicating the region is added in the results CSV files and the files are copied to a storage account. We can then visualize the results in a reporting tool of our choice.

 

Here is a sample PowerBI visualization of the client-side metrics created by connecting to the Azure Storage Account container with the results CSV files.

 

Nagarjuna_V_1-1689257066995.png

 

We can see that the response time is not uniform across regions. East Asia had the lowest response time, while UK South had the highest. We can filter the results by regions and specific requests to analyze the results further or add additional custom visuals, as required. You can also add a failure criterion in the test configuration to mark the test as failed if the latency or response time is longer than expected. The PowerBI dashboard can then show the Pass/Fail status for each region. The insights from this dashboard could then be used to take corrective action like deploying the web app in multiple locations, using Azure Traffic Manager for load-balancing etc.

 

The Python script, the test artifacts and the PowerBI template used for this scenario are available in the samples repository.

You can try this out in three steps:

  1. Download the Python script, config file, other test artifacts and update the load testing inputs – Subscription ID, Resource group name etc. in the config file.
  2. Create a container in a storage account and update the storage account inputs in the config file.
  3. Download the PowerBI template and update the connection settings to point to your storage account.

If you want to run the multi-region test for a different test scenario, you can use the JMeter file and test artifacts for that scenario and follow the same steps as above.

 

To recap, we have set up a Python script using Azure Load Testing SDKs to run a multi-region load test on schedule and push the results to an Azure storage account. We have a PowerBI dashboard set up to visualize the performance test results. You now know how to run a multi-region load test using Azure Load Testing.

 

If you have any feedback on Azure Load Testing, let us know through our feedback forum. Refer to the previous blogposts on Azure load testing here.

Version history
Last update:
‎Jul 25 2023 09:16 AM
Updated by: