Skip to main content

Loadrunner ~ Performance Testing with Citrix Protocol : Recording Tips n Tricks!




1 . INTRODUCTION

1.1 Citrix Protocol in load runner Recording Tips
When recording a script, be sure to follow these guidelines in order to create
an effective script.


Single vs. Multi-Protocol Scripts
When creating a new script, you may create a single protocol or multi-protocol script. If you plan to record a simple Citrix ICA session, use a single protocol script. When recording an NFUSE Web Access session, however, you must create a multi-protocol script for Citrix ICA and Web (HTML/HTTP), to enable the recording of both protocols.

Record into Appropriate Sections
Record the connection process into the vuser_init section, and the closing process into the vuser_end section. This will prevent you from performing iterations on the connecting and disconnecting.

Run a Clean Session
When recording a session, make sure to perform the complete business process, starting with the connection and ending with the cleanup. End your session at a point from where you could start the entire process from the beginning. Do not leave any client or application windows open.

Explicit Clicks
When opening expanded menu options, click explicitly on each option—do not depend on the expanding menu. For example, when choosing Start > Programs > Microsoft Word, be sure to click on the word Programs.

Do not Resize Windows
Although VuGen supports the resizing of windows during recording the session, we recommend that you do not move or resize them while recording. To change the size or position of a window, double-click on the relevant Sync on Window step in the script’s Tree view and modify the window’s coordinates.

Make Sure Resolution Settings are Consistent
To insure successful bitmap synchronization, make sure that the resolution settings match. On the recording machine, check the settings of the ICA client, the Recording Options, and the Run Time settings. On the load  generators, check the settings of the ICA client, and make sure that they are consistent between all load generators and recording machines. If there is an inconsistency between the resolutions, the server traffic increases in order to make the necessary adjustments.

Add Manual Synchronization Points
While waiting for an event during recording, such as the opening of an application, we recommend that you add manual synchronization points, such as Sync on Bitmap or Sync on Text.

Disable Client Updates
Disable client updates when prompted by the Citrix client. This will prevent forward compatibility issues between VuGen and newer Citrix clients that were not yet tested.

Windows Style
For Sync on Bitmap steps, record windows in the "classic" windows style not the XP style.

To change the Windows style to "classic":
1 Click in the desktop area.
2 Select Properties from the right-click menu.
3 Select the Theme tab.
4 Select Windows Classic from the Theme drop down list.
5 Click OK.

In order to grant that the Citrix protocol can record as expected the environment configuration need to follow some lineups, which are mentioned in the next points.
·         Make sure that you are using the latest available Citrix Client.
·         Grant that the machine connects to the Citrix server and opens the published application without Vugen.
·         DEP (Data Execution Prevention). Disable it in the Vugen and Citrix server.
·         Disable the Seamless mode. Set TWIMode=Off in default.ica file on the Citrix server.
·         Remove in the ICA client ProxyType=Auto.
·         The Citrix session in the Citrix server need to be disconnected and terminated automatically once it closes.
·         Disable AcitveX controls in order to prevent execution of the Citrix Online plugin under Tools->Internet options->Security->Custom level.
·         In Vugen recording options–>Citrix–>Configuration–>Window Size use the same resolution that is used in the ICA file.
·         Use and install the latest HP Citrix Agent in the Citrix Server(Optional).
Because  the  Citrix  protocol  relies  heavily  on  bitmaps  and  coordinates  to  work correctly, there are few things to keep in mind when recording and editing the scripts.

Display Settings
When  writing  Citrix  scripts  in  LoadRunner,  check  the  display  settings  of  the generators where the scripts will be run. The color depth and resolution of the generators  need to be the same as the settings on the computer where the scripts are written.If the settings are different, any sync_on_bitmap functions will fail. Along the same lines, avoid using Remote Desktop Connection when writing scripts or running scripts. When  RDC connects to a computer, it changes the display settings that are in effect on the computer.

Use keyboard instead of Mouse
During the recording of a business process, navigate the application being recorded using the keyboard instead of the mouse. When LoadRunner captures  mouse  clicks,  it  records  the  coordinates  that  were  clicked  on  the  screen.  Replaying these coordinates is not very reliable.  If your script relies heavily on coordinates,  the  scripts  are  more  susceptible  to  being  broken  by  application changes.  As opposed to mouse clicks, navigate the application using the tab key or shortcut keys.  Even if the application changes later, the script can be easily fixed by adding or deleting tab key entries in the script.

Use ICA Files
ICA files contain connection information for Citrix applications. Double-clicking on an ICA file will launch the application. A Citrix administrator can create this file for the person writing the LoadRunner script. When setting up connection information inside of LoadRunner, it is best to use an ICA file to connect.This makes the script more portable and more resilient to server change.  If any of the connection information changes, in order to point the script to the new location, put the new ICA file in the script directory and replace the old one.

Debugging Vusers in the Controller
Sometimes Citrix scripts do not work the same on different computers.  Most of the  time  it  is  because  of  problems  like  color  depth.   If  the  Citrix  scripts  have problems running in the Controller during the debug run, there is a way to see visually what the scripts are doing.  In the Controller, bring up the details for the group that is having problems.  Under the Details section, make sure that “More” has been selected so that all of the options are shown.  In the “Command line”text box, type –lr_citrix_vuser_view.




If the scenario is ran with this option, it will bring up a Citrix window and show the virtual user as it is executing the script.  When using this option, do not run a test scenario  with  many  virtual  users  because  the  Controller  will  open  one  Citrix window for every user in the group.  Because this is so resource intensive, it may crash the Controller if used with too many users. Set aside one group with a few users  with  this  setting  while  the  rest  of  the  users  are  in  different  groups  with standard settings.

Generate Snapshot on Error
Snapshot on error” feature run-time setting is very helpful when debugging Citrix  virtual  users.   It  is  found  in  the  miscellaneous  options  of  the  Run  Time Settings.  Anytime a virtual user fails, a screenshot is sent to the Controller which contains an image of what the screen looked like at the point of failure. It is a great way to diagnose syncing problems, or to troubleshoot other strange  Citrix errors.

After done with scripting using Citrix ICA file in loadrunner , when you run the test you will able to see all the Citrix user load is going to same server which in turn floods the citrix server and huge load may exceed the no of citrix sessions in the server which crashes the server so it is not a best practice.
Solution:
  • Get the Citrix Servers IP details of the application hosted in the Citrix farm from the Citrix Adminitrators
  • Open the ICA File in Notepad and modify the application servers field as below with the new server ip’s and port
[ApplicationServers]
Sample Application=[Sample application]
Address=Citrix Server Ip address: port

  • Save the ICA File with new name do the same and create new files for all the servers.
  • Modify the connect code “ctrx_set_connect_opt(ICAFILE, “newname1.ica”)” with the newly saved file name in the script and assign the each file to each script (if you  have multiple scripts).
  • Distribute the Load accordingly in Performance center and ask you citrix admin to  verify the load being distributed across all servers or not.

2. FUNDAMENTALS
2.1 About Citrix/XenApp technology
Citrix Systems offers a wide range of products ranging from application firewalls to virtualization. It also offers the possibility to do application “streaming” with a product called “XenApp”. Basically, this means a user can access an application from his PC, and use it as if it was locally installed but, in truth, the application is running on servers in a Data Center. This feature is called “Hosted Application Delivery” and should not be confused with “Local Application Delivery”, where a copy of the application is copied to the client PC, and runs locally.
With application streaming, performance will mostly depend on how much ‘power’ there is on the server-side. What are the advantages of such a technology? There are many, and here are some examples below;
·         It’s easier to manage the application; only one installation is necessary on the server-side, which means that any required updates or security patches can quickly be applied.
·         Users only need to have a “client” installed on their device to access any application they may require. The application to which he has access is determined by his rights on the server-side.
This “client” allows a user to connect to the Citrix server work on his applications. It exists for different platforms and OS, and can be obtained from the Citrix web site. Citrix Presentation Server is Windows-based software, and only Windows-compatible applications can be deployed through it.

2.2 About HP LoadRunner – Performance Center
LoadRunner is HP’s tool for application performance testing. It generates load on the servers by simulating the activity of many virtual users (or VUsers). It works by “capture and replay”; all actions performed by a user are captured and translated into a scripting language, and the script obtained can then be replayed to emulate the user actions.
Many different types of protocols can be captured and emulated by LoadRunner. For Citrix tests, LoadRunner can simulate users interacting through Hosted Application Delivery only. This is done capturing the communication between the Citrix Client and the Citrix Servers, and these two communicate through the Citrix ICA protocol.

3. GETTING STARTED
3.1 Requirements for LoadRunner – Performance Center
It is very important to prepare and verify the LoadRunner machines before starting any type of scripting. The Citrix-ICA script generated by LoadRunner is a GUI VUser script. This means that the script will interact with the graphical interface of the application, and the slightest change to the interface may result in a script error.
Changes in the interface can either come from server-side (ex: an application update), or from client-side. In our case, every load generator and the machine used to create the scripts are considered to be clients and because of this, it must be insured that all the following ‘settings’ are identical on all of them.
1) Install/use the same version of the Citrix Client on all LoadRunner machines.
2) Set the same screen resolution and color depth on each of these machines. If some machines offer only remote access, it is possible to change these settings by connecting through VNC.
3) Verify that the LoadRunner service is running with the user for which these settings were changed.
3.2 How many load generators will I need?
Being a GUI-type, Citrix-ICA scripts require a lot of resources from the load generator. While a dual-core load generator with 2 GB of RAM could easily allow many hundreds of Web VUsers to run, it will probably only support about 25 to 40 Citrix VUsers. Keep in mind that every application has its own footprint, and load generators should be monitored at all times during the test campaign.
3.3 Citrix Clients
Ideally, the latest version of the Citrix Client should be used during a test campaign. However, it is not unusual to find old versions the client in companies where the tests are being carried out.
Note that the full version of the client (not the Web plugin) is required when using LoadRunner. In version 12.1, this “full” client is known as the “Citrix Online plug-in Admin”. 





Figure 1: The "full" client is the “admin” one in version 12.1
If the company insists on using an older version (for policy/security issues), it is important to know about the particularities of some versions of the clients:
·         As from version 11.00 of LoadRunner, versions 11.2 and 12.0 of the client are supported. The client 11.* requires a registry patch (in fact, these registry entries are the same as the ones for the version 10 client).
·         As from version 11.00 Patch 02 of LoadRunner, version 12.1 is supported. Again, a registry patch is required, and LoadRunner is bundled with it.
·         Previous versions of the clients (even 10.2) have been declared “EOL” by Citrix. They should work with LoadRunner, but it is recommended to update to a more recent and supported versions.

As for the Citrix Servers, the latest version, called XenApp 6, is supported as from LoadRunner 11.00 Patch 02 (ie LoadRunner 11.02). Citrix XenApp Server 5 is supported as from LoadRunner 11.00.
As from version 11.51 of LoadRunner, Citrix support has been expanded as follows:
XenApp enhancements:
·         The following APIs have been added - Ctrx_Logoff: Closes the current Citrix session, and Ctrx_Get_Server_Name: Returns the Citrix server name.
·         Support for XenApp 6.5 has been added.
ICA file adjustment - Enables support engineers to tweak the ICA files received during Citrix ICA + NFuse recording/replay without having to make changes on the Citrix Server Web Interface level.
·         Support for Citrix XenDesktop has been added.
·         Citrix Access Gateway support: LoadRunner supports CAG for Citrix Client version 10.200 (or less) and Citrix Client version 13.x.
Here is a list of notes and limitations 11.52 service pack LoadRunner:
Citrix Agent is supported on a XenDesktop environment.
·         Installation of the registry patch is required for the support of all versions of Citrix clients over 10.x. Additionally, you need to install Enable_Citrix_API.reg from the LoadRunner\dat folder on VuGen or Load Generator machines if a Citrix Client will be installed after installing LoadRunner.
·         Citrix XenApp Desktop cannot be recorded with Citrix Web Access (formerly known as Citrix NFuse) if Desktop View (Desktop Toolbar) is enabled.
·         Recording a Citrix NFuse script on IE9 is supported from Citrix client version 12.1.0.44.
·         Load Generator cannot be used in service mode for the Citrix protocol when the Citrix XenApp client 11.2 is used. A workaround is to use another version of Citrix client.
·         The Citrix Connection Center may prevent record and replay of Citrix ICA scripts, if it is running in a different user session on the same machine.

Workaround: Close all instances of the concenter.exe process for all users. To prevent the Citrix Connection Center from starting automatically, set the ConnectionCenter registry key to an empty value"". This key can be found at: For 32-bit systems: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run For 64-bit systems: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run

Fixed Limitations (for Service Pack 11.52 Patch 1)
Citrix snapshots. Black snapshots may appear during record or replay when using Citrix Presentation Server 4.0 or 4.5 (before Rollup Pack 3).

3.4 Server Side Considerations
First of all, the user accounts (Citrix) should be unique. For example, if the goal is to run a test with 300 simultaneous VUsers, at least 300 Citrix accounts are required. This will allow each VUser to open a new session, and any extra account can be used to re-run failing users from the Controller.
In the case where a user falls into error, we need to restart it manually, why there should be a number of additional user accounts (in addition to 300 accounts). We recommend having 20% of Citrix user accounts in addition to the 300 accounts.
A user who launches a Citrix application opens a session on the servers. Most of the time, these sessions is maintained for a certain amount of time, after which the sessions are reset. For a real user, this is very useful, as he can recover his work or applications in the same state when switching offices for example. But for load tests, this feature should be modified so that VUsers can find the application in the same state each time they launch it.
Citrix Servers configurations can also be configured to “reset” sessions when a user is disconnected or after a session time-out. 



Comments

  1. We are using VuGen scripts to verify several dozen CITRIX instances (multiple CITRIX servers). Have regular problems with failing instances leaving processes hanging and PCs generally decreasing in performance until it is rebooted. Is there a recommended cleanup between CITRIX sessions being tested, so the mess can be avoided? This process is being run between each instance, but it still does not solve the problem:

    //Force the CITRIX session to log off
    ctrx_logoff(CTRX_FORCED_LOGOFF, CTRX_LAST);

    //Terminate the CITRIX server connection
    ctrx_disconnect_server("", CTRX_LAST);

    ReplyDelete
  2. Thank you very much for this informative post.

    ReplyDelete

Post a Comment

Popular posts from this blog

Peformance Testing with Citrix Protocol : Citrix ICA Vuser Functions (CTRX)

Mouse Functions ctrx_mouse_click Emulates a mouse click on a Citrix client ctrx_mouse_double_click Emulates a double mouse click on a Citrix client ctrx_mouse_down Emulates a mouse down click on a Citrix client ctrx_mouse_move Emulates a mouse move on a Citrix client sent to a Citrix server. ctrx_mouse_up Emulates a mouse up click on a Citrix client ctrx_mouse_click Emulates a mouse click on a Citrix client sent to a Citrix server. int ctrx_mouse_click( long x_pos, long y_pos, long mouse_button, long key_modifier, char *window_name, [CONTINUE_ON_ERROR,] CTRX_LAST ); int ctrx_obj_mouse_click( const char *obj_desc, long x_pos, long y_pos, long mouse_button, long key_modifier, char *window_name, [CONTINUE_ON_ERROR,] CTRX_LAST ); obj_desc A description of the object recorded if the agent is installed on the server. x_pos The horizontal distance of t

ATM API Loadtesting with Sybase ASE using LOADRUNNER 12.60

Introduction            SAP ASE   (Adaptive Server Enterprise), originally known as   Sybase   SQL Server, and also commonly known s   Sybase   DB or   Sybase ASE , is a relational model database server product for businesses developed by   Sybase   Corporation which became part of   SAP  AG. Metrics Considered for load testing of ATM APIs ·          Transaction per Minute (TPM) e.g : 600 TPM ·          Transaction per second (TPS) e.g: 10 TPS Setting up Database connection ODBC Data Source Administrator For 32 bit: C:\Windows\system32\ odbcad32 For 34 bit: C:\Windows\SysWOW64\ odbcad32 Add a new Data Source for Sybase ASE                                  LR Scripting: Web-HTTP/HTML Protocol Action () {          lr_start_transaction ( " P_API_XXXXXX_XXXXXX _ExecuteQuery" );        //Establishing ODBC driver Connection // Connection String for Sybase ASE : //ConnectionString=Dsn={ODBC Reference Name};Uid={use