Wednesday, 18 December 2013

Dynamic Transaction Name in Vugen scripting

Here I am giving code to generate the dynamic transaction name as many time it requires in our scripting.

 For example, if I am searching for a document with a different set of properties every time, like – approved, withdrawn, submitted etc., its better I have a prefix transaction name like “T01_SearchDocWithStatus_” and then append to it the parameterized value chosen.


char transactionName[100];

char* temp[50];

strcpy(temp,” T01_SearchDocWithStatus_”);

strcat(temp,lr_eval_string(“{DocStatus}”));

strcpy(transactionName,temp);

lr_start_transaction(transactionName);

web_url{


This way, when you run the scenario, you can look at the response times of individual status fetches

Note: that you cannot declare the transactionName as a pointer variable.

Thursday, 12 December 2013

AWR Report


I think as a performance tester we should know about the basic analysis of AWR report. In this post I am going to explain about basic analysis of AWR report.

AWR: Automatic Workload Repository

Very crucial part of AWR report is SQL Statistics. Which has all sql query details executed during report time interval.  
  • We can genaerte AWR report on hourly basis. It will not generate less than an hour.So we can say this is the limitation of Oracle database. Instead of having one report for long time like one report for 4hrs. it's is better to have four reports each for one hour.  Reason is that  if we take long durtion report it will give Average of all counters during that period of time. That would not be much useful.

  • It's always good to have two AWR Reports, one for good time (when database was performing well), second when performance is poor. This way we can easily compare good and bad report to find out the culprit.
  • After getting an AWR Report This is first and Top part of the report. In this part cross check for database and instance and and database version with the Database having performance issue.This report also show RAC=YES if it's an RAC database.

  • "DB CPU(s)" per second:   Before that let's understand how DB CUP's work. Suppose you have 12 cores into the system. So, per wall clock second you have 12 seconds to work on CPU.
       So, if "DB CPU(s)" per second in this report > cores in (Host Configuration ) means env is CPU bound      and either need more CPU's or need to further check is this happening all the time or just for a fraction of time. As per my experience there are very few cases, when system is CPU bound.

Ex: machine has 12 cores and DB CPU(s) per second is 6.8. So, this is not a CPU bound case

  •  Parses and Hard parses: If the ratio of hard parse to parse is high, this means Database is performing more hard parse. So, needs to look at parameters like cursor_sharing and application level for bind variables etc.
 
  • Instance Efficiency percentage:
    In these statistics, you have to look at "% Non-Parse CPU". If this value is near 100% means most of the CPU resources are used into operations other than parsing, which is good for database health.
  • Top 5 Timed Foreground Events: First of all check for wait class if wait class is  User I/O , System I/O,  Others etc this could be fine but if wait class has value "Concurrency" then there could be some serious problem. Next to look at is Time (s) which show how many times DB was waiting in this class and then Avg Wait (ms). If Time(s) are high but  Avg Wait (ms) is low then you can ignore this. If both are high or Avg Wait (ms) is high then this has to further investigate.
  • Sql Ordered by Elapsed Time: Look for query has low executions and high Elapsed time per Exec (s) and this query could be a candidate for troubleshooting or optimizations. Ex: you can have query as maximum Elapsed time but no execution. So you have to investigate this.                                                 In Important point, if executions is 0, it doesn't means query is not executing, this might be the case when query was still executing and you took AWR report. That's why query completion was not covered in Report.
     
 
 

 

Random function code

Here I am giving the random function code. This code is very useful in selection of random number out of a pool. Ex selection of 1 value from drop down, click on a link out of 10 link etc..

  web_reg_save_param("soc","LB=option value=\"","RB=\"","ORD=ALL",LAST);

TotalMatchesCount=atoi(lr_eval_string("{soc_count}"));

    if(TotalMatchesCount>0)
    {
        srand(time(NULL));
         random=rand()%TotalMatchesCount+1;
        
         sprintf(sRandomURL,"{soc_%d}",random);
        
         lr_save_string(lr_eval_string(sRandomURL),"soc_value");
         lr_output_message("Parameter value = %s",lr_eval_string(sRandomURL));

           lr_start_transaction("ABC");
           -------------
     Body=searchParamTxt=Search+Pol&gcDirectoryIn=First+name&pt1:r3:0:soc1={soc_value}
           -------------
          lr_end_transaction("ABC",LR_AUTO);
}
else
       
    {
        lr_output_message("%s","Not Found  link");
    }


Note: Suppose TotalMatchesCount is 5. Then random=rand()%TotalMatchesCount generates value between 0 to 4 so we add 1 so that it become 1 to 5. Now we can use soc_1..... soc_5.

 

Sunday, 27 October 2013

SiteScope

                                                             SiteScope

Here I am going to post how to monitor using sitescope.

Wednesday, 26 June 2013

CPU,Processor,Core,Thread and Clustered

I choose this article because for working on analysis concept of CPU,Processor,Core and Thread should be clear.

Now a days CPU and Processor are almost same thing.

A dual-core CPU is like having two CPUs inside one chip. But, they both have to access the motherboard resources through the one set of pins.

A processor "core" is a physical processing unit on the die (the silicon wafer - the actual chip). Older CPUs have only one core per chip. For these, to get two processing units (cores) you must have a motherboard with two separate CPU sockets. With two physical CPUs, communication between the CPUs has to go out one CPU socket, across the motherboard support circuitry, and in through the socket of the second CPU. This is considerably slower than the speed at which things take place inside the circuitry on the same chip. So to increase processing speed, and to lower manufacturing and end-user costs, individual CPUs were designed to have more than one processing unit (cores) on the chip. So a 2-core CPU is very much like having two separate CPUs but is less expensive and can often be faster than two single-core CPUs of the same capability because of the increased communication speed between them, and because they can share common circuitry such as a cache.

How to find number of Prrocessors and Number of Core.

Type msinfo32.exe at Run command prompt. Under System Summary-->Processor tab we can see number of core and Logical Processors.

Type Systeminfo at command prompt to get the details of number of Processors under
 Processor<s>: 1 Processor<s> installed
 Processor<s>:  2 Processor<s> installed


If hyper threading is enables, this will give the number of logical processors = 2* Number of Physical core

In Inter Processor HyperThreading concept is enabled.In AMD processor there is no hyperthreading.
Number of logical processors = Number of Physical core (Only for AMD Processor)

In the case of intel hyperthreading (HT), you have two logical cores per physical core, so a quad-(physical) core i7 processor will have eight logical cores. However the two logical cores within one physical core cannot truly operate in parallel with respect to each other. This is because HT works by having one logical core operate while the other logical core is waiting and has nothing to do (for example when it is waiting on a cache or memory fetch).

Well then how can these logical cores be considered in parallel? Well most of the time they can be because during typical CPU operation you will almost never see continuous execution of a single thread on every clock cycle - there are always gaps when one logical core is waiting for something and the second logical core can kick in and do its job.

we can also see all logical core under Task Manager-->Performance: CPU Usage
 

                                                               Thread


In a simplistic view, a thread (a sequence of steps to be executed) is constructed in a "pipeline" and then "scheduled" for execution by a CPU core. Once a thread is scheduled, the CPU core is executing the pipelined instructions. Frequently, while the thread is executing, the CPU needs more information than just the series of instructions: it needs data. These data values may be only a few nanoseconds away in some RAM memory location or they may be several thousand nanoseconds away (milliseconds) on a disk drive. When a core has to stop executing the thread while it waits to fetch the external data, time is lost. No other thread can be executed while the waiting thread is scheduled on that core (the thread is given an allotment of time and not kicked out early).



This is similar to a single lane bridge. Only one car can use the bridge at a time. If a driver stops to take a scenic picture, no other car can use the bridge until the driver gets his picture and moves off the bridge. To prevent complete closure of the core, the CPU has a mechanism to swap an entire thread off of the core if it experiences a serious problem (like a car with a breakdown), but that is a very costly process and is not used if the thread is just waiting for I/O to complete so that it may continue executing. Like the car analogy, forcing a hung thread out of a core prematurely is like waiting for a tow truck to get the broken down car off the bridge. It takes quite a while, but it is still quicker than repairing the car on the bridge.


A multi-threaded core is like a bridge that has a passing lane. When the driver on the bridge stops to take a picture, the car behind him can still use the bridge by passing the stopped car using the passing lane. Think of it as two different pipelines where thread executions are constructed. Still only one can be scheduled to a core at a time. But if the executing thread is waiting to fetch I/O, the other thread can jump in the core and get a little CPU time in while the thread assigned to the core is waiting.

This allows what may look like two cores (two pipelines executing at the same time). BUT IT IS NOT. Still only one thread at a time can be executed by the core at a time. This just allows another thread to execute during the waiting period of the first thread. Depending upon specific application design, data needs, I/O, etc, multithreading can actually decrease performance or may increase performance up to about 40% (sited from Intel and Microsoft sources).


Intel CPUs support multithreading, but only two threads per CPU. AMD CPUs do not support multithreading


Web Logic Thread details:

Execute Thread Total Count: This is the total number of threads “created” from the Weblogic self-tuning pool and visible from the JVM Thread Dump. This value correspond to the sum of: Active + Standby threads

Active Execute Threads: This is the number of threads “eligible” to process a request. When thread demand goes up, Weblogic will start promoting threads from Standby to Active state which will enable them to process future client requests


Standby Thread Count: This is the number of threads waiting to be marked “eligible” to process client requests. These threads are created and visible from the JVM Thread Dump but not available yet to process a client request


Execute Thread Idle Count: This is the number of Active threads currently “available” to process a client request

Hogging Thread Count: This is the number of threads taking much more time than the current execution time in average calculated by the Weblogic kernel.











In the above snapshots, we have:

Total of 43 threads, 29 in Standby state and 14 in Active state
Out of the 14 Active threads, we have 1 Hogging thread and 7 Idle threads e.g. 7 threads “available” for request processing
Another way to see the situation: we have a total of 7 threads currently “processing” client request with 1 out of 7 in Hogging state (e.g. taking more time than current calculated average)

If the number of HoggingThreadCount increases then the server health is in dangerous. That time you can take the ThreadDump

                                                                             Clustered

A server cluster is a group of independent servers running Windows Server 2003, Enterprise Edition, or Windows Server 2003, Datacenter Edition, and working together as a single system to provide high availability of services for clients. When a failure occurs on one computer in a cluster, resources are redirected and the workload is redistributed to another computer in the cluster. You can use server clusters to ensure that users have constant access to important server-based resources.

Advantage:
Application and service failures, which affect application software and essential services.
System and hardware failures, which affect hardware components such as CPUs, drives, memory, network adapters, and power supplies.
Site failures in multisite organizations, which can be caused by natural disasters, power outages, or connectivity outages.

Single Quorum Device Cluster
The most widely used cluster type is the single quorum device cluster, also called the standard quorum cluster. In this type of cluster there are multiple nodes with one or more cluster disk arrays, also called the cluster storage, and a connection device, that is, a bus. Each disk in the array is owned and managed by only one server at a time. The disk array also contains the quorum resource. The following figure illustrates a single quorum device cluster with one cluster disk array.
Single Quorum Device Cluster
Because single quorum device clusters are the most widely used cluster, this Technical Reference focuses on this type of cluster.


Wednesday, 12 June 2013

Controller, Performance center and Vugen

Here I am giving some common thing that we should know.

Controller   

Script path in Controller:
D:\Program Files (x86)\HP\Performance Center Host\scripts\635060910293426528\Parameter_Test


Performance center:

Version Control:

Launch Vugen. Then select File > Open > Script/Solution(from ALM file) In the Open VuGen Script or Solution dialog box, select the script to open and then click Open.

Saving Script
Select File > Save Script. If the script is in a project that uses version control and is not checked out, the script is saved as a temporary file on your local machine.


Note: If the script is checkout and we click on save button it will save in Performance center. Click on refresh button to reflect the changes in PC.

Problem in uploading script on PC

If you have any problem in uploading script or any other unusal behaviour on PC then do following steps:

  • Launch Performance center URL
  • Login Lab management
  • Check system health under Performance center
  • Check the Task progress: It should be Succeeded mode
  • If it is not then check the IP address of PC servers and cross verify with the PCServer IP
  • Sometime need to re-zip the script and upload again.
  • Sometime need to upload the script on performance center  from Vugen by Checkin process.

How to increase the Run duration during load Test

Example : Suppose we have given 1 hr  stable duration during scenario creation and started the load test. Now I want to increase stable duration from 1 hr to 3 hr. Then follow the below steps:

  • Go to Design Groups and Scheduler
  • Edit Scheduler
  • Click on Pause Scheduler: It halts the Rampdown activity
So now test will run till timeslot is booked. If we resume the scheduler the ramp down will start.


How to increase the Timeslot of test:
  • Click on TimeSlot duration on Run time page
  • Enter no of minutes you want to increase
  • Click on Apply button

 How to Increase number of users during  load test
  • Click on Run Vusers
  • Assign number of users to a particular group
  • Select " Add new Vusers to DownState"
  • Click Apply button

Friday, 17 May 2013

Run Time Setting


Download Non-HTML resources:
 If you check this option then comment all images, cs, js file in the  Extrares otherwise it will download again all images ,CS,Js file and your response time would be more than that expected for that transaction.



What is an additional attribute in loadrunner vugen?

Additional attribute is a run time setting in VuGen and controller in loadrunner. This is used for reading a attribute value from run time settings.
This will be helpful, to pass any value to the test script from run time settings. This will overcome the limitations of parameters in VuGen. The parameters can be read and edited from the VuGen script only. Cannot be edited from controller.
If you want pass some value to the script from controller, we use additional attributes. Since additional attributes are part of run time settings, so it can be passed from controller. But there should be corresponding functions written in VuGen script to read the values.
Additional Attribute:
    char *cache1;
    char *cache2;

    cache1=lr_get_attrib_string("Cache_Param1");
    lr_save_string (cache1,"NewCache1");

    cache2=lr_get_attrib_string("Cache_Param2");
    lr_save_string (cache2,"NewCache2");

In Performance center Command line argument:
-Cache_Param1 "http://tkodclxgfa1stg003.lehman.com:19000"

Note:Cache_Param1 is the string that will give in Run-time setting.

Sunday, 31 March 2013

Industry standard for loading time of a website

Here I am giving some Industry standard response time. This is very useful when we don't have any data.

Response time to display web pages: 
- 3 seconds considered excellent 
- 3-5 second acceptable 
- over 5 seconds and it is not a search, considered unacceptable. 

For a search transaction, anything upto 7-8 seconds is considered acceptable. 

For web services, under 1 second is excellent. 
Upto 3 seconds may be acceptable. 

Friday, 15 March 2013

How to capture all dynamic value in a text file

Place below code in vuser_init() section:

long InvoiceRequestID_file;
char *InvoiceRequestID="c:\\InvoiceRequestId.dat";



Place below code in Action part:

Here InvoiceRequestId is the variable name that in web_reg_save_param();

if ((InvoiceRequestID_file = fopen(InvoiceRequestID, "a+")) == NULL )
 {
  lr_error_message("Cannot open %s", InvoiceRequestID);

  return -1;
 }

 fprintf(InvoiceRequestID_file, "%s\n",lr_eval_string("{InvoiceRequestId}"));
 fclose(InvoiceRequestID_file);


Output: All value of InvoiceRequestId will be captured in InvoiceRequestId.dat file and new value will be append at the end of file.
Note : No need to declare a+ anywhere as it takes as the string.

How to Change Password of IUSR_METRO Account

Sometime we need to change the password of IUSR_METRO Account. This may be required due to compliance issue. Below are the steps to chang...