Think Time
A real-world user of a web application takes some time to complete his tasks. These actions include reading a page’s content, providing information on an online form, choosing a product from a list, etc. When doing these tasks, a user experiences what is known as Think Time, which is the interval of time between two actions. Think time is simply the amount of time it takes a user to decide what to do next on a web application.
Here’s an illustration: When a user opens Facebook in a browser, the Facebook login screen is shown. He clicks the Login button after taking five seconds to enter his login email and password. Consequently, these 5 seconds will be regarded as a think time of the user for the Login page.
Why Think Time is Required?
A genuine user never completes all the tasks, including logging in, searching, ordering, paying, and logging out, in a short period of time. He needs some time to read, write, reflect, and take the next action. A performance tester adds a time delay, or “Think Time,” between two transactions to recreate the same scenario. In this way, he simulates a real-world situation in the testing setting.
Another argument is that doing a performance test without Think Time is equivalent to barraging the server nonstop. The server could malfunction as a result, and the server capacity calculation might be off. The virtual users are really stopped by think time for a certain amount of time before submitting another request. It also enables the server to handle requests correctly and deliver outcomes that are comparable to those in a production environment.
Where to add Think Time in the script?
In the test script, think time is always added between two transactions. Always one fewer than the number of transactions is the count of the think time function or component. For instance, if a script had three transactions—login, search, and logout—then the flow would be as follows:
Login->Think Time->Search->Think Time->Logout
Don’t include thinking time at the beginning or the conclusion of the user experience because, in reality, neither happens. Consider that time constantly intervenes between user sessions.
How to decide the value of Think Time?
The length of the material on a web page will determine how much time is worth thinking about. For a typical user, an average Think Time may be between 3 and 10 seconds. Think time value shouldn’t be too high or low to avoid affecting the goal TPS or server performance, respectively.
The concurrent user session on the server is made possible with the aid of thinking time. The user session on the server is extended. As a result, excessive thinking time prevents the server from starting a new session when the server’s capacity is reached. Less user concurrency and frequent user session creation result from inadequate or nonexistent think times.