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 pac...

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_E...

How to troubleshoot high Memory utilization during performance testing

 When troubleshooting high memory utilization during performance testing, it's important to identify the underlying causes and take appropriate steps to address the issue.  Here are some steps to troubleshoot high memory utilization: Monitor Memory Usage: Use performance monitoring tools to track memory usage over time. Monitor both physical and virtual memory (RAM) to identify if memory consumption is exceeding available resources. Identify Memory-Intensive Processes: Identify the specific processes or components that are consuming a significant amount of memory. Performance monitoring tools can help you identify the memory-hungry processes. Look for any particular application, service, or module that stands out in terms of memory usage. Analyze Code and Memory Allocation: Review your application's code and algorithms to identify any memory leaks, inefficient memory allocation, or excessive object creation. Look for areas where large amounts of memory are being consumed unnec...