VUGen Think Time Replay Settings

Think Time

Think time is introduced in the script to emulate the idle time of a real user. The function used in Load runner to introduce think time is

lr_think_time(time_in_sec)

Significance of Think time

 Think time is used to create concurrency. Let us suppose a script performs the task of logging in performing a small task and then logging out. To emulate the idle time of a real user, we introduce think time after login transaction and before logoff transaction. In application there is session created for each user and that session is valid only until the user logs out. A session has some associated data that occupies some memory in the system.

Each time a user logs in a memory foot print of some size gets created. And when the user logs out that memory is cleared, deleted, etc. Now, the time that the user remains logged in for matters.

If your scripts have no think time then they will be creating these footprints very quickly and then just as quickly removing them. Memory in use, blip!, memory not in use. But if they do use think time the memory remains in use for a longer time thus creating greater concurrency and making the execution more realistic.

Think time options

 Think time options can be found in the Run Time Settings under General. To open the settings either use shortcut F4 or Go to Vuser -> Run-Time Settings.

The different option or think time are:

  • Ignore think time
  • Replay think time

Ignore think time

When this option is selected the think time at all the points in the scripts is ignored.

Replay think time

When this option is selected a number of other option to replay are enabled.

Replay think time options;

  • As recorded
  • Multiply recorded think time by
  • Use random percentage of recorded think time
  • Limit think time(common option for all the above options)

The first option replays the think time as it is. If the value passed in lr_think_time is 5 sec, the actual think time introduced during execution will also be 5 sec.

The second option multiplies the think time in the script by the specified integral value.

In the above case the think time in the script will be multiplies by 2

In the third option a random think is introduced depending on the percentage range specified.

In the above case if the think time at a particular point in the script is 5 sec then actual think time would be between 5(100%) to 7.5(150%) sec

For all the above options, there is an additional option to limit the think time to a certain value. This sets the maximum value of the think time that can be introduced during execution.

In the above case let us suppose the think time in the script is 8 sec. Due to the above selected option, a random percentage between 50% and 150% i.e. a value between 4 and 12 sec would be the actual think time.  But the option to limit the think time to 7 sec is also checked so if the calculated value is below 7 sec then it will be actual think time but if the calculated value is greater than 7 then 7  will be actual think time.

How to get the total think time passed in a transaction

Code:

lr_start_transaction(“t1”);

// code

lr_output_message(“%f”,lr_get_transaction_think_time(“t1”));

lr_end_transaction(“t1”);

Explanation:

The function lr_get_transaction_think_time should be put before the end of the respective transaction. In the above case, the lr_output_message displays the transaction think time in the log.