Think Time: The Time between two transactions or user actions.
A real-world user takes some time to perform his activities on a web application. Such activities involve reading the content of a page, entering the details on a web form, selecting a product from a list etc. While doing these activities, a time gap creates between two actions of a user and this time gap is known as Think Time. Think time simply defines as the time taken by a user to think and perform the next action on a web application.
Let’s take an example: A user launches Facebook in the browser, resulting in that the login page of Facebook appears. He takes 5 seconds to enter his login email, password and hit the Login button. Hence these 5 seconds will be considered as a think time of the user for the Login page.
Why Think Time is Required?
A real user never does all the actions like login, search, place order, payment, logout etc. within a few seconds. Definitely, he requires some time to read, write, think and perform the next action. To simulate the same situation, a performance tester inserts a time delay i.e. Think Time between two transactions. Like this, he creates a real-world scenario in the test environment.
Another reason is if a performance test executes without think time then it is like bombarding the server without any pause. This may fail the server and provide the wrong result for server capacity. In reality, think time halts the virtual users for a defined period of time before sending the next request. Also, it helps the server to process the request in a proper manner and provide the production like results.
Note: Apart from Think Time, Pacing, user load and TPS are also involved to design an accurate scenario for performance checks.
Where to add Think Time in the script?
Think time is always inserted between two transactions in the test script. The count of think time function/component is always one less than the count of transactions. For example, a script has 3 transactions which are login, search and log out then flow is like:
Login->Think Time->Search->Think Time->Logout
Do not add think time at the start or at the end of the user journey because practically there is no such situation. Think time always comes in between a user session.
How to decide the value of Think Time?
Think time value depends on the length of content available on the web page. An average think time could be in the range of 3 to 10 seconds for a normal user. Think time value should not be so large else this may impact the target TPS and should not be too small else this may impact server performance.
Think time helps to achieve the concurrency of the user session on the server. It extends the user session on the server. Therefore too large think time hold the session and restrict the server to create a new session (in case of server capacity reached). Too small think time or no think time causes frequent user session creation and less user concurrency.
Also Refer >> Think Time Calculator