Friday, June 7, 2013

What is a page fault?

An interrupt that occurs when a program requests data that is not currently in real memory. The interrupt triggers the operating system to fetch the data from a virtual memory and load it into RAM.

An invalid page fault or page fault error occurs when the operating system cannot find the data in virtual memory. This usually happens when the virtual memory area, or the table that maps virtual addresses to real addresses, becomes corrupt.


Click here to know more
The read/write speed of a hard drive is much slower than RAM, and the technology of a hard drive is not geared toward accessing small pieces of data at a time. If your system has to rely too heavily on virtual memory, you will notice a significant performance drop. The key is to have enough RAM to handle everything you tend to work on simultaneously -- then, the only time you "feel" the slowness of virtual memory is is when there's a slight pause when you're changing tasks. When that's the case, virtual memory is perfect.

When it is not the case, the operating system has to constantly swap information back and forth between RAM and the hard disk. This is called thrashing, and it can make your computer feel incredibly slow.

The area of the hard disk that stores the RAM image is called a page file. It holds pages of RAM on the hard disk, and the operating system moves data back and forth between the page file and RAM. On a Windows machine, page files have a .SWP extension.

Next, we'll look at how to configure virtual memory on a computer.

How to convert plain text into hexadecimal and octal formats in Loadrunner?

I already have explained how to use web_convert_param function. In this post I will write about how to convert plain test to hexadecimal format. I once used this for encoding a string.

char *PlaintoHexadecimal(const char *InputS, char *OutputS)
{   

                int i;
                char CurrentChar;
                char CurrentStr[4] = {0};   
               
                OutputS[0] = '\0'; 
                for (i = 0; CurrentChar = InputS[i]; i++)  
                {
                                sprintf(CurrentStr, "%X", CurrentChar);          
                                strcat(OutputS, CurrentStr);   
               
                } 
            return OutputS;
               
}


Action()
{
   
char InputS[] = "This is plain string";
char OutputS[100];


lr_output_message("The input is %s",InputS);
lr_output_message("The output is %s", PlaintoHexadecimal(InputS, OutputS));

return 0;

}

Once you execute the above code, the string will be converted to hexadecimal format as shown below:




Wow Done!!!! Now how to convert the plain text in octal format?
Just change the X factor to o factor ;). I am not kidding. You just have to change the below string

sprintf(CurrentStr, "%X", CurrentChar);        to     sprintf(CurrentStr, "%o", CurrentChar);          

Hope you will execute that and see what happens. I got this:
Click here to know more




Thank you so much for reading and following.

How to convert plain text into URL format in Loadrunner?

Sometimes while parametrization and correlation we need to put a check on the type of value that is being passed. And we need to convert the format of the variable. For this we have a function in LoadRunner web_convert_param this function either converts HTML text to plain text or URL, or converts plain text to URL.

The syntax of web_convert_param is as:

int web_convert_param( const char *ParamName, [char *SourceString] char *SourceEncoding, char *TargetEncoding, LAST );
In the below example we are converting string "Plain text to be converted to URL" to URL format from plain format.

Example:
Click here to know more

Action()
{

char param1[]="Plain text to be converted to URL";

lr_save_string(param1, "Input");

lr_output_message("The value of input is : %s",lr_eval_string("{Input}"));
web_convert_param("Input","SourceEncoding=PLAIN","TargetEncoding=URL", LAST );

lr_output_message("The value after converting is : %s",lr_eval_string("{Input}"));
return 0;

}

The output will be as :

 The following table shows same content in the three formats :
HTML
URL
Plain Text
<mytag>&
%3Cmytag%3E%26
<mytag>&

That’s all for today :). Thanks for reading guys!!!

How to encrypt a string in Loadrunner using password encoder? How to use the encrypted value in script?

Suppose you face a situation, when you want to encrypt your password and use this value in script. This is a cake walk.

You have to go to password encoder, the Password Encoder tool lets you enter regular text and convert it to an encoded string.

Choose Start > Programs > LoadRunner > Tools > Password Encoder to open the Password Encoder tool.



Password: Enter the password you want to encode, and then click Generate.
Encoded string: Displays the encoded password string.
Generate: Generates an encoded string after a password is entered.
Copy: Copies the encoded password string to the clipboard.

Done!!!

Now, How to use the encrypted value in script?
Click here to know more

This is done by using lr_decrypt function as shown below in script.

vuser_init()
{
    web_set_proxy("oregon:8080");
    web_set_user("oregon_user",

    lr_decrypt("518a296870b8b8d477e2f63cbbe5f2a0")," oregon:8080");
    web_url("web_url",
        "URL=http:// oregoncity.com /",
        "TargetFrame=",
        "Resource=0",
        "Referer=",
        LAST );

}

What is HTTP protocol? What are HTTP status codes?

The Hypertext Transfer Protocol (HTTP) is an application protocol for distributed, collaborative, hypermedia information systems. Wow!!! What a definition. Let me explain you in general terms.



We all communicate and to do that we follow a protocol or set of rules. In the same way, HTTP short for Hypertext Transfer Protocol is a set of standards that allow users of the World Wide Web to exchange information found on web pages. When wanting to access any web page enter http:// in front of the web address, which tells the browser to communicate over HTTP. For example, the full URL of my blog is http://performancetestingcentre.blogspot.com/


Status Codes
HTTP servers respond to client requests in the form of a response message. The first line of the HTTP response is called the status line and this includes a numeric status code as "500" and a textual reason phrase as "Internal Server Error".

These codes are mainly of five types:
Click here to know more

Type 1: Informational - 1xx

Status Code
Meaning
100
Continue
101
Switching Protocols
102
Processing

Type 2: Success - 2xx

Status Code
Meaning
200
OK
201
Created
202
Accepted
203
Non-Authoritative Information
204
No Content
205
Reset Content
206
Partial Content
251
Fin (i-mail capture)
252
Rec (i-mail capture)
255
Empty (i-mail capture)

Type 3: Redirection - 3xx

Status Code
Meaning
300
Multiple Choices
301
Moved Permanently
302
Moved Temporarily
303
See Other
304
Not Modified
305
Use Proxy
307
Temporary Redirect

Type 4: Client Error - 4xx

Status Code
Meaning
400
Bad Request
401
Unauthorized
402
Payment Required
403
Forbidden
404
Not Found
405
Method Not Allowed
406
Not Acceptable
407
Proxy Authentication Required
408
Request Timeout
409
Conflict
410
Gone
411
Length Required
412
Precondition Failed
413
Request Entity Too Large
414
Request URL Too Large
415
Unsupported Media Type
416
Requested Range Not Satisfiable
417
Expectation Failed
451
ID Error (i-mail capture)

Type 5: Server Error - 5xx

Status Code
Meaning
500
Internal Server Error
501
Not Implemented
502
Bad Gateway
503
Service Unavailable
504
Gateway Timeout
505
HTTP Version Not Supported
552
POST Error (i-mail capture)
553
GET Error (i-mail capture)
554
Unordered (i-mail capture)
561
UE POST Error (i-mail capture)


Sunday, June 2, 2013

What is memory leak? How it affects performance of application?

A memory leak is a type of unintentional memory consumption by program where the program fails to release memory when no longer needed. This condition is normally the result of a bug in a program that prevents it from freeing up memory that it no longer needs. This term has the potential to be confusing, since memory is not physically lost from the computer. Rather, memory is allocated to a program, and that program subsequently loses the ability to access it due to logic flaws.

Now the most important question comes up, how do they affect Loadrunner functioning?
Click here to know more

This is so obvious, memory leak, if left unattended and not corrected, could prove to be fatal. Memory leaks can be found out by running tests for long duration (say about an hour) and continuously checking memory usage.

Issues caused by memory leaks are essentially based on two variables for a standalone windows application

1) Frequency of usage
2) Size of memory leak.

If either one or both are very high, the computer might come to a point when no memory is available for other applications. This could lead to a computer crash. If it is a network based application then you will also have to consider network traffic. If each network transaction causes a memory leak, then a high volume of network transactions could also prove dangerous.

What is Virtual memory and how Virtual memory works?

Virtual memory is a technique that allows the execution of processes that may not be completely in memory. One major advantage of this scheme is that programs can be larger than physical memory.

Further, virtual memory abstracts main memory into an extremely large, uniform array of storage, separating logical memory as viewed by the user from physical memory. This technique frees programmers from the concerns of memory-storage limitations.

Virtual memory also allows processes to easily share files and address spaces, and it provides an efficient mechanism for process creation.

Virtual memory is not easy to implement, however, and may substantially decrease performance if it is used carelessly.

How Virtual Memory is useful?
Click here to know more

The ability to execute a program that is only partially in memory would confer many benefits:

1. A program would no longer be constrained by the amount of physical memory that is available. Users would be able to write programs for an extremely large virtual-address space, simplifying the programming task.

2. Because each user program could take less physical memory, more programs could be run at the same time, with a corresponding increase in CPU utilization and throughput, but with no increase in response time or turnaround time.

3. Less I/O would be needed to load or swap each user program into memory, so each user program would run faster.

Thus, running a program that is not entirely in memory would benefit both the system and the user.

Thus we see that because of Virtual memory your computer feel like is has unlimited RAM space even though it only has 2 GB installed. Because hard disk space is so much cheaper than RAM chips, it also has a nice economic benefit. ­

Implementation of Virtual Memory

Virtual memory is commonly implemented by demand paging. In a demand paging system processes reside on secondary memory (which is usually a disk). When we want to execute a process, we swap it into memory. Rather than swapping the entire process into memory, however, we use a lazy swapper, which never swaps a page into memory unless that page will be needed.

Saturday, June 1, 2013

What is the difference between URL recording mode and HTML recording mode?

Selecting recording level in VuGen lets you specify the information to be recorded and which functions to use when generating the script. The available modes are:

a) HTML-based script
b) URL-based script

HTML or URL recording is one of the more important choices a script writer must make. The difference lies in the layer at which the user steps are recorded. Each has its advantages. For LoadRunner scripts, HTML level is a common choice. On very complex web applications, the entire script may need to be recorded at URL level.

HTML is a higher level that records in "Browser" or "Context Sensitive" mode. This setting allows the Browser to determine which page resources (such as images or Flash content) should be downloaded depending on the HTML source that was downloaded during replay.
Click here to know more

URL is a lower level that records in "Analog" mode. This setting does not allow the browser to determine which page resources (such as images or flash) should be downloaded. Each resource is recorded in the script during the Recording session. This level will also record any hidden items, such as session ID information, sent to and from the server.




When data is posted to a server by the browser, the two modes generate two different statements in the script. Following are the main differences we have between URL mode and HTML mode:

1. HTML mode script will generate a web_submit_form statement that only records options that an end user is allowed to see and change. If a problem is encountered with a form submission in HTML mode, you can enable the URL option under HTML Advanced to instruct VuGen to record all of the requests and resources from the server.

2. URL mode script will generate a web_submit_data statement that records all data that was actually sent from the browser to the server. Note that the URL mode includes hidden information that the HTML recording does not pick up. Quite often, this will include session ID information.


3. HTML based mode, records script for every user action that is performed during recording while URL based mode records each and every browser request to the server and resources received from the server. This means 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.

4. Because of complexity, HTML mode would have less correlation to do while URL mode has much more complex correlation requirements.

5. 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()

6. 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.

You must keep a tab on below points for VuGen and controller.

In our daily routine, we forget a lot of things like forgetting keys, forgetting to set alarm, but my favourite is forgetting my access card ;). The best part of this is you can learn move a step ahead towards perfection. I believe you are perfectionists. Coming straight to the point following are a few things we must keep in mind to avoid such mistakes while running load tests:

  1. When a script is opened in Controller, run-time settings are copied from VuGen to controller.
  2. Any changes done in the script and run-time settings done on VuGen after loading in controller are not reflected in the controller unless you refresh them.
  3. Refresh in controller can be done by going to Design tab > Scenario Groups pane >Details >Refresh a drop down will come with options for Scripts and Runtime Settings. So when controller asks to load new script iteration settings do the refresh.
  4. Click here to know more
  5. You have option while doing Save As:
    1. The Default directory in VuGen can be changed by going to vugen.ini file located under C:\Program Files\HP\Loadrunner\config and appending the required file path to LastScriptPath, as shown below.

    1. Also, the Default directory in Controller can be changed by going to wlrun.ini file located under C:\Program Files\HP\LoadRunner\config and appending the required file path to M_ROOT
  1. While debugging scripts in VuGen ignore the think time but while playing back in Controller use as recorded or as per requirement of test. Because while load testing purpose is to emulate real world users and not to held a competition to find a super user who completes the Business scenario in one breath.
Hope you will keep this in mind. VuGen scripting best practices coming soon. Stay Tuned!!

How to estimate memory requirements for Vusers in Loadrunner?

When we run load tests each virtual users uses some memory of host system for example web VUsers will need memory for cookies and viewstates, this is called memory footprint also  known as memory requirement for a Vuser. This mainly depends on Vuser type (Web, Web Services, CITRIX, SAP GUI), application and system where you run the test.


Click here to know more
If we take an example of web application in which your Web HTTP/HTML Vuser takes 4MB when running as a process, 100 Vusers would take 400 MB. Along with this network connections, third party programs that are running in background, memory consumed by application; all added together will give the total memory required.