Load test private endpoints deployed in another Azure region or subscription
Published Dec 09 2022 12:56 AM 10.8K Views
Microsoft

Running load tests against private endpoints is a common scenario. The endpoints may be sitting behind a firewall, or they may be only accessible from within a virtual network, or they may not have been made public yet as they are under development. Microsoft Azure Load Testing supports private endpoint load testing using VNet injection. This injects the load generating virtual machines into the same virtual network as your private endpoint.

Azure Load Testing support for private endpoint load testing is currently available in seven regions with expansion on the horizon. What if you want to initiate a load test from a different region than where your application is? What if the virtual network sits in a different subscription? Or if private endpoint load testing is not supported yet in your region? You don’t have to worry. Virtual network peering is a simple workaround to unblock your load tests against private endpoints. Virtual network peering enables you to seamlessly connect two or more virtual networks in Azure. The peered virtual networks appear as one for connectivity purposes.

Let’s see how to go about it.

 

Set up a sample private endpoint

 

To demonstrate this scenario, we’ll use a simple web application, that shows a welcome message, deployed to an Azure Kubernetes Service (AKS) cluster.

Nagarjuna_V_8-1670559913345.png 

Let’s set up this private endpoint in ‘North Central US’ region.

  1. Create a virtual network in ‘North Central US’.

Nagarjuna_V_9-1670559944834.png

 

  1. Create an AKS cluster as described here.
    1. On the Networking tab, select Azure CNI for Network Configuration and then choose the virtual network that we created above. 
  2. Deploy the sample application to this cluster using the YAML file (in the attachments).
  3. Open an Azure Cloud Shell and run the command ‘kubectl get service’ . Make a note of the external IP address. We will need this later while configuring the load test.

Nagarjuna_V_10-1670559971061.png

 

We’ve now deployed an app that is accessible only from the ‘demo_vnet’ virtual network.

Set up virtual network peering

 

We'll now create a virtual network in a different region, South Central US, and peer the virtual network with the demo_vnet virtual network that hosts our application.

  1. Create a Virtual Network in ‘South Central US’ region. Ensure that the IP address range does not overlap with that of the virtual network that we created in our previous section.

    Nagarjuna_V_11-1670560008961.png
  2. Under Settings, select Peerings and add a peering link to the demo_vnet virtual network.

Nagarjuna_V_12-1670560035191.png

 

Now that the two virtual networks are peered and appear as one for connectivity purposes, we can run a load test against our private endpoint.

 

Create and run a load test

 

Let’s test this private endpoint for performance using Azure Load Testing.

  1. While setting up your test script (JMX file), use the external IP from the earlier section as the ‘Server Name or IP’ in your HTTP Sampler.

    Nagarjuna_V_13-1670560091063.png
  2. Create a Load Testing resource in ‘South Central US’
  3. On the Overview page, under Get Started, choose the option to create a test by uploading a JMeter script.
  4. On the Test Plan tab, upload the JMX script that we created above.
  5. On the Load tab, configure the test traffic mode as Private and select the peered virtual network that we created above.

Nagarjuna_V_14-1670560126862.png

 

  1. You can add the AKS cluster on which the app is hosted to monitor it during the load test.
  2. Once the test is created, run it and view the test results.

    Nagarjuna_V_15-1670560162445.png

Since the virtual network peering has been set up, the test traffic was successfully sent to the web app. The load test ran successfully, and we could view and analyze how the app responded to the load by using the dashboard. Otherwise, we would have seen errors and wouldn’t have been able to run the load test.

Using virtual network peering, we were able to generate load for the private endpoint deployed in a region other than the Load Testing resource and generate load test results.

What else are you waiting for? The YAML file for the sample app and the JMX file are added in the attachments. Try it out and leave us a comment below if leveraging virtual network peering with Azure Load Testing worked for you.

If you have any feedback on Azure Load Testing, let us know through our feedback forum.

Happy Load Testing…!

Resources

 

To learn more about Azure Load Testing, here are a few links to get you started:

6 Comments
Version history
Last update:
‎Dec 09 2022 05:24 AM
Updated by: