Archive for category IT

Optimise XenApp RAM and CPU Part 2

Following my earlier post (http://philipflint.com/2011/12/29/optimise-xenapp-ram-and-cpu/) I have done some digging and, thanks to the hard work done by Jeremy at J House Consulting and the advice he gives (http://www.jhouseconsulting.com/2008/05/13/processor-scheduling-20), I can give what I think is a correct explanation of why the RAM and CPU are optimized in the way they are in the majority of XenApp deployment.

In a Windows 2003 32 bit environment server memory can be optimised either for System Cache or for Programs. The LargeSystemCache registry value ( found ain the registry at HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management) specifies whether the system maintains a standard size or a large size file system cache, and influences how often the system writes changed pages to disk.

Increasing the size of the file system cache generally improves server performance, but it reduces the physical memory space available to applications and services. Similarly, writing system data less frequently minimizes use of the disk subsystem, but the changed pages occupy memory that might otherwise be used by applications.

The value set for this key can be viewed in the server GUI by accessing the performance settings on the advanced tab of the system properties careen. There are two possible values for this key which are:

Value Meaning
0 Establishes a   standard size file-system cache of approximately 8 MB. The system allows   changed pages to remain in physical memory until the number of available   pages drops to approximately 1,000. This setting is recommended for servers   running applications that do their own memory caching, such as Microsoft SQL   Server, and for applications that perform best with ample memory, such as   Internet Information Services (IIS).
1 Establishes a large   system cache working set that can expand to physical memory, minus 4 MB, if   needed. The system allows changed pages to remain in physical memory until   the number of available pages drops to approximately 250. This setting is   recommended for most computers running Windows Server 2003 on large networks.

 

The LargeSystemCache is allocated from kernel memory area, which is shared with the paged pool memory and system page table entries. In a 32 bit environment paged pool memory is limited to a maximum of approximately 650MB however much physical RAM is installed on the server. Similar limitations exist for system page table entries. Reducing either of these in a Citrix environment may lead to increased paging and poorer performance.

In a 32 bit Citrix Presentation Server environment it is recommended that memory is optimised for Applications over System Cache to ensure that the maximum amount of RAM is available for kernel operations.

In a 64 bit environment the above limits have been increased and while the LargeSystemCache entry still exists in the registry its use has been deprecated.

In a Windows 2003 32 bit environment processor scheduling can be optimised either for Programs or Background Services.

Multi-tasking Operating Systems switch from task to task using various algorithms and heuristics giving the impression that they are multi-tasking whereas they are really processing each thread in turn. The time allocated to processing each thread is determined by the CPU scheduler. The choice of scheduling algorithm can be immensely important when it comes to determining the performance of a Server based Computing system such as Citrix Presentation Server.

Changing the processor scheduling option modifies the Win32PrioritySeparation value under the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\PriorityControl key, which consists of 6 bits (AABBCC).

  • Where AA =
    01 – longer timeslice interval
    10 – shorter intervals
  • Where BB =
    01 – timeslice can have variable length
    10 – timeslice has fixed length
  • Where CC =
    00 – foreground/background processes have same priority
    01 – foreground process gets 2 x boost compared to background process
    10 – foreground process gets 3 x boost compared to background process

When you set the performance option for processor scheduling in the GUI, you only see two possible choices for the duration of time allocated to a process:

  1. Programs – Registry value is 38 decimal, binary is 100110 = shorter intervals, variable timeslice length, 3 x boost
  2. Background Services – registry value is 24 decimal, binary is 011000 = longer timeslice interval, timeslice fixed length, no boost

Neither of these settings are optimal for a Remote Desktop Services Server, although the Programs option is the better of the two simply because shorter timeslices are mandatory for a Terminal Server environment.

However, in a Citrix Presentation Server environment the situation changes as Presentation Server provides functionality to optimize the environment over and above that provided by RDS.

If the CPU Utilization Management Feature introduced Citrix Presentation Server 4.0 Enterprise Edition and above has been enabled (which it is by default), the 3 x boost for the default Programs value makes this feature somewhat less effective. In these circumstances the variable timeslice length is often better fixed. Under these conditions it is suggested that the optimum value may indeed be 40 decimal, 101000 binary. That gives us small, fixed length timeslices, allowing the CPU Utilization Management Feature to efficiently do its job by giving each user a fair share of the CPU by modifying the normal job priority scheduling in the operating system.

Setting the Win32PrioritySeparation value to 40 decimal will produce a message similar to the following in the Application Event Logs once the “Citrix CPU Utilization Mgmt/Resource Mgmt” service is next restarted.

———————————————————————

Event Type: Warning
Event Source: CTXCPUUtilMgmt
Event Category: (1)
Event ID: 1591
Date:  22/03/2008
Time:  12:34:28 AM
User:  N/A
Computer: CTX001

Description:
Windows is using a custom priority separation value and CPU Utilization Management performance may be degraded. To optimize CPU Utilization Management performance, on the Advanced tab of the System Properties dialog, open Performance Options and select Background Services. Then restart the CPU Utilization Management service.
———————————————————————

From the above it can be seen that Citrix Best Practice when CPU Utilization Management is enabled is to set Processor Scheduling to favour Background Services. If processor performance remains a bottleneck or a very high number of conext switches are observed then it may be worthwhile changing the value of this key to 40.

Conclusion

In short it can be seen that the “default” settings in a 32 bit XenApp environment should be to optimize RAM for Programs and CPU for Background Services and in a 64 bit environment optimize CPU for Background Services UNLESS CPU Optimization has been disabled.

Tags: ,

Quick Access to System Properties

Tired of having to go around the houses to look at the system properties on a server or workstation ? The quickest way to gain access is to use the built-in shortcuts. Just enter the below at the start menu search box to gain fast access:

Advanced Tab – systempropertiesadvanced
Remote Tab – systempropertiesremote
Hardware Tab – systempropertieshardware
Computer Name Tab – systempropertiescomputername
System Protection Tab – systempropertiesprotection
Data Execution Prevention – systempropertiesdataexecutionprevention
Performance Options – systempropertiesperformance

Of course, you don’t have to remember all of the above, just using systempropertiesadvanced will get you straight to a single tab so that you can navigate from there.

Tags:

How to redirect appdata without issue.

http://blogs.citrix.com/2012/02/11/citrix-profile-management-and-vdi-–-doing-it-right/

Tags: ,

HDX Mediastream and Adaptive Display

Citrus recommend  that media is streamed to the end point whenever available bandwidth is higher than the bit rate of the video. Where there is not sufficient bandwidth Adaptive Display should be used. But what is the bit rate of differ video types ? There’s a handy table below obtained fromWikipedia:

[edit]World Wide Web HD resolutions

Source Codec Highest resolution (W×H) Total bit rate/bandwidth Video bit rate Audio bit rate
Amazon Video On Demand(formerly “Unbox”) VC-1[2] 1,280×720[3] 2.5 Mbit/s[3]
BBC iPlayer H.264[4] 1,280×720[5] 3.2 Mbit/s[4] 3 Mbit/s[4] 192 kbit/s[4]
Blockbuster Online
CBS.com/TV.com (720p) 1,280×720[6] 2.5 Mbit/s[6]
CBS.com/TV.com (1080p) 1,920×1,080[6] 3.5 Mbit/s[6]
DaCast VP6H.264[7] 7680×4320 5 Mbit/s[8]
Hulu On2 Flash VP6[9] 1,280×720[10] 2.5 Mbit/s[11]
iPlayerHD FLVQuicktimeH.264MP4 H.264[12] 1,920×1,080[13] 5 Mbit/s[14]
iTunes/Apple TV QuickTime H.264[15] 1,280×720[15] 4Mbit/s[16]
Netflix Watch Instantly VC-1[17] 1,280×720[18] 5 Mbit/s[19] 2.6 Mbit/s and 3.8 Mbit/s[20]
PlayStationStore Movies & TV Shows H.264/MPEG-4 AVC[21] 1,920×1,080[21] 8 Mbit/s[21] 256 kbit/s[21]
Vimeo H.264[22] 1,920×1,080[23] 4 Mbit/s[24] 320 kbit/s[25]
Vudu H.264[26] 1,920×1,080[27] 4.5 Mbit/s[28]
Zune Video (formerly “Xbox Live Marketplace Video Store”) 1,920×1,080[29] 3 Mbit/s[30]
YouTube H.264/MPEG-4 AVC 4,096×2,304[31]

As you can see, a user should have a minimum of 2.5Mbps before you even think of redirecting the video.

Tags: ,

Optimise XenApp RAM and CPU

I see a lot of deployments of XenApp and / or Terminal Services on 32 bit systems, typically Windows Server 2003 R2 and, while its old hat, I thought it’s still worth taking a few minutes to make a note of the correct settings for optimisation of RAM and CPU in a thin client environment. When you first install Windows Server 2003 R2 the default performance settings for RAM and CPU before the operating system has had a role assigned are as below:

 

Once the Terminal Services Role has been installed these are changed to:

 

At a very basic level, these are the correct settings to use. But why ? For CPU, this forces the CPU to allot less time to a task before switching between tasks. In a service based environment (for SQL or Exchange for example) the CPU should be optimised for services so that the CPU allots more time to a single task before switching to any different task requiring processor time. As servers hosting services tend to have multiple cores this reduces context switching and results in higher performance for long running tasks.

In a thin client environment where multiple users are competing for processor time perceived performance is enhanced if the processor provides some time to each user. That is, if it can switch between threads more quickly. To do this, we optimise for programs in the GUI.

Regarding memory, the limiting factor in a 32 bit thin client server based computing environment is not necessarily user RAM but, more often, paged pool RAM and non-paged pool RAM. These are limited to around 650MB and 256MB respectively (for Windows Server 2003 – these limits have been removed somewhat in Windows 2008). These limits also hold true for Windows Server 2003 r2 Enterprise Edition. The server may have 32GB of RAM, for example, but will still have these small amounts of RAM available for end user tasks. If we optimise the RAM for programs then this reduces the amount of RAM available for these system type processes … the above figures are reduced still further. As paged pool RAM is consumed the server may start to page, even though there is ample spare user RAM. Even more concerning, if non-paged pool RAM is depleted this cannot be paged and, in the worst case, the server may even blue screen.

I hope the above brings some understanding as to why the above are the default settings. Some items to bear in mind:

  1. Mark Russinovich has an excellent article on RAM which applies to thin client environments at http://blogs.technet.com/b/markrussinovich/archive/2009/03/26/3211216.aspx
  2. Jeremy Saunders has written an outstanding article on Processor Scheduling at http://www.jhouseconsulting.com/2008/05/13/processor-scheduling-20
  3. RAM can be set to use prefer System Cache by setting the key HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache to 1
  4. Processor Scheduling can be further optimised by setting the key HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\PriorityControl\Win32PrioritySeparation to 40

Why do people change these settings to the exact opposite of the defaults ? I have no idea but hope that someone can enlighten me.

Securing NetScaler / AGEE interface

By default when you install a NetScaler or AGEE the admin interface can only be connected to by HTTP. To configure the device to allow you to connect by HTTPS complete the following steps:

1) Connect to the devices configuration utility using a browser
2) Expand the Network node
3) Click on RPC
4) Select the NSIP (NetScaler admin IP Address)
5) Click Open
6) Tick the Secure check box
7) Click OK

Tags: , ,

Preventing access to specific applications in XenClient 2

XenClient is fabulous. You have a locked down work image and you have an “open” image where you can run whatever you like in it. You can then “share” applications betweioen running VM’s so you can have your “ticker” or “game” or whatever avaialble on your work machine or you can have your work application viewable from your personal machine. But what if you don’t want certain applications to be available ?

This is controlled from an XML file which instructions the agent where to collect icons from (essentially the all users atsrt menu and any logged on users menu) but exclude anything on the blacklist (Outlook Express, anything in c:\windows etc) unless its included on the list of whitelisted applications (internet explorer for example). So, very easy to configure IF you know where the configuration file is …. which isn’t at all obvious.

The XML file can be found in the following locations:

Windows 7
C:\ProgramData\Citrix\Xci\Applications\XciDiscoveryConfig.xml

Vista
C:\ProgramData\Citrix\Xci\Applications\XciDiscoveryConfig.xml

XP
C:\Documents and Settings\All Users\Application Data\Citrix\Xci\Applications\XciDiscoveryConfig.xml

Tags: , ,

List Users who have logged on to XenApp

Want to know who has logged on to your Citrix server ?

You can just look in the security log in event viewer and filter down but it’s so much easier using the command line. Just open up a cmd prompt and enter

auditlog (all one word)

This will let you list all the sessions from the event log and even pipe them out to a text file for later analysis or reporting.

Tags: , ,

Changing the icon used for folders

When building a desktop image you may want to have some corporate folders which you want to “stand out” from the others and also let users know what the folder should be used for. For example, you may place folders in the “All Users” menu folder or within the users “My Documents” folder.

This can be accomplished by changing the folders icon and adding a tool tip so that a hint appears if a user hovers their mouse over the folder. This is relatively simple to achieve.

  1. Create the folder. I have create done called “RegistryTemplates”

     

  2. Mark the folder as a system folder. Open a command prompt and mark the folder as a system folder using attrib +s Path\FolderName

     

 

  1. Create a text file and name it Desktop.ini. Use Notepad to create this file and ensure it is saved in Unicode format. Also, enclose the file name in quotation marks to ensure that the.txt extension isn’t applied.

  1. Edit the Desktop.ini file created (by double clicking on it). Add a section header

     

    [.ShellClassInfo]

     

  2. Then enter values to inform the file system how to display the folder.

Entry

Value

ConfirmFileOp

Set this entry to 0 to avoid a “You Are Deleting a System Folder” warning when deleting or moving the folder.

NoSharing

Not supported under Windows Vista or later. Set this entry to 1 to prevent the folder from being shared.

IconFile

If you want to specify a custom icon for the folder, set this entry to the icon’s file name. The .ico file name extension is preferred, but it is also possible to specify .bmp files, or .exe and .dll files that contain icons. If you use a relative path, the icon is available to people who view the folder over the network. You must also set the IconIndex entry.

IconIndex

Set this entry to specify the index for a custom icon. If the file assigned to IconFile only contains a single icon, set IconIndex to 0.

InfoTip

Set this entry to an informational text string. It is displayed as an infotip when the cursor hovers over the folder. If the user clicks the folder, the information text is displayed in the folder’s information block, below the standard information.

 

  1. A typical set of entries would look like the below.

     

    [.ShellClassInfo]

    IconFile=C:\Windows\Regedit.exe

    IconIndex=0

    InfoTip=”Registry templates for updating standard settings within the operating system”

     

     

  2. The above will set the icon to be that used by Regedit. The icon index is the index number of the icon within the icon file. If a bespoke icon is to be used, this can be placed within a hidden folder underneath the folder being displayed (use attrib +h FolderName to hide the folder).

     

  3. Save the file.

     

  4. Now open a command prompt and set the desktop.ini file to be a hidden system file using the command attrib +s +h Path\FileName.

     

     

  5. The folder will now display with the regedit icon to provide a visual queue that the folder contains items relating to the registry.

     

     

  6. Hovering the mouse over the folder displays the tooltip.

     

Installing Windows 8 on XenServer

Having trouble installing the recently released developer preview on XenServer ?

Thomas Koetzing has the fix on his blog

Create a VM with a Windows 7 template and copy the virtual machine UUID from the general tab in XenCenter or use xe vm-list in the CLI. Next you need to run the command xe vm-param-set uuid=<VMUUID> platform:viridian=false

The installation can the proceed as normal.

Tags: ,