Skip to main content

Posts

Showing posts from 2014

How to install Python Package on windows

In Python follow the steps to install other packages on windows: For example:  >>> import requests Traceback (most recent call last):   File "<pyshell#1>", line 1, in <module>     import requests ImportError: No module named requests
To resolve this error: 1.Go to this website https://pypi.python.org/pypi , Search  for the required package, here requests and pick the tar.gz file which you think is the latest. 2.Open the tar.gz (requests-2.4.3.tar.gz) using 7zip or winrar or any other archive manager. 3.There is a folder called "dist' inside the above tar.gz. 4.Inside 'dist' folder there will be a ".tar" file named "requests-2.4.3.tar". Please note that this is the latest version when I downloaded the file. 5.Double click the "requests-2.4.3.tar" file as mentioned above. You will find a folder with the same name “requests-2.4.3". Extract this folder to a specific location. 6.Open Command Prompt. Change direct…

Common list of Bottlenecks

Common list of Bottlenecks:
CPU: CPU overloadContext switches -> too many threads on a core, bad luck with the linux scheduler too many system calls, etc...IO waits -> all CPUs wait at the same speedCPU Caches: Caching data is a fine grained process, in order to find the right balance between having multiple instances with different values for data and heavy synchronization to keep the cached data consistent.Backplane throughput
Network: NIC maxed out, IRQ saturation, soft interrupts taking up 100% CPUDNS lookupsDropped packetsUnexpected routes with in the networkNetwork disk accessShared SANsServer failure -> no answer anymore from the serverMemory: Out of memory -> kills process, go into swap & grind to a haltOut of memory causing Disk Thrashing (related to swap)Memory library overheadMemory fragmentation In Java requires GC pausesIn C, malloc's start taking foreverDatabase:Working size exceeds available RAMLong &…

Code to Generate random Name (10 character) and Credit Card (16 digits)

Code to Generate random Name (10 character) and Credit Card (16 digits) and Save them to a .csv file along with Last_four digits of credit card

Under Vuser_init.c Add the function random_ vuser_init()
{
return0;
}
char buff[32] = "";

random_name(int length) {
int r,i;
srand((unsignedint)time(0));  //Seed number for rand()

  r = rand() % 25 + 65; //uppercase for Initial Letter
  buff[0] = (char)r;

//Loop to generate random small characters
for (i = 1; i < length; i++) {
// A-Z = 65-90 && a-z =  97-122
      r = rand() % 26 + 97; //lowercase
    buff[i] = (char)r;

  }
return0;
}    Code which goes into Action() Action()
{
int i;
char *file1 = "C:\\temp\\sample.csv";
long filename1;
unsignedlong num;
char randnum1[10], randnum2[20];
char name[20];
constchar *last_four;

srand(time(NULL));

filename1=fopen(file1,"w");

fprintf(filename1,"Name, Credit_Card, Four_digits\n");

for(i=1;i<=2;i++)
{
random_name(10); //Pass the Length required as argument
lr_output_mess…

Program to Increment the parameter when the parameter has more digits

I have a Parameter. I want to increase the parameter value by 1. Below is the code to capture the parameter and increment it by 1. Action() {
longdouble i;   
lr_save_string("1234567899", "id");
i = atol(lr_eval_string("{id}"));
i =i+1;   
lr_save_int(i, "id");
lr_output_message("Value is: %s", lr_eval_string("{id}"));
return0; } Output: Starting action Action. Action.c(12): Value is: 1234567900 Ending action Action. Ending Vuser...

If we increase the Length of parameter by one more digit (here 11 digits).  The below logic fails as shown below. LL
Action()
{
longdouble i;   
lr_save_string("12345678999", "id");
i = atol(lr_eval_string("{id}"));
i =i+1;   
lr_save_int(i, "id");
lr_output_message("Value is: %s", lr_eval_string("{id}"));
return0;
} Starting action Action. Action.c(12): Value is: -2147483648 Ending action Action.

So, the solution to handle this type of issues is as below:

Tool : PerfAnalyzer

Tool : PerfAnalyzer This tool developed internally for analyzing the output of Glance, nmon and GC Logs.

The tool has three tabs: 1.Glance Analyzer 2.Nmon Analyzer 3.GC Analyzer
Glance Analyzer: This is used to analyze the output of Glance command. It is sub-divided into two tabs:

1.Off-line Mode : 
To analyze the saved Glance output
2.Online Mode : To analyze the Glance Logs online while the test is running. (Enhancements in Progress)

Inputs required: Glance output file. Output obtained : Graph outputs of CPU Utilization, Memory Utilization, Disk Utilization and Swap Utilization. Also gives Min, Max and Avg values for CPU, Memory and Disk Usage.

Nmon Analyzer: This is used to analyze the output of nmon command. Inputs required: nmon output file. Output obtained : Graph outputs of CPU Utilization, Memory Utilization, Disk Utilization and Network Utilization. System summary gives CPU Info, Memory Info and Partition Info.

GC Analyzer: This is used to analyze the output of GC Logs of Sun java. Inputs…

Finding memory problems

Finding memory problems:

When performance testing a java application and want to identify memory problems, below steps will help:
1.Don’t call it “memory leak” until you are 100% sure-make your program manager jump up and down. (A better term “unaccountable heap usage”, etc.)
2.There is probably some “unaccountable heap size” from each release, there is no need and no time to look for small ones. Concentrate on the large ones which could cause problem down the road.
3.There are some caches which is not leakage-watch out for their growth in size. Also check for some session data, which might be cleaned up after user logoff.
4.Run 72-90 hour stability test under load for each release, monitoring java heap size. Check java heap GC frequency and old gen size. (cat “Full GC” myServer.log |awk ‘/Full GC/ {getnextline; getnextline;getnextline;print $0}’ | awk ‘{print $4}’)
5.Enable GC Logging in JAVA_OPTIONS by adding appropriate flags: "-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -…

Correlation and checking in Results

Correlation and checking

In Previous post we have randomly selected value for depart and arrive. Each Depart and arrive have a outboundFlight and returnFlight field, which changes according to the selected values.
For E.g.: When we recorded the script with depart as “London” and arrive as “Paris” the below flight details was recorded accordingly to the selection.
/*web_submit_form("reservations.pl_2", 
        "Snapshot=t5.inf", 
        ITEMDATA, 
        "Name=outboundFlight", "Value=241;97;03/28/2014", ENDITEM, 
        "Name=returnFlight", "Value=422;102;03/29/2014", ENDITEM, 
        "Name=reserveFlights.x", "Value=26", ENDITEM, 
        "Name=reserveFlights.y", "Value=8", ENDITEM, 
        LAST);
*/

As we see above the outboundFlight and returnFlight is hard coded and needs to be correlated according to the selected value.
So inserting the correlating statements as below. These values are return…

How to choose a value randomly from the list

How to choose a value randomly from the list
For demonstrating the example, we will use the sample application (HP Web Tours Application).  This application shows a sample where we can book flight tickets. The options in depart and arrive are shown as below: web_submit_data("reservations.pl",
"Action=http://127.0.0.1:1080/cgi-bin/reservations.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/cgi-bin/reservations.pl?page=welcome",
"Snapshot=t4.inf",
"Mode=HTML",
ITEMDATA,
"Name=advanceDiscount", "Value=0", ENDITEM,
"Name=depart", "Value=London", ENDITEM,
"Name=departDate", "Value=03/28/2014", ENDITEM,
"Name=arrive", "Value=Paris", ENDITEM,
"Name=returnDate", "Value=03/29/2014", ENDITEM,
"Name=numPassengers", "Value=1", ENDITEM,
"Name=roundtrip", "Value=on", ENDITEM,
&q…