### How many load generators do we need for Performance Testing

It's one of the regular questions that will be asked as to how many load generators do we need in Loadrunner or any other tool. It depends upon the testing tool that we use and the configuration of our system (Example: CPU, Memory, Operating System etc.).

Without knowing the exact load generators sometimes the performance testing results may vary. For example, if we need four load generators instead we ran the test with only two load generators and the load generator machines will get slower and the permance testing results may vary.

Recently I have gone through an article where the HP Loadrunner team beautifully explained about how many load generators do we need for our test.

We need to follow these steps to calculate how many load generators do we need.

1. First, we need to record the script and enhance the script to work with multiple users and iterations.
2. Once the script is ready, upload the script to controller and run the script with one user using a few minutes delay before the start of the script and observe any increase in RAM when the vuser starts. This is the First Vuser memory.
3. Now run the test with five users and with five iterations and execute the test.  Keep the same starting delay and add next vuser with one minute delay and observe how much increase in ram for every vuser and do average for the last four vusers RAM  and do not count the first vuser RAM usage.
4. Now we need to find how much Total RAM we have in our machine and give 750 MB to 1000 MB for system resources.
5. Find what is the 75 percent of remaining RAM after allocating RAM for system resources. For example, if the system has 4 GB of RAM, and 1 GB for system resources and in 3GB find what is the 75 percent of RAM, which will be 2250 MB, Here I have calculated 1GB equals to 1000MB.
6. Now subtract the first vuser memory.
7. Divide with average of the last 4 Virtual vusers.
8. and at last add the +1 (This is the one vuser first we have subtracted). Load Generators Calculation Formula
Hope it helps, and Please note it just a reference it may not work for some of the protocols like Citrix, RDP, any protocol with the term GUI in it, and QTP\UFT scripts.

### File operations in loadrunner with examples

In this post I will explain how to capture a value from server response and save to a text file using vugen. How to capture and save to text file using loadrunner: First I have recorded the script using bing.com and then i searched for IBM. We will get 10 results. I have captured all the 10 values and saved to a file. Here is the code for that.