Get Knowledge from Video instead of Content:

Wednesday, 30 November 2016

Website Speed Checker Tools



The content has been moved to PerfMatrix Site.



What is Pacing in Performance Testing?


The content has been moved to PerfMatrix Site.




What is Think Time in Performance Testing?

Think time defines the time between two actions of a user. These actions may be navigating the pages, click on the submit button, type keyword and then click "Search" button etc. Still not clear... Ooppppssss?

Let's take one example, you want to buy a Titan watch from Amazon online shopping portal. You liked one watch from the catalogue and you clicked on its image. Before adding into the cart you want to read its "Product Specification" which is on the same page. It took 20 seconds for you to read full specifications and decided to buy this watch then you clicked "Add to Cart" button. So, from the moment when this page was loaded until you read the specification and clicked "Add to Cart" button would be "Think Time" means 20 seconds. See below GIF


How can we calculate think time?
In the real world, think time is totally dependent on user's actions. It may be less than a second for a techie guy while more than a minute for a new user. So, instead of worrying about think time, better you go for an average think time value and use this value between two transactions. Generally, a user spends an average 8 seconds on a website page with average content over there, so you take any figure between 5 to 10 second as a think time. 

You can also calculate think time using below formula (provided that you should have all the required parameters)


Example: If you have - 
  • No. of users = 6
  • End to End Response Time = 25 seconds
  • TPS (Transaction per second) = 0.5
  • Pacing = 15 seconds
  • No. of Transactions = 5
  • Total Think Time = 20 seconds
Average think time would be 5 seconds

You can also verify like this:
Transaction 1 (Home Page)- 3 seconds
Think Time  - 5 seconds
Transaction 2 (Log-in) - 4 seconds
Think Time  - 5 seconds
Transaction 3 (Search) - 10 seconds
Think Time  - 5 seconds
Transaction 4 (Add To Cart) - 5 seconds
Think Time  - 5 seconds
Transaction 5 (Log-out) - 3 seconds
Pacing  - 15 Seconds
Refer Think Time Calculator to calculate think time. 

How can we apply Think Time in our script?
1. Microfocus LoadRunner:
a. Use lr_think_time() between two transactions like:
lr_start_transaction("LogIn");{
........
}
lr_end_transaction("LogIn", LR_Auto);
lr_think_time(5);
lr_start_transaction("Search");{
...........
}
lr_end_transaction("Search", LR_Auto);
b. Use parameter value  for lr_think_time():
int tTime = 5;
lr_start_transaction("LogIn");{
........
}
lr_end_transaction("LogIn", LR_Auto);
lr_think_time(tTime);
lr_start_transaction("Search");{
...........
}
lr_end_transaction("Search", LR_Auto);
How to get the total think time passed in a transaction in Microfocus LoadRunner?
lr_start_transaction(“t1”);{
...
lr_output_message(“%f”,lr_get_transaction_think_time(“t1”));
}
lr_end_transaction(“t1”);
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.

Below options are available for think time in Microfocus LoadRunner under Run Time settings:

Ignore think time:
Think times are ignored. The script is going to run without any delay between each transaction. Use this setting when you want to generate maximum load to heavily stress your Web server. Do not use it when you are trying to create more realistic user interactions with a Web server.

Replay think time:
Think times are used exactly as they were recorded in the Web performance test. Simulates multiple users running the Web performance tests exactly as recorded. It looks all good in Vugen at first but when you are in the Controller, it looks weird as all VUsers will be replaying at the same amount of think time. If you have transactions created for the script, in the Controller graphs, all transactions will perform at the same speed. Because a load test simulates multiple users, using the same think time could create an unnatural load pattern of synchronized virtual users.

Multiply Recorded think time by:
This setting multiplies the recorded value with the numeral provided, extending the time delay in the script. Can increase or decrease the think time as recorded. Means we can increase the think time by multiplying the recorded think time with 1,2 or to decrease the think time multiply the recorded think time with 0.5 or so. The range of value we can enter is 0.01 to 10000.

Use random percentage of recorded think time:
The script will replay the percentage range of the recorded think time. With the recorded think time, we can allow 50% – 150% deviation emulating the expert users (lower range:50%) and novice users (upper range:150%) assuming the speed we are working (recording) with the application is at an average user speed. Provides a more realistic simulation of virtual users by slightly varying the think time between requests.

Limit think time to:
This last option allows the script to replay the maximum think time limit. Suppose while recording or using the above two options we have different think times in different transactions like 60, 90, 120 etc. If we select the option Limit think time to 40 seconds. The think time allowed will be only 40 seconds. If the think time is more, the remaining time is ignored and if it is less it will as it is.

2. Apache JMeter: In JMeter, think time is termed as "Timer". You can use different timers to solve your purpose. Below is JMeter’s Timer list:
Below is typical hierarchy to get more understanding
        Test Plan
o   Config Element
o   Thread Group
🔃  Logic Controller
  Sampler1
⇥  Pre-processor
⇤  Post processor
⦽  Assertion
⥁  Timer
  Sampler2
⇥  Pre-processor
⇤  Post processor
⦽  Assertion
⥁ Timer
  Sampler3
⇥  Pre-processor
⇤  Post processor
⦽  Assertion

Tips:
1. It is recommended to use Average Think Time to make your performance test more realistic.
2. Ignore think time while performing graph analysis
3. Think time also used to control transaction rate
4. Pacing and Think time are two different things

Related Topics:

Required Test Data Calculator

Refer to PerfMatrix Site:


You can easily calculate the expected test data using below calculator by providing the available inputs. 

Considered that:
1. 1 test data (or row) will be used in each iteration.
2. Test Data calculator will calculate the steady-state test data requirement. Give some additional test data if the ramp-up and ramp-down periods are included in the workload scenario.

Calculate Test Data:

No. of Users = 
No. of Iterations per user in an hour = 
Test Duration (in minutes) = 

 Required Test Data = 

Related Topic:


CPS Calculator (Bandwidth Simulation Calculator)




You can calculate the input value of CPS (characters per second) by providing the targetted bandwidth value (in kbps). The calculated value needs to be provided as an input for 'httpclient.socket.http.cps' or 'httpclient.socket.https.cps' properties available in the jmeter.properties file in /bin folder of Apache JMeter. To get more details, you can refer to Link. This calculator is only applicable to Apache JMeter. 

Calculate CPS:

Targetted Bandwidth* =

 Characters per second (cps) =

where,

* The bandwidth value which you want to achieve in the test

Related Topic:

Required Load Generator Calculator


PerfMatrix Site Link: https://www.perfmatrix.com/load-generator-calculator/

Theoretically, the more complex a protocol scripting, the more consumption of system resources. It is a common question "How many Load Injectors require for my load test?" HP has developed the Protocol Complexity Matrix to visualize this.
In one of the LoadRunner community article, I found a piece of article which stressed over to calculate no. of VUsers on one load injectors rather than go blindly on your assumption.
"In previous versions of LoadRunner and Performance Center, a protocol footprint spreadsheet was distributed by HP to provide a guideline for how much memory a script of a particular protocol would consume.  The problem was recipients of the footprint spreadsheet thought of it as definitive rather than prescriptive. It is much better to use a repeatable process and a formula to mathematically estimate the total number of users a load generator can run on a per-script basis."
I typically apply a simple method to get how much VUsers can be run on one LG. First prepare load scenario with 1 user and 1 LG, also provide a long run duration (let's say 2 hours). After starting the test, gradually increasing the number of Vusers by adding from the run window of the test. In parallel, monitor the host resource graphs. Once host resources (CPU/Memory) reach the highest value, stop the test and get the number of VUsers on 1 host. But this method can not be recommended because you can not determine the true capacity of LG using the above method. It is helpful to get approx value.
The method recommended by HP is based on the formula in which below inputs are required.
1. First VUser Memory: To determine First VUser Memory”, create a load test using the script that you want to examine with 1 Vuser and execute the test. Open host resource graph (Memory) and note down the available MB of RAM. Now start your test. Make sure you start your test with some delay so that you can get load generator available memory. Once VUser starts you can see the decrease in available memory. This is the “First VUser Memory”.

2. Each Additional VUser Memory: Run the same test for 5 Vusers. Keep the same delay at the start and have each user start one minute apart.  Monitor the load generators available MB of RAM and note the drop in free RAM space as each user starts.  Average the amount of RAM that the second virtual user on up uses and this is the “Each Additional VUser Memory

3. Total LG RAM: Determine the total RAM on the load generator.
4. LG RAM used by OSDetermine the RAM used by Operating System on the load generator.

How do I check RAM usage on my PC?

  • Right click on Task Bar of LG
  • Left click on “Start Task Manager”
  • You will see “Windows Task Manager” window
  • Click on “Performance” tab within “Windows Task Manager”
  • “Total” under Physical Memory; which in this case is 2047MB or 2GB.
  • “Memory” Section shows the amount of Memory computer is currently using; which in this case is 1.13GB. Make sure your LG should be idle so that you can correctly calculate the memory consumed by OS.

Calculate VUsers on 1 Load Generator:
First VUser Memory (in MB) = 
Each Additional VUser Memory (MB) = 
Total LG RAM (in MB) = 
LG RAM used by OS (in MB) = 
 No. of VUsers on 1 LG = 

==================================================================================

Calculate Required no. of LG for your test:

Total number of VUser in your Test = 
VUsers on 1 LG (from above Calculator) = 
 No. of LG(s) required =  (round-off the value to the higher side)

==================================================================================
Please provide your comments in case of any mistake that will help to improve my blogs

Tuesday, 29 November 2016

Think Time Calculator

PerfMatrix Site Link: https://www.perfmatrix.com/tps-calculator/

You can easily calculate Think Time by providing available inputs. Kindly use 0 (zero) in the respective fields in case of pacing think time:

Calculate Think Time:

No. of Users = 

End 2 End Response Time (in seconds)* = 
No. of Transactions in 1 iteration# = 
Transactions per second (TPS)$ = 
Pacing (in seconds)^= 

 Total Think Time (in seconds) = 

 Average Think Time between each transaction (in seconds) = 

where,

* Time to complete 1 iteration

# e.g. HomePage, Login, Search, Logout etc.


$ If you already have this number then well and good. In case you do not have TPS then calculate like this.

Total Iteration in an hour = 
No. of Transactions in 1 Iteration (in seconds)= 
 Transactions per second (TPS) = 

^ Delay between two iterations

Note: If you have 5 transactions, then think time function/element will be used 4 times like below: 
Start of Iteration
Transaction 1
Think Time ()
Transaction 2 
Think Time ()
Transaction 3
Think Time ()
Transaction 4
Think Time ()
Transaction 5