Skip to main content

Running Vuser as a Process vs. Running Vuser as a Thread

One common dilemma for performance testers is deciding whether to run Vusers as processes or threads. To make an informed choice, it’s important to first understand the distinction between a process and a thread.

1. Process:

A process is an instance of a computer program being executed, with its own dedicated virtual address space. Multiple processes can run simultaneously, but each process operates independently and does not share its memory address space with others.

Example: If you open Notepad, you’ll see a process named notepad.exe in the task manager under the Processes tab. Opening another instance of Notepad will create a second notepad.exe process. Each process has its own memory space, and communication between processes happens through mechanisms like inter-process communication (IPC).

2. Thread:

A thread exists within a process and shares the process’s memory address space with other threads. Multiple threads within the same process can access shared memory, and when one thread is idle, others can use the available resources. This leads to faster execution and improved resource utilization.

3. Multithreading:

In LoadRunner, you have two options when running Vusers:

  • Run Vuser as a process
  • Run Vuser as a thread

The Controller uses either mdrv.exe or r3Vuser.exe to run Vusers. If you select to run Vusers as processes, the driver program is launched separately for each Vuser.

4. Running Vuser as a Process:

When you select "Run Vuser as a Process" and, for example, run 10 Vusers, you’ll see 10 mdrv.exe processes on the load generator machine. Each of these processes will have its own memory address space and establish at least one connection with the web or app server.

This approach, however, can put a heavy load on system resources, particularly memory, as each process consumes its own space. The higher the load, the more strain it places on the load generator's resources.

5. Running Vuser as a Thread:

To reduce resource consumption, you can opt to run Vusers as threads. This allows multiple Vusers to share the same memory address space, meaning you can run a larger number of Vusers without the heavy memory overhead associated with processes.

Additionally, Vuser threads can share open connections through connection pooling, which reduces the time needed to establish a connection with the database. While this seems like an advantage, there’s a significant caveat: running Vusers as threads does not accurately replicate real-world load conditions.

For a more realistic load test, each Vuser should have its own independent connection, which is only possible when Vusers run as processes. Running Vusers as threads may also introduce issues with thread safety, as sharing memory space can cause one thread to interfere with or modify the data of another.

Conclusion:

Before deciding whether to run Vusers as processes or threads, it's essential to consider factors like the load generator’s system resource capacity, available memory, and the thread safety of the protocols being used. While running Vusers as threads may conserve resources, it may not accurately simulate real-world load scenarios, making it critical to weigh these factors based on your performance testing goals.

Comments

Popular posts from this blog

Pacing Time in LoadRunner

What is Pacing? Where and why to use it? -Pacing is the time which will hold/pause the script before it goes to next iteration. i.e Once the   Action   iteration is completed the script will wait for the specific time(pacing time) before it starts the next one. It works between two actions. eg, if we record a script there will be three default actions generated by the Load Runner:   vuser_init, Action   and   vuser_end,   the pacing will work after the   Action   block and hold the script before it goes to repeat it. The default blocks generated by LoadRunner is shown below: Actions marked in Red Now we know what is pacing and we use it between two iteration. The next question comes to mind is why we use pacing: Pacing is used to: To control the number of TPS generated by an user. To control number of hits on a application under test.     Types of Pacing: There are three options to control the pacing in a script: General Pacing:    1. As soon

Error handling using Text Check

Error handling using if else condition. web_reg_find("Search=All",                      "Text/IC=Home Page",                      "SaveCount=home_count",                       LAST); //then after login block paste this code: if (atoi(lr_eval_string("{home_count}")) > 0)                 {                       lr_output_message("Log on Successful");                 }     else               {                     lr_output_message("Log on failed for the Login ID: %s", lr_eval_string("{pUserName}"));                     lr_exit( LR_EXIT_ACTION_AND_CONTINUE,LR_FAIL );                }

String Comparison in Loadrunner script

How to compare a string in Loadrunner script? -There are various methods to compare a string, in below example we have used "strcmp" to compare two values. We have captured a string in "pComparisonString" parameter and comparing it with ABC. Lets say if you have captured some string using correlation and want to compare if the captured string meets the condition then only pass the transactions else fail the transaction: if (strcmp(lr_eval_string("{pComparisonString}"),"ABC") == 0) { lr_output_message("The parameter value is %s", lr_eval_string("{pComparisonString}")); lr_end_transaction("Transaction_Failed",LR_FAIL); } else { lr_error_message("No parameter value captured."); lr_end_transaction("Transaction_Passed",LR_PASS); } -------------------------------------------------------- strcmp- String comparison function. pComparisonString- String which we have captured for compar