Think time is delay between two steps/pages in the script. It is specified by calling ns_page_think_time() API. Think time passed in the API is called recorded think time.
While browsing the application a user spends some time (think time) before doing any action on the website. For example, If you are purchasing an item, before adding the item to your cart, you take some time to review the features on the product page. This time spent on the product page is called think time. The value of think time varies from user to user and page to page.
In performance testing, we need to simulate the actual real-world scenarios. This is where the think time comes into the picture to better simulate the user journey steps, such as paths to purchase, searching for a product, or logging into an account. Each of these steps have different think time values and it is important to take these into consideration when performing load testing. It is recommended to use Uniform Random think time to simulate the real world test.
Think time is applied only if ns_page_think_time() API is called after a page/step as shown below in this example. In some cases, such as when user action results in multiple steps and the need is to capture the transaction time of the user action think time API should not be added between steps.
voidflow()
{
ns_start_transaction("CavLoadTest");
ns_web_url("CavLoadTest", "URL= https://www.cavisson.com/netstorm-load-testing-solution");
ns_end_transaction("CavLoadTest");
ns_page_think_time(1.5); // Applied Recorded think time is 1 second and 500 milliseconds
ns_start_transaction("CavLoadTestFeatures");
ns_web_url("CavLoadTestFeatures",
"URL= https://www.cavisson.com/netstorm-load-testing-solution/netstorm-features/");
ns_end_transaction("CavLoadTestFeatures");
}
THINK TIME OPTIONS
Use recorded think time
Think time is a value as specified in the API.
No think time
Think time is not applied. It is useful to generate a huge uncontrolled load.
Random (Internet type distribution) think time with median of specified seconds
Think time is an Internet distribution random value with median as specified which is roughly 1/4th of the mean.
Random (Uniform distribution) think time range
Think time is a uniform random value between from and to value specified.
Constant think time
Think time is a constant value as specified.
SHOW ADDITIONAL OPTION
Use recorded think time multiplied by
Think time is multiplied with the specified value. Specified value can be in decimal also in case you want to apply half of recorded think time then you can use 0.5
Use random percentage of recorded think time from a specified range
Think time is a uniform random percentage (between from and to the value specified) of recorded think time.
Custom think time returned by C method
Think time is value returned by the C method which must be added in script with a return value of double. It is currently supported only for C type scripts.
Think time controls the load generated by VUsers. For example, if there are 10 HTTP steps in a script and think time of 1 second (assuming no session pacing), then 1 VUser will generate 1 HTTP hits per second (HPS). If the requirement is to generate 100 HPS Load then you need to use 100 VUsers in the test.
Runtime Changeable Yes
NOTES
Think time is specified in seconds. To use milliseconds, you can give think time in decimal. For example 100 ms is specified as 0.100 seconds.
It is highly recommended to use Think time. For a web application it should be 30-60 Seconds.
Unless it is needed,Think time API should always be used after ns_end_transaction() API .
When Think time is applied, VUser is in Thinking state which can be seen in the 'VUser info' group as 'thinking user' metric. You can also see VUser state in VUser management.
Applied think time can also be viewed in dashboard under timer stats metric group if timer stats metric is enabled in the test .
When you are doing script testing then you can see the applied think time in debug trace log and in Virtual User trace after every step.