How to test application performance with Azure Load Testing
Application performance testing
When you build an application, you want it to be fast. Users should perceive it as fast and performant, even when many users are using it. And your application should continue to work without errors when it is under load. It can be difficult to know how your application behaves when it is used by many concurrent users.Azure Load Testing can help by putting your application under load and analyzing how it performs.
In this post, we'll test the performance of an existing web application withAzure Load Testing.
If you want to follow along, you'll need the following:
An Azure subscription (If you don't have an Azure subscription, create afree account before you begin)
Click theCreate a resourcebutton (the plus-sign in the top left corner)
Search forLoad Testing, select the "Azure Load Testing" result and clickCreate
Select a Resource Group
Fill in a Name
Select a Location
Click Review + create and then Create
Create an Azure load testing resource
Before we can create a test, we need to create anApache JMeter script. This is a scripts that tells Azure Load Testing what to test and how to do it. JMeter scripts have the.jmxextension and look like the code here:
This JMeter script simulates a load test of five virtual users simultaneously accessing a web endpoint. It takes less than two minutes to complete. All you need to do to make this script work for you is to replace the stringyour-endpoint-urlwith the endpoint of the web application that you want to test, likemicrosoft.github.io/AzureTipsAndTricks.
Now that we have an Apache JMeter script, we can create a test in the Azure Load Testing resource.
Navigate to theAzure Load Testingresource in the Azure portal
Select theTests menu
Click onCreate new test
In theBasics tab, enter aTest name
ClickNext: Test plan
Select theJMeter scriptthat you created and clickUpload
Upload an Apache JMeter script
You can enter environment variables and secrets that can be used by the JMeter script. Let's leave this blank and clickNext: Load
We only need one test engine instance to run the test. You can scale this up to increase the threads that will be executed. ClickNext: Test criteria
Here we can create failure criteria that state when the test fails. Let's create one
TheAggregate functionshould bePercentage
Enter50forThreshold. This tells the test that it fails if more than 50 percent of requests fail
Here, we can indicate Azure services to be monitored during the test. The application that we are testing runs in an Azure App Service Web App, so let's select that
ClickNext: Review + createand thenCreateto create the test. It will run automatically when it is created
When the test is done, it will show the results in the overview. This includes theload, response time, error percentageandthroughput. You can see more details for the Azure services that were monitored by clicking onAdditional insights.