Monday, 19 January 2015

Recording secure site in LoadRunner


A while ago, when I tried to record a secure site i couldn't get through the recording successfully. While accessing an application manually it worked fine and creating a manual script with web_add_header it worked fine, but when just hitting record in vugen with the http protocol, I was ended up "page cannot be displayed". Below are some of the proposed solutions to overcome this issue.


Proposed solutions:

I don't know that this will solve your problem, but I have seen somewhat similar behavior when dealing with security certificates on SSL enable pages. Try installing or re-installing the security certificate for the site in IE before you try recording the script.

  • Take a look at your credentials in the system and your browser vendor/version. Make sure that you have admin rights and that you are using a 32 bit browser (VUGEN is a 32 bit application) is one supported for your version of LoadRunner
  • To download security patch from LR site
    • http://www.jds.net.au/tech-tips/problems-recording-https-with-vugen/
  • This is affecting LoadRunner Vugen versions 9 up to and including 11.5 that are trying to record secure sites (https:// www…).  The problem is due to "Microsoft Security Update KB 2661254" (Microsoft Security Advisory: Update for minimum certificate key length) now requiring 1024 bit RSA Certificates and LoadRunner Vugen currently uses 512 bit RSA Certificates .  Please note HP is working on an update.  In the meantime, there are two workarounds.   The First workaround is to uninstall “Microsoft Security Update KB 2661254" via the control panel add and remove Programs which is the easiest method. The second workaround is a registry edit adjusting the acceptable length of the certificate.  Please see the article below For details of the registry edit as it varies from OS to OS.
  • For operating systems with Windows Vista, Windows 7 and Windows Server 2008, you can use certutil commands to change these registry settings. On Windows XP, Windows Server 2003, and Windows Server 2003 R2, you cannot use certutil commands to change these registry settings. However, you can use Registry Editor, reg command, or reg file.
    • At a CMD prompt type 
      • certutil -setreg chain\minRSAPubKeyBitLength 512
    • The "MinRsaPubKeyBitLength" is a DWORD value that defines the minimum allowed RSA             key length. By default, this value is not present, and the minimum allowed RSA key length         is 1024. You can use certutil to set this value to 512 by running the above command:
    • For more detail about this issue and the fix please read "Microsoft Security Advisory:Update for minimum certificate key length".
              http://technet.microsoft.com/security/advisory/2661254
  • KB2839229 is the latest along with the one listed on this page. In case if you got this MS Security patch installed, uninstalling the same will help recording the https urls.




A bottleneck from a disk can significantly impact response time for applications running on your system. So we are going to see what are the most commonly seen disk bottlenecks and how they can be monitored and what are the tolerable values for them.

What are performance counters?
Before selecting the objects and counters, we need to define objects and counters in Windows Performance Monitor (PERFMON). A performance object is an entity for which performance data is available and performance counters define the type of data that are available for a performance object. One performance object will have one or more associated performance counters. When added in the Performance Monitor, they will appear in the form of \Performance Object\Performance Counter. For example:  in \PhysicalDisk\% DiskTime, physical disk is the performance object and % Disk Time is the performance counters.
From disk per se, there are two performance objects which we typically monitor:
1. Physical Disk performance object is one that monitors disk drives on the computer. It identifies the instances representing the physical hardware, and the counters are the sum of the access to all partitions on the physical instance.
2. Logical Disk Performance object monitors logical partitions. Performance monitor identifies logical disks by their drive letter or mount point.

Performance Counters for monitoring Disk
  • Physical Disk (instance)\Disk Transfers/sec counter for each physical disk and if it goes above 25 disk I/Os per second then you've got poor response time for your disk.
  • Physical Disk(instance)\% Idle Time – It is a measure the percent time that your hard disk is idle during the measurement interval, and if you see this counter fall below 20% then you've likely got read/write requests queuing up for your disk which is unable to service these requests in a timely fashion. In this case it's time to upgrade your hardware to use faster disks or scale out your application to better handle the load.
  • PhysicalDisk\% Disk Time: Shows the percentages of time the disks are busy servicing read or write requests. The recommended average should be less than 85%.
  • PhysicalDisk\Avg. Disk Queue Length: Shows the number of disk requests that are waiting for a disk during the sample interval. The recommended average should be less than 2 per disk.
  • PhysicalDisk\Current Disk Queue Length: Shows the number of disk requests that are currently waiting at the time the performance data is collected. The recommended average should be less than 2 per disk.
  • PhysicalDisk\Disk Transfers/sec: Shows the number of read and writes per second regardless of the amount of data. The recommended average should be less than 100 per disk. 
  • PhysicalDisk\Disk Bytes/sec: Shows the amount of data transmitted per disk per second.
  • PhysicalDisk\Avg. Disk Sec/Read: Shows the average in milliseconds (ms) to read from disk. The recommended average should be less than 10 milliseconds (ms).
  • PhysicalDisk\Avg. Disk Sec/Write: Shows the average in milliseconds (ms) to write to disk. The recommended average should be less than 10 milliseconds (ms).

 What can be done?
  • Increase higher memory to reduce paging to the disks.
  • Get faster hard disks to your server.
  • Consider using SAN and RAID array if not already done so.
  • Create multiple files and filegroups in separate disk drives.
  • Relocate the log files to separate disks from the data files.

Guide for Citrix Recording using Load Runner


The below blog will guide you through the pre-requisites which are required and can be set up before starting the Citrix Scripting activities thus helping you take a smoother route of focusing on your script issues rather than the environment/ machine set up issues. This can also be used as a guide to set up the machine and environment for Citrix Application Recordings. So this is just a reference to avoid the known issues or the steps which needs to be taken care of before the recording starts and not to be treated as the only document to be referred to solve all the issues faced during the Citrix Recording

Pre-Requisites:

Before we start recording the Citrix flows, we need to ensure that we have the proper set up in terms of the Citrix Client, The Scripting Tool [Load Runner Version which supports Citrix Recording] and the Web Interface
Details required from Citrix Admin Team:
  • Citrix Server Version
  • Citrix Client Version
  • Citrix Interface Used and Version


1. Client Machine - Machine in which we are planning to record the Citrix Flow using LR-VuGen]
  • Install Citrix Client – Below are the list of clients supported/ not supported by HP for Citrix

XenApp Web plugin 11.0.0 for windows XP  à HP does NOT support any WEB/JAVA clients

Clients that HP supports are

XenApp Plugin (Client) 11.0
à HP advices against this client as there have been disconnect issues during the load test with this Client
Best Supported and Suggested Citrix Clients by HP are
Citrix Online Plugin 11.2
Citrix Online Plugin 12.0

On reaching the page by clicking the url, enter the credentials and login and then click Download against the “Citrix Online plug-in - Admin”. Citrix tries to download the file using the Citrix Downloader. You can either use the citrix download manager to download the citrix online plug in or you can download separately
Once you ensure the proper client is installed in your machine, check that the Citrix registry patch for the client is enabled. If not, enable it before you start recording anything from LR. Location of the registry patch that should be run is – “…./LoadRunner/dat” and the Patch Name is “Enable_Citrix_API.reg”
Before you run this API, go to Registry and check for the following paths and values
[HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA Client\Engine\Lockdown Profiles\All Regions\Lockdown\Virtual Channels\Third Party\CustomVC]
"VirtualChannels"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA Client\CCM]
"AllowSimulationAPI"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ext\PreApproved\{238F6F83-B8B4-11CF-8771-00A024541EE3}]
By default these path would NOT be existing in the registry. When we run “Enable_Citrix_API.reg” [Open With à Registry Editor], all the above paths would get created in the registry. Validate them again for their existence. None of these paths SHOULD be added manually. All these should get added automatically when we run this API
OS of the Client Machine: Preferable to have it as “XP SP3 32 bit“
Disable DEP : Ensure that the DEP is completely disabled
Step I:
First thing is to validate the DEP under Performance of “Advanced” tab. Right click on My Computer, select Properties and choose “Advanced” tab and click Edit under “Performance”. Select the “Data Execution Prevention” tab
The First Option should be enabled [Turn on DEP for essential Windows Programs and Services Only]
The second Option [Turn on DEP for all programs and services except those I select should NOT be selected]
Enabling the first Option against the second is called as Disabling the DEP
Step II:
The Second part of Disable DEP activity is as below
Content of the KM Document:
1. Right click on My computer.
2. Select Properties.
3. Select the Advanced tab.
4. Click Settings under Startup and Recovery.
5. Click Edit.
6. The boot.ini file will open. It should look like the following:

=================
[boot loader]
timeout=5
default=multi(0)disk(0)rdisk(0)partition(1)WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
C:CMDCONSBOOTSECT.DAT="Microsoft Windows Recovery Console" /cmdcons
======================
7. Change the setting noexecute=option TO noexecute=AlwaysOff
8. Reboot your machine.
The procedure given above applies only to Windows XP and Windows 2003. It does not apply to Windows Vistas.
Disable DEP in Vista: [http://support.openview.hp.com/selfsolve/document/KM747283]
1. Click Start
2. Click All Programs
3. Click Accessories
4. Right Click on Command Prompt
5. Left click on Run as Administrator
6. Click the Allow button if it asks you for permission
7. Type or copy and paste this into the command prompt window:
bcdedit.exe /set {current} nx AlwaysOff
8. Hit enter and you should see the confirmation: Operation Completed Successfully
9. Reboot and DEP should be off.


2.    Citrix Server:

Citrix XenApp 4.5 roll out 5.0 à HP does NOT support this version of the Server. Citrix XenApp Server 4.5 roll out 5 is different from Citrix XenApp Server 5.0
Server Versions that HP supports

Citrix Presentation Server 4.0
Citrix Presentation Server 4.5
Citrix XenApp Server 5.0

OS on which the server is running along with the service pack: Client and Server should be running in the same OS.
In Server also, ensure that the DEP is disabled
Citrix Agent installation on the server: This is mandatory for usage of few Citrix functions in the script like “ctrx_get_info”


3.     Citrix Client Interface:

Web Interface version:
To Identify the Web Interface Version, do the following
Open the server URL, where you get to see the application hosted
Right click on the main page and get view source. In the source code, search for Web Interface and that will have the Version
HP supports web Interface version 5.0 officially. However there have been instances of success with Versions 5.x also [As per HP Support Rep]
If you are NOT able to get the Interface version using the above steps, then ask the Citrix Admin of the Interface Version


4.     VuGen Installation:

VuGen 9.52 does NOT support the scripting of Citrix when the below Citrix Clients are used
VuGen v11 is the one which supports the above mentioned Citrix Clients
VuGen v11 should have the below mandatory patches installed - Patches 14+Patch1+patch2

The following are the mandatory patches which need to be installed in ORDER.
a) Critical Update patch:
HP Software Knowledge Document KM999242 (http://support.openview.hp.com/selfsolve/document/KM999242)
File name: LR_03014.exe

b)Patch 1:
HP Software Knowledge Document KM1035229 (http://support.openview.hp.com/selfsolve/document/KM1035229)
File name: LR_03017.EXE

c)Patch 2:
HP Software Knowledge Document KM1088984 (http://support.openview.hp.com/selfsolve/document/KM1088984)
File Name: LR_03044.exe

In Summary:

1. Install all the LR 11 patches
2. Install a supported Client as per the List
3. Run the registry patch from “LR/dat”

Other Steps to be ensured:

While recording, make sure that the Resolution is set to the same as that set in Server. This applies to even the machine on which the test will be run or in the machine in which the script would be validated

Registry Checks:

Ensure that the below in the Registry at the mentioned path or set the value accordingly
With all the above requisites in place, we should be able to record the application without any issues

5.     Load Generator – Citrix Configuration

The below are the changes we need to do in any Load Generator to run the Citrix scripts successfully:
1)    Citrix Client Version 12.1.0.30
2)    Need to add the following syntax in the “Citrix.asl” file in the Load Generator installation path (C:\Program Files\HP\Load Generator\merc_asl\Citrix.asl).
a.    ctrx_sync_on_text_ex

b.    ctrx_sync_on_bitmap_change

Record and Replay Issues in Citrix Protocol of LoadRunner

I am going to brief you about the issues i have encountered while i tried to record citrix protocol in LoadRunner and its resolutions using LR 9.5 and LR 11. Let’s see them in detail.

Issues Encountered:

  • Recording of the Application failed when the Citrix application was launched with Multi-Protocol Option [Web + Citrix_ICA Protocols]
  • Replay of the Script failed to Launch the Application [Or to connect to the Citrix Application]
  • Replay of the Script failed at different point of the script due to Co-Ordinates

Issues Description:

1)   Recording of the Application failed: [LR 9.5]

Recording of the Application failed when the Citrix application was launched with Multi Protocol Option [Web + Citrix_ICA Protocols]. We were able to record the web part of the flow, but once the Citrix Application was launched the tool [LR 9.52] was not able to record the flow and hence scripting the Citrix Application Workflow failed.


Resolution:

It was found that HP does NOT support any “Citrix WEB Clients” and so we were asked to remove the Web Client Plug in and Install an Online Plug in – The list of Citrix Clients supported by HP are listed under Section 3.1. The Client which was installed by us which rectified the issue was “Citrix XenApp Plugin for Hosted Apps”
[Can be downloaded at: http://support.citrix.com/article/CTX118445 for which you should have a login credential to the Citrix site which can be obtained by registering yourself]
But then it was also suggested by HP to have the flow recorded and tested using LR 11 rather than 9.5 and so we went for the recording using LR 11. Recording of the Flow was also possible in LR 11 only when the LR 11 had the mandatory patches installed as per the list in Section 3.4


2)   Replay of the Script failed to launch the Application [Or to connect to the Citrix Application]

The entire Citrix workflow was recorded using LR 11 and on trying to replay the script, we encountered issues at the code snippet below
The above code is where the Citrix_ICA protocol starts and we were failing due to the ICA File not getting generated dynamically


Resolution:

The below points needs to be addressed to solve the issue above
1.    Ensure that the Session Token is CORRELATED – So the script looks as below
The correlation has to happen just before logging in to the Citrix Interface
2.       During recording, ensure that the options are set as below

3)   Replay of the Script failed at different point of the script due to Co-Ordinates

Once the replay issue is fixed with respect to launching the application, various issues were faced at other places of the script. There were failures happening at codes mentioned below where the user performs activities like

a.   Mouse Click:  ctrx_mouse_click(43, 46, LEFT_BUTTON, 0, "Starting TM1 S&P - QA - FP3=snapshot2", CTRX_LAST);

b.    Check Points or Window Synchronizations: ctrx_sync_on_window("Security Warning", ACTIVATE, 314, 257, 397, 205, "snapshot1", CTRX_LAST);

These activities may end in failure when the recording Window size is set to a different one than the Window resolution of the Client Machine in which the script is being executed.


Resolution:

  • To avoid this window size or resolution issue, ensure that in the Recording Options, under Citrix the Window size is set to the one as in Client Machine in which the script is being executed
  • This would ensure that the Co-Ordinates being captured in the Citrix functions such as ctrx_mouse_click or ctrx_sync_on_window are all in sync with the co-ordinates of the client machine
  • We had this set to 1024 X 768 for our recording



Index


What is an Index?
An index is used to gain fast access to specific information in a database table. For Ex: If a book contains some 1000 pages and if a reader wants to search specific topic/word, then he has to go through page by page till he finds his topic/word. But if an index-page is there in the book then the reader would find short time.
If a table contains 100000 records and if a user wants to search for a specific data, then DB has to go through row by row till finds the specific data. But if an index is used in the table, then DB would find the data quickly within a short time

Types of indexes:
  • Clustered index
  • Non-clustered index

Clustered Index:
Clustered indexes are those which arrange and stores the data in a particular order. For e.gg: A phone book sorts entries into alphabetical order. The difference is, once we find a name in a phone book, we have immediate access to the rest of the data for the name such as phone number and address.  A table can have only one clustered index as the table can be sorted in one order only. for e.g:  say if a table contains names, their weight and height then the clustered index can sort the table either by height or weight and not by both way, which is not possible.

Non-clustered Index:
A non-clustered index is a special; type of index in which the logical order of the index does not the physical stored order of the rows on disk. A table can have a max of 249 non-clustered indexes. For eg: the index page in a book. It actually gives only the page number where the specific topic is found but not the details of that topic.

Comparison between Clustered Index Vs Non-Clustered Index:

Clustered Index
Non-clustered Index
There can be only one clustered index in a table.
There can be 249 non-clustered indexes in a table.
The leaf node has the data page.
The leaf node has the index page.

It reorders the way records in table are physically stored.
The logical order of the index does not match with the physical order of the rows stored in the disk.

Limitations:
  • More number of indexes can be used in a read-only table when compared to the table that needs frequent updation.
  • Column that needs to be updated more often should not be indexed because every index is just one more thing that SQL server has to update when making a change to the actual data
  • Clustered indexes don’t do we well when they based on multiple columns


Performance Tips:
  • Try to create indexes on columns that have integer values rather than character values.
  • If your application will be performing the same query over and over on the same table, consider creating a covering index on the table. If you create a composite (muli-column) index, the order of the columns in the key is very important. Try to order the columns in the key as to enhance selectivity, with the most selective columns to the left most of the key.
  • Every index increase the time it takes to perform INSERTS,UPDATES and DELTED so the number of indexes should not be very much.
  • When creating indexes, try to make them unique indexes if at all possible.
  • Because it can often search through a unique index faster than a non-unique index because in a unique index, each row is unique and once the needed record is found , DB doesn’t have to look further.
  • Indexes should be considered on all columns that are frequently accessed by WHERE, ORDER BY,GROUP BY clauses.