Performance Testing prep
TCP vs HTTP
TCP and UDP are the "trucks" on the highway, and the "load" they are carrying are protocols such as HTTP
, File Transfer Protocol (FTP) and more.
As you can understand, TCP and UDP are transport protocols used by protocols such as FTP, HTTP, and SMTP. While both TCP and UDP are used to
transport other protocols, they have one significant difference; TCP offers guaranteed data transportation, whereas UDP doesn't. What this
means is that TCP has a special mechanism that ensures data is safely transferred without errors from one point to another, whereas UDP doesn't
provide any such insurance.
HTTP (HyperText Transfer Protocol) is a protocol that utilizes TCP to transfer its information between computers (usually Web servers and
clients). The client makes an HTTP request to the Web server using a Web browser, and the Web server sends the requested information (website)
to the client.
--------------------------------------------------------------------------------------------------------------------------
HTML vs URL MODE
HTML based mode, records script for every user action that is performed during recording (hmmm…sounds like QTP) while URL based mode records
each and every browser request to the server and resources received from the server. Confused? ok,
HTML based mode does recording as you perform clicks and doesn’t give you inside information like what is happening behind the recording while URL based mode records each and every
step and emulate Javascript code.
From the point1) above you can guess, HTML mode would have less correlation to do while URL mode has much
more complex correlation requirements.
HTML mode is smaller and is more intuitive to read as the statements are inside the functions
corresponding to the user action performed. In the case of URL based, all statements gets recorded into web_url() HTML mode is recommended for
browser applications while URL mode is recommended for non-browser applications.
Lastly, don’t get the impression that I am advocating for HTML mode :). URL mode can be of real help when you want to have control over the
resources that need to be or need not to be downloaded, since you have each and every statement in-front of you (point 1)
--------------------------------------------------------------------------------------------------------------------------
Process vs Thread
In terms of Loadrunner, when we run Vuser as a process, LoadRunner creates 1 process called mmdrv.exe per Vuser. So if we have 10 Vusers, we
will have 10 mmdrv.exe processes on our machines.
while when we run Vuser as a thread, LoadRunner creates 1 thread per Vuser. So if we have 10 Vusers, then we will have 1 process with 10
threads running inside it if the limit is 10 threads per process.
Running Vuser as a thread is more memory efficient that running Vuser as a process for obvious reasons that less memory resources are utilized
when we run them as thread. I read somewhere that running as a process has an advantage that system becomes more stable. Now how is that
stability achieved? I am not sure…can someone clarify this point to me?
The Controller uses a driver program (such as mdrv.exe or r3vuser.exe) to run your Vusers.
If you run each Vuser as a process, then the same driver program is launched (and loaded) into the memory again and again for every instance
of the Vuser. Loading the same driver program into memory uses up large amounts of RAM (random access memory) and other system resources.
This limits the numbers of Vusers that can be run on any load generator.
Alternatively, if you run each Vuser as a thread, the Controller launches only one instance of the driver program (such as mdrv.exe), for
every 50 Vusers (by default). This driver process/program launches several Vusers, each Vuser running as a thread. These threaded Vusers
share segments of the memory of the parent driver process. This eliminates the need for multiple re-loading of the driver program/process
saves much memory space, thereby enabling more Vusers to be run on a single load generator.
To configure these options, open the runtime settings (F4) and select the General > Miscellaneous node.
--------------------------------------------------------------------------------------------------------------------------
Paging and virtual memory
Virtual Memory is an essential part of all Operating Systems. As we saw above, RAM stores info about all the programs currently running on
your desktop. If you open a program when RAM is full, your OS will try to locate programs on RAM which are not in use currently. It will then
transfer those programs to some areas of hard disk, that ways space will be created on RAM for your new programs to run. So effectively,
though there was no space on RAM but your OS created a memory space with the help of your hard disk. This memory is called as Virtual Memory.
The area of hard disk where RAM image is copied is known as page file and process as paging.
--------------------------------------------------------------------------------------------------------------------------
Run vuser from command line prompt:
<installation_dir>/bin/mdrv.exe -usr <script_name>
The following examples provide common usages of a command line expression:
You can specify the load generator, as well as indicate the number of times to run the script as indicated by the following example:
script1 -host pc4 -loop 5
Specify a location for the output files. For example:
-out c:\tmp\vuser
Specify arguments to pass to your script by using the following format:
script_name -arg_name arg_value -arg_name arg_value
You can retrieve the command line values by parsing the command line during replay, using the parsing functions, such as lr_get_attrib_double.
--------------------------------------------------------------------------------------------------------------------------
Create pcap file / ie importing script
How to Create a PCAP File
Pcap (Packet Capture) files consist of network packet data, created by capturing live network activity through capture tools such as
Wireshark. The generated .pcap file can be used for packet sniffing and analyzing network activity. VuGen can parse .pcap files and convert
them to a Vuser script.
--------------------------------------------------------------------------------------------------------------------------
web_reg_save_param :
Convert: The possible values are:
HTML_TO_URL: convert HTML–encoded data to a URL–encoded data format
HTML_TO_TEXT: convert HTML–encoded data to plain text format
IgnoreRedirections: If "IgnoreRedirections=Yes" is specified and the server response is redirection information (HTTP status code 300-303,
307), the response is not searched. Instead, after receiving a redirection response, the GET request is sent to the redirected location and
the search is performed on the response from that location. This attribute is optional. The default is "IgnoreRedirections=No"
NOTFOUND: The handling option when a boundary is not found and an empty string is generated.
"Notfound=error", the default value, causes an error to be raised when a boundary is not found.
"Notfound=warning" ("Notfound=empty" in earlier versions), does not issue an error. If the boundary is not found, it sets the parameter count to 0, and continues executing the script. The "warning" option is ideal if you want to see if the string was found, but you do not want the script to fail.
Note: If Continue on Error is enabled for the script, then even when NOTFOUND is set to "error", the script continues when the boundary is not found, but an error message is written to the Extended log file.
This attribute is optional.
RelFrameID: The hierarchy level of the HTML page relative to the requested URL. The possible values are ALL or a number. Click RelFrameID Attribute for a detailed description. This attribute is optional.
Note: RelFrameID is not supported in GUI level scripts.
SaveLen: The length of a sub–string of the found value, from the specified offset, to save to the parameter. This attribute is optional. The
default is –1, indicating to save to the end of the string.
Search: scope of searcing / ALL/ Body / headers/Noresource
--------------------------------------------------------------------------------------------------------------------------
Work Load modeling
Let’s look at the formula that we will use to calculate the number of users –
Number of virtual users = Length of user scenario (in sec) * Number of requests per second required
To further understand, let’s consider an example. -> Peak load on an application is 10 users per hour and each user on an average spends 10 mins on the website and goes through 10 web pages. This means the implemented user scenario will contains 10 page-requests and each virtual user will run for 10 minutes.
The above formula in such cases gets modified to:
Number of virtual users = Number of users per hour * Number of requests per user * 3600 / [Length of user scenario (in sec)]
Here:
Number of users per hour = 10
Number of requests per user = 10 (number of web pages he accesses)
Length of user scenario = 10 min * 60 = 600 sec
Hence using above formula:
Number of virtual users = 10 * 10 * 3600 / 600 = 600
TCP and UDP are the "trucks" on the highway, and the "load" they are carrying are protocols such as HTTP
, File Transfer Protocol (FTP) and more.
As you can understand, TCP and UDP are transport protocols used by protocols such as FTP, HTTP, and SMTP. While both TCP and UDP are used to
transport other protocols, they have one significant difference; TCP offers guaranteed data transportation, whereas UDP doesn't. What this
means is that TCP has a special mechanism that ensures data is safely transferred without errors from one point to another, whereas UDP doesn't
provide any such insurance.
HTTP (HyperText Transfer Protocol) is a protocol that utilizes TCP to transfer its information between computers (usually Web servers and
clients). The client makes an HTTP request to the Web server using a Web browser, and the Web server sends the requested information (website)
to the client.
--------------------------------------------------------------------------------------------------------------------------
HTML vs URL MODE
HTML based mode, records script for every user action that is performed during recording (hmmm…sounds like QTP) while URL based mode records
each and every browser request to the server and resources received from the server. Confused? ok,
HTML based mode does recording as you perform clicks and doesn’t give you inside information like what is happening behind the recording while URL based mode records each and every
step and emulate Javascript code.
From the point1) above you can guess, HTML mode would have less correlation to do while URL mode has much
more complex correlation requirements.
HTML mode is smaller and is more intuitive to read as the statements are inside the functions
corresponding to the user action performed. In the case of URL based, all statements gets recorded into web_url() HTML mode is recommended for
browser applications while URL mode is recommended for non-browser applications.
Lastly, don’t get the impression that I am advocating for HTML mode :). URL mode can be of real help when you want to have control over the
resources that need to be or need not to be downloaded, since you have each and every statement in-front of you (point 1)
--------------------------------------------------------------------------------------------------------------------------
Process vs Thread
In terms of Loadrunner, when we run Vuser as a process, LoadRunner creates 1 process called mmdrv.exe per Vuser. So if we have 10 Vusers, we
will have 10 mmdrv.exe processes on our machines.
while when we run Vuser as a thread, LoadRunner creates 1 thread per Vuser. So if we have 10 Vusers, then we will have 1 process with 10
threads running inside it if the limit is 10 threads per process.
Running Vuser as a thread is more memory efficient that running Vuser as a process for obvious reasons that less memory resources are utilized
when we run them as thread. I read somewhere that running as a process has an advantage that system becomes more stable. Now how is that
stability achieved? I am not sure…can someone clarify this point to me?
The Controller uses a driver program (such as mdrv.exe or r3vuser.exe) to run your Vusers.
If you run each Vuser as a process, then the same driver program is launched (and loaded) into the memory again and again for every instance
of the Vuser. Loading the same driver program into memory uses up large amounts of RAM (random access memory) and other system resources.
This limits the numbers of Vusers that can be run on any load generator.
Alternatively, if you run each Vuser as a thread, the Controller launches only one instance of the driver program (such as mdrv.exe), for
every 50 Vusers (by default). This driver process/program launches several Vusers, each Vuser running as a thread. These threaded Vusers
share segments of the memory of the parent driver process. This eliminates the need for multiple re-loading of the driver program/process
saves much memory space, thereby enabling more Vusers to be run on a single load generator.
To configure these options, open the runtime settings (F4) and select the General > Miscellaneous node.
--------------------------------------------------------------------------------------------------------------------------
Paging and virtual memory
Virtual Memory is an essential part of all Operating Systems. As we saw above, RAM stores info about all the programs currently running on
your desktop. If you open a program when RAM is full, your OS will try to locate programs on RAM which are not in use currently. It will then
transfer those programs to some areas of hard disk, that ways space will be created on RAM for your new programs to run. So effectively,
though there was no space on RAM but your OS created a memory space with the help of your hard disk. This memory is called as Virtual Memory.
The area of hard disk where RAM image is copied is known as page file and process as paging.
--------------------------------------------------------------------------------------------------------------------------
Run vuser from command line prompt:
<installation_dir>/bin/mdrv.exe -usr <script_name>
The following examples provide common usages of a command line expression:
You can specify the load generator, as well as indicate the number of times to run the script as indicated by the following example:
script1 -host pc4 -loop 5
Specify a location for the output files. For example:
-out c:\tmp\vuser
Specify arguments to pass to your script by using the following format:
script_name -arg_name arg_value -arg_name arg_value
You can retrieve the command line values by parsing the command line during replay, using the parsing functions, such as lr_get_attrib_double.
--------------------------------------------------------------------------------------------------------------------------
Create pcap file / ie importing script
How to Create a PCAP File
Pcap (Packet Capture) files consist of network packet data, created by capturing live network activity through capture tools such as
Wireshark. The generated .pcap file can be used for packet sniffing and analyzing network activity. VuGen can parse .pcap files and convert
them to a Vuser script.
--------------------------------------------------------------------------------------------------------------------------
web_reg_save_param :
Convert: The possible values are:
HTML_TO_URL: convert HTML–encoded data to a URL–encoded data format
HTML_TO_TEXT: convert HTML–encoded data to plain text format
IgnoreRedirections: If "IgnoreRedirections=Yes" is specified and the server response is redirection information (HTTP status code 300-303,
307), the response is not searched. Instead, after receiving a redirection response, the GET request is sent to the redirected location and
the search is performed on the response from that location. This attribute is optional. The default is "IgnoreRedirections=No"
NOTFOUND: The handling option when a boundary is not found and an empty string is generated.
"Notfound=error", the default value, causes an error to be raised when a boundary is not found.
"Notfound=warning" ("Notfound=empty" in earlier versions), does not issue an error. If the boundary is not found, it sets the parameter count to 0, and continues executing the script. The "warning" option is ideal if you want to see if the string was found, but you do not want the script to fail.
Note: If Continue on Error is enabled for the script, then even when NOTFOUND is set to "error", the script continues when the boundary is not found, but an error message is written to the Extended log file.
This attribute is optional.
RelFrameID: The hierarchy level of the HTML page relative to the requested URL. The possible values are ALL or a number. Click RelFrameID Attribute for a detailed description. This attribute is optional.
Note: RelFrameID is not supported in GUI level scripts.
SaveLen: The length of a sub–string of the found value, from the specified offset, to save to the parameter. This attribute is optional. The
default is –1, indicating to save to the end of the string.
Search: scope of searcing / ALL/ Body / headers/Noresource
--------------------------------------------------------------------------------------------------------------------------
Work Load modeling
Let’s look at the formula that we will use to calculate the number of users –
Number of virtual users = Length of user scenario (in sec) * Number of requests per second required
To further understand, let’s consider an example. -> Peak load on an application is 10 users per hour and each user on an average spends 10 mins on the website and goes through 10 web pages. This means the implemented user scenario will contains 10 page-requests and each virtual user will run for 10 minutes.
The above formula in such cases gets modified to:
Number of virtual users = Number of users per hour * Number of requests per user * 3600 / [Length of user scenario (in sec)]
Here:
Number of users per hour = 10
Number of requests per user = 10 (number of web pages he accesses)
Length of user scenario = 10 min * 60 = 600 sec
Hence using above formula:
Number of virtual users = 10 * 10 * 3600 / 600 = 600
Comments
Post a Comment