Load testing is the process of Identifying potential bottlenecks, weaknesses, and points of failure of an application. It is a critical part of the software development lifecycle, however, it is a challenging one, as it involves setting up various load conditions to detect failures and issues that may occur at different levels of application usage. It mainly measures the responsiveness, robustness, and performance of the delivered application under normal usage as well as anticipated peak conditions.
In this article, we will learn more details about Load testing within the Azure ecosystem, exploring its concepts and configuration parameters.
Azure Load Testing Service Concepts:
What’s Azure Load Testing:
Azure load testing services enable developers and business to conduct comprehensive load tests by assessing application performance and uncovering the enhancements that could be made to have a more resilient application.
Load testing Key Concepts:
JMeter:
It's an open-source software tool, useful for performing load tests by analyzing the functional behavior of software applications and measuring their performance under various conditions. It offers a high degree of flexibility and customizability, which allows users to fine-tune their load tests to specific requirements and scenarios. JMeter test scripts that describe different load profiles (parameters of the different scenarios) could be imported into Azure load testing service and implemented on the Azure infrastructure.
Test engine instance:
It's an infrastructure computing resource, located in the same location of the azure load testing resource, managed by Microsoft, and runs the Apache JMeter test script, the number of engine instance used for a test are part of the configuration of the test case, as it affects the number of virtual users.
When running the test script, logs generated by the Apache JMeter worker are collected and aggregated by the Azure load testing service to be provided at the end of the test for analysis.
Virtual users:
In Apache JMeter, it's referred to as threads, and a pool of virtual users is referred to as Thread Group. Each virtual user runs a particular test case against the server application independently of the rest of the threads.
However, managing the number of virtual users is not all the time controlled directly, it could also be done through the number of test engine instances. The formula to calculate the total number of virtual users is the following:
Total virtual users = (virtual users in the JMX file) * (number of test engine instances)
Traffic simulation:
Azure load testing helps developers simulate different use cases with varying number of users as well as number of server instances, all while keeping an eye on the system response to the changes of the simulated environment.
Throughput:
Known also as Requests per second (RPS), it's an indicator of the number of requests that the load test service forwards to the server application in a second , it's the number of requests divided by the total execution time in second.
Developers should take into consideration that total execution time includes pauses in between threads if the Jmx test script includes timers.
Performance evaluation:
Azure load testing service measures different types of indicators including response times, throughput, resource utilization and other key performance to ensure the app benchmarks meet the requirements. We can identify two types of metrics:
Server-side metrics: Since the Azure load testing service integrates with Azure Monitor services, we will be able to see logs captured depending on the running service (specific message logs defined in the application, resource consumption, database queries or HTTP requests)
Client-side metrics: Results delivered by the test engine, includes all the test aspects: number of virtual users, number of requests per second, number of succeeded/failed requests, and much more.
Load testing configurations:
Load Profiles:
Defining different scenarios that mimic the intensity of user interactions and the various use cases of the application as well as the frequency of requests. It allows a more comprehensive and realistic test environment.
Network conditions:
Simulating conditions such as latency, bandwidth and protocols help visualize the application performance under specific network constraints.
Test durations:
It represents the time span during which the load test is being conducted, may vary from seconds to days, and it's an important factor of the load testing as it helps developer test the functioning of the application under sustained load for extended periods of time (stress tests) by detecting any degradation or issues that may occur over time.
RampUp time
In the context of load testing, the ramp up times is the duration it takes to embark all the virtual users of the load test gradually, it essentially controls how quickly the users start interacting with the application being tested. It aims to simulate the scenario where the users load increases gradually instead of instantaneously reaching the maximum capacity.
For example, if we have 5 users in the subject test, and we want a new user to join the app each 5 seconds, the ramp up time will be 5*5=25 seconds
Running Load testing in Azure:
For this example, we will need an active azure subscription as well as the right RBAC role that allows creating and managing resources in the subscription (Contributor/Owner)
Creating Azure load Testing resource:
After signing up and filtering the Azure Load testing service from the search field, you can proceed to creation of the service by configuring the subscription, Resource Group, Name, and location. Finally, you may hit the create button to provision your resource.
Create Azure Load Test:
To proceed with the testing, we need to specify a specific URL of the application or service that will be tested, and either upload a JMeter script that contains the configuration and load profiles of the test or configure those details manually in Azure. For this example, we will opt for the latter.
Configuring the tests load profile:
With Azure load testing service configuration, we may define load profile via number of virtual users or Requests Per second (RPS).
Once you have made your choice about the load type, you will need to setup parameters configuration based on your choice, if we proceed with virtual users, we will need to fill in the form with the number of virtual users, test Duration and the Ramp-Up time.
Azure Load testing will automatically create an Apache JMeter script for the load test based on the configuration we just done; you may download the script from the test run on the dashboard.
Note: instead of setting up the test parameters on the dashboard, we can set the configuration in JMeter script file and upload it to the azure load testing service.
Monitoring test results:
Once the test starts, we will get a dashboard that streams the client-side metrics being refreshed every five seconds. Th dashboard offers multiple options and filters to adapt the graphs to display different metrics, aggregate or filter them.
Integrating Azure Load Testing in CI/CD pipelines:
Automated load testing could easily be integrated into the deployment process using Azure Dev-Ops, as it allows to run the load tests after each commit or before each release to make sure that the delivery will be able to handle the use cases covered in our load test.
Before dipping our toes into the configuration of the pipeline, we need to make sure our setup includes the following requirements: An active Azure subscription, an account with the role of application administrator, an Azure DevOps project and organization that is connected to Microsoft Entra ID, and a load testing resource.
Steps:
From the load test resource interface, we click on the Set up CI/CD option and fill in the form details with the organization, projects, repository and branch.
Once the pipeline creation finishes, a notification will show up in your Azure portal with a link to the pipeline, from which you can run the pipeline /modify its steps or triggers.
When you access the pipeline and try to run it, you will need to install Azure load test from visual studio marketplace and assign the pipeline the permission to access the load test resource, once done, the CI/CD pipeline starts running the test.
Finally, you will be able to see the logs of the tests and its results in the pipeline artifact, and you may also download it for further analysis.
Conclusion:
Ensuring the best possible performance in a variety of use cases, load testing is one of the pivotal options that we should consider. Through an extensive presentation of load test concepts, and its integration in Azure as well as including it in the CI/CD pipelines, this article provides developers with the necessary knowledge to run load tests inside an Azure environment. A knowledge that is much needed in today’s digital landscape, where seamless integration of load tests into the projects pipeline is becoming an essential part of the development workflow.
Top comments (0)