Set Virtual User Number
Ready API mimics virtual users (or VUs for short). Each user executes a scenario, which is a collection of functional test cases, test suites, or individual requests. Virtual users can run only once during the load test run, or they can restart after their scenario is finished, depending on the test properties. Our Ready API Performance license limits the number of concurrent virtual users that our test can simulate.
The Load Allocation property of the test determines how many virtual users your test will simulate. We can add it to the load test editor's toolbar.
What are the possible issues?
Virtual user simulation consumes memory and processing power on our computer. If these resources are insufficient for simulation, we will notice a decrease in performance or even a crash. Let's look at why this happens and how we can resolve these issues.
Resources that are important are as follows:
-
The amount of RAM available for the Java machine used by Ready API. This figure is determined by the total amount of RAM on your computer. Memory is required to store request and response data, as well as virtual user results
-
The CPU's processing power. It is required in order to simulate virtual users and manage their data (each user works in a separate thread in the OS).
What factors affect resource consumption?
The number of currently running virtual users.
This number is determined by your load test's VUs (or Arriving users) and Load Type properties, as well as the work time of each user scenario.
The size of simulated scenarios. The more requests in a scenario, the more memory its request and response data take up.
The presence and number of target loops in simulated scenarios. Target loops increase the number of simulated requests and responses, which means that they consume more memory.
File and hard drive operations. When compared to data exchange in memory, reading and writing files are time-consuming operations. The longer virtual users work, the more file operations your functional test cases have.
Other applications and services that are running on the computer where your load tests are being performed. They use memory and CPU power, so Ready API Performance will have fewer resources to work with.
How to fix issues?
- First, we recommend that you examine the load test properties to see if they meet our requirements or if they were set incorrectly. For example, we might want to consider whether we really need that many virtual users arriving at the tested server every second.
-
If the properties are correct, then using multiple computers to generate the required load is the best solution. For more information, see About Distributed Load Testing. Another option is to run our test on a different computer with more RAM and a more powerful CPU.
- Try one of the following (or both) to generate load from your current computer:
- Increase the amount of RAM available on your computer for Ready API.
- Modify the load test parameters. Check the work time of the test cases your virtual users run, as well as the values of your load test's Load Type and VUs properties. If the Load Type is Rate, set the "arrival" period to a reasonable length to avoid a rapid increase in the number of concurrent VUs on your computer.
- Also, choose an appropriate number of simulated virtual users.
How to find the maximum number of VUs a computer can run?
In your load tests, it is recommended that you use about 1,000 virtual users per machine.
However, keep in mind that this is an estimate. Because the impact of the factors described above is not precisely defined, no formula can provide an exact answer. You must use the trial-and-error method to find an answer. Run your load test with the number of virtual users you want. If the test fails, reduce the number and rerun it. If the test succeeds, increase the number and try again.
Preparing Functional Test Cases for Load Test
Functional test cases serve as the foundation for load tests. Typically, you create a functional test case that simulates real-world user behavior. However, not every functional test can completely comply with load testing specifications. To use a functional test for load testing, follow these guidelines:
- Instead of Test Suite, Project, or Global properties, use Test Case custom properties.
- Use the Run Test Case test step only once.
- Sharing should be enabled for the Data Sources and DataGen test steps.
- Distribute the Data Sink test step.
- Prepare scripts for the desired test cases.
Frequently Asked Questions
What is user load in performance testing?
A load test is a type of performance test that examines how systems perform when a large number of concurrent virtual users perform transactions over a specific time period.
What is load testing API?
It's a way to see if your application is robust enough to handle the load you want it to handle before your users do.
What aspects are tested while performing load tests on API?
You can monitor response times, throughput, server conditions, and more during load testing. However, the goal of load testing is not to break the target environment.
Are load testing and performance testing the same?
The goal of performance testing is to assess the overall system's performance while Load testing is a technique for determining whether an application can withstand the expected load.
Conclusion
In this tutorial, I tried to explain different aspects of Load Type, Virtual Users, and Test cases related to Performance tests in Ready API. I covered why and how of all the topics related to Performance testing, Virtual Users, and Load type.
Don’t stop here! Learn about Licensing of Ready API and updating and refactoring in Ready API to sharpen your concepts and deepen your knowledge.