System Optimization
Workspace Environment Management (WEM) system optimization consists of the following settings:
- CPU management
- Memory management
- I/O management
- Fast logoff
- Citrix Optimizer
- Multi-session optimization
These settings are designed to lower resource usage on the agent machine. They help to make sure that freed-up resources are available for other applications. Doing so increases user density by supporting more users per server.
System optimization settings are machine-based and apply to all user sessions, but process optimization is user centric. This means that when a process triggers CPU spike protection in user A’s session, the event is recorded only for user A. When user B starts the same process, process optimization behavior is determined only by process triggers in user B’s session.
CPU management
These settings let you optimize CPU usage.
Processes can run across all cores and can use up as much CPU as they want. In WEM, the CPU management feature lets you limit how much CPU capacity individual processes can use. CPU spike protection is not designed to reduce overall CPU usage. It is designed to reduce the impact on user experience by processes that consume an excessive percentage of CPU usage.
When CPU spike protection is enabled, if a process reaches a specified threshold, WEM automatically lowers the priority of the process for a certain time. Then, when a new application is launched, it has a higher priority than the lower-priority process and the system will continue to run smoothly.
CPU spike protection examines each process in a quick “snapshot.” If the average load of a process exceeds the specified usage limit for a specified sample time, its priority reduces immediately. After a specified time, the process’ CPU priority returns to its previous value. The process is not “throttled.” Unlike in CPU Clamping, only its priority is reduced.
CPU spike protection is not triggered until at least one instance of an individual process exceeds the threshold. In other words, even if total CPU consumption exceeds the specified threshold, CPU spike protection is not triggered unless at least one process instance exceeds the threshold. But when that process instance triggers CPU spike protection, new instances of the same process are (CPU) optimized when the option Enable intelligent CPU optimization is enabled.
Whenever a specific process triggers CPU spike protection, the event is recorded in the agent’s local database. The agent records trigger events for each user separately. This means that CPU optimization for a specific process for user1 does not affect the behavior of the same process for user2.
For example, if Internet Explorer is sometimes consuming 50–60% of CPU, you can use CPU spike protection to target only those iexplore.exe instances that are threatening VDA performance. (By contrast, CPU clamping applies to all processes.)
We recommend that you experiment with the sample time to decide the optimal value for your environment that does not affect other users logged on to the same VDA.
CPU spike protection
Note:
- “CPU usage” in the following settings is based on “logical processors” in the physical or virtual machine. Each core in a CPU is considered as a logical processor, in the same way that Windows does. For example, a physical machine with one 6-core CPU is considered to have 12 logical processors (Hyper-Threading Technology means that cores are doubled). A physical machine with 8 x CPUs, each with 12 cores has 96 logical processors. A VM configured with two 4-core CPUs has 8 logical processors.
- The same applies to virtual machines. For example, suppose you have a physical machine with 8 x CPUs, each with 12 cores (96 logical processors), supporting four multi-session OS VDA VMs. Each VM is configured with two 4-cores CPUs (8 logical processors). To restrict processes that trigger CPU spike protection on a VM, to use half of its cores, set CPU core usage limit to 4 (half of the VM’s logical processors), not to 48 (half of the physical machine’s logical processors).
When enabled, lowers the CPU priority of processes for a period of time (specified in the Idle priority time field) if they exceed the specified percentage of CPU usage for a period of time (specified in the Sample time limit field). When you select the Basic Deployment type, the following optimization features are enabled by default. These settings are stored in the pre-defined agent cache file.
Automatically prevent CPU spikes. This option automatically reduce the CPU priority of processes that overload your CPU. This option automatically calculates the threshold value at which to trigger CPU spike protection based on the number of logical processors (CPU cores). For example, suppose that there are 4 cores. With this option enabled, if the overall CPU usage exceeds 23%, the CPU priority of processes that consume more than 15% of the overall CPU resources reduces automatically. Similarly, in the case of 8 cores, if the overall CPU usage exceeds 11%, the CPU priority of processes that consume more than 8% of the CPU resources reduces automatically.
Customize CPU spike protection. Lets you customize settings for CPU spike protection.
-
CPU usage limit. The percentage of CPU usage that any process instance must reach to trigger CPU spike protection. This limit is global across all logical processors in the server, and is determined on an instance-by-process basis. Multiple instances of the same process do not have their CPU usage percentages added when determining CPU spike protection triggers. If a process instance never reaches this limit, CPU spike protection is not triggered. For example, on a Server VDA, in multiple concurrent sessions, suppose that there are many iexplore.exe instances. Each instance peaks at around 35% CPU usage for periods of time, so that cumulatively, iexplore.exe is consistently consuming a high percentage of CPU usage. However, CPU spike protection is never triggered unless you set CPU Usage Limit at or below 35%.
- Sample time limit. The length of time for which a process must exceed the CPU usage limit before its CPU priority is lowered.
-
Idle priority time. The length of time for which the CPU priority of the process is lowered. After that time, the priority returns to one of the following:
- The default level (Normal) if the process priority is not specified in the CPU priority tile and the Enable intelligent CPU optimization option is not selected.
- The specified level if the process priority is specified in the CPU priority tile, regardless of whether the Enable intelligent CPU optimization option is selected.
- A random level depending on the behavior of the process. This case occurs if the process priority is not specified in the CPU priority tile and the Enable intelligent CPU optimization option is selected. The more frequent the process triggers CPU spike protection, the lower its CPU priority is.
Enable CPU core usage limit. Limits processes that trigger CPU spike protection to a specified number of logical processors on the machine. Type an integer in the range of 1 through X, where X is the total number of cores. If you type an integer greater than X, WEM limits the maximum consumption of isolated processes to X by default.
- CPU core usage limit. Specifies the number of logical processors to which processes that trigger CPU spike protection are limited. In the case of VMs, the value you type limits the processes to the number of logical processors in the VMs rather than in the underlying physical hardware.
Enable intelligent CPU optimization. When enabled, the agent intelligently optimizes the CPU priority of processes that trigger CPU spike protection. Processes that repeatedly trigger CPU spike protection are assigned progressively lower CPU priority at launch than processes that behave correctly. Note that WEM does not perform CPU optimization for the following system processes:
- Taskmgr
- System Idle Process
- System
- Svchost
- LSASS
- Wininit
- services
- csrss
- audiodg
- MsMpEng
- NisSrv
- mscorsvw
- vmwareresolutionset
Enable intelligent I/O optimization. When enabled, the agent intelligently optimizes the process I/O priority of processes that trigger CPU spike protection. Processes that repeatedly trigger CPU spike protection are assigned progressively lower I/O priority at launch than processes that behave correctly.
Exclude processes. By default, WEM CPU management excludes all of the most common Citrix and Windows core service processes. You can, however, use this option to Add or Remove processes from an exclusion list for CPU spike protection by executable name (for example notepad.exe). Typically, antivirus processes would be excluded.
Tip:
- To stop antivirus scanning taking over disk I/O in the session, you can also set a static I/O Priority of Low for antivirus processes, see I/O Management.
- When processes trigger CPU spike protection, and process CPU priority is lowered, WEM logs a warning each time it lowers the CPU priority of a process. In the Event Log, in Application and Services Logs, WEM Agent Service, looks for Initializing process limitation thread for process.
Prevent child processes from inheriting CPU priority. Specifies processes whose child processes you do not want to inherit the CPU priority.
CPU spike protection option
Choose how you want to enforce CPU spike protection:
- Automatically prevent CPU spikes. Use this option to let the agent perform CPU spike protection when the system CPU usage (relative to a single CPU core) exceeds 90% and the process CPU usage (relative to a single CPU core) exceeds 80%.
-
Customize CPU spike protection. Lets you customize settings for CPU spike protection.
- CPU usage limit. The percentage of CPU usage that any process instance must reach to trigger CPU spike protection. This limit is global across all logical processors on the server, and is determined on an instance-by-process basis. To configure the limit based on a single CPU core as a reference, use the Set limit relative to single CPU core option.
Note:
- Both integer and non-integer values are supported. By entering a non-integer value, for example 37.5%, you restrict processes that use more than three cores on an eight-core platform.
Set limit relative to single CPU core. Lets you set a limit on CPU usage based on a single CPU core as a reference. The value can be greater than 100%, for example, 200% or 250%. Example: When the value is set to 200%, the agent optimizes processes that use two or more CPU cores. Both integer and non-integer values are supported. Note:
- With Customize CPU spike protection configured, CPU spike protection is triggered when either the global CPU usage limit or the CPU usage limit relative to a single CPU core is reached, whichever occurs first.
For processes that trigger CPU spike protection, the agent can do the following:
- If the Enable CPU core usage limit option is not selected: The agent lowers the CPU priority of those processes.
- If the Enable CPU core usage limit option is selected: The agent lowers the CPU priority of those processes and limits them to the specified number of logical processors on the machine.
When configuring CPU spike protection, keep the following in mind:
- Multiple instances of the same process do not have their CPU usage percentages added when determining CPU spike protection triggers. If a process instance never reaches this limit, CPU spike protection is not triggered. For example, in the case of a multi-session VDA with multiple concurrent sessions, there are multiple chrome.exe processes. Their CPU usage is not summed together when calculating the CPU usage.
Sampling time for CPU spike protection
Sample time limit. The length of time for which a process must exceed the CPU usage limit before CPU spike protection is enforced.
Priority lowering time for CPU spike protection
Idle priority time. The length of time for which the CPU priority of the process is lowered. After that time, the priority returns to one of the following:
The default level (Normal), if the process priority is not specified in the CPU priority tile and the Enable intelligent CPU optimization option is not selected. The specified level, if the process priority is specified in the CPU priority tile, regardless of whether the Enable intelligent CPU optimization option is selected. The calculated random level, depending on the behavior of the process. This case occurs if the process priority is not specified in the CPU priority tile and the Enable intelligent CPU optimization option is selected. The more frequent the process triggers CPU spike protection, the lower its CPU priority is.
Additional options
Enable CPU core usage limit. Use this option to limit processes that trigger CPU spike protection to a specific number of logical processors on the machine.
CPU priority
When enabled, lets you set CPU priority for processes manually.
These settings take effect if processes are competing for a resource. They let you optimize the CPU priority level of specific processes, so that processes that are contending for CPU processor time do not cause performance bottlenecks. When processes compete with each other, processes with lower priority are served after other process with a higher priority. They are therefore less likely to consume such a large share of the overall CPU consumption.
The process priority you set here establishes the “base priority” for all of the threads in the process. The actual, or “current,” priority of a thread might be higher (but is never lower than the base). When several processes are running on a computer, the processor time is shared between them based on their CPU priority level. The higher the CPU priority level of a process is, the more the processor time is assigned to it.
Note:
The overall CPU consumption does not necessarily decrease if you set lower CPU priority levels on specific processes. There might be other processes (with higher CPU priority) still affecting percentage CPU usage.
To add a process, click Add process. Specify the following information and then click Save process:
- Process name. The process executable name without the extension. For example, for Windows Explorer (explorer.exe) type “explorer”.
- Priority. The “base” priority of all threads in the process. The higher the priority level of a process is, the more the processor time it gets. Select from Idel, Below normal, Normal, Above normal, High, and Realtime.
Tip:
Process CPU priorities you set here take effect when the agent receives the new settings and the process is restarted.
To delete a process, click the ellipsis next to the process and select Delete.
To edit a process, click the ellipsis next to the process and select Edit.
CPU affinity
When enabled, lets you define how many “logical processors” a process uses. For example, you can restrict every instance of Notepad launched on the VDA to the number of cores defined.
To add a process, click Add process. Specify the following information and then click Save process:
- Process name. The process executable name (for example, notepad.exe).
- Affinity. Enter a positive integer.
To delete a process, click the ellipsis next to the process and select Delete.
To edit a process, click the ellipsis next to the process and select Edit.
CPU clamping
When enabled, lets you prevent processes from using more than a specified percentage of the CPU’s processing power. CPU clamping prevents processes using more than a specified percentage of the CPU’s processing power. WEM “throttles” (or “clamps”) that process when it reaches the specified CPU percentage you set. This lets you prevent processes from consuming large amounts of CPU.
Note:
- CPU clamping is a brute force approach that is computationally expensive. To keep the CPU usage of a troublesome process artificially low, it is better to use CPU spike protection, at the same time as assigning static CPU priorities and CPU affinities to such processes. CPU clamping is best reserved for controlling processes that are notoriously bad at resource management, but that cannot stand to be dropped in priority.
- After you apply a percentage of the CPU’s processing power for a process and configure a different percentage for the same process later, select Refresh agent host settings for the change to take effect.
The clamping percentage you configure is applied to the total power of any individual CPU in the server, not to any individual core it contains. (In other words, 10% on a quad-core CPU is 10% of the entire CPU, not 10% of one core).
To add a process, click Add process. Specify the following information and then click Save process:
- Process name. The process executable name (for example, notepad.exe).
- Percentage. Enter a positive integer.
Tip:
- When WEM is clamping a process, it adds the process to its watchlist the WEM client initializes. You can verify that a process is clamped by viewing this.
- You can also verify that CPU clamping is working by looking at process monitor and confirming that CPU consumption never rises above the clamping percentage.
To delete a process, click the ellipsis next to the process and select Delete.
To edit a process, click the ellipsis next to the process and select Edit.
Memory management
These settings let you optimize application memory usage through WEM.
If these settings are enabled, WEM calculates how much memory a process is using and the minimum amount of memory a process needs without losing stability. WEM considers the difference as excess memory. When the process becomes idle, WEM releases the excess memory that the process consumes to the page file, and optimizes the process for subsequent launches. Usually, an application becomes idle when it is minimized to the task bar.
When applications are restored from the task bar, they initially run in their optimized state but can continue to consume additional memory as needed.
Similarly, WEM optimizes all applications that users are using during their desktop sessions. If there are multiple processes over multiple user sessions, all memory that is freed up is available for other processes. This behavior increases user density by supporting a greater number of users on the same server.
Optimize memory usage for idle processes
When enabled, forces processes that remain idle for a specified time to release excess memory until they are no longer idle.
Idle sample time. Lets you specify the length of time that a process is considered idle after which it is forced to release excess memory. During the period of releasing excess memory, WEM calculates how much memory a process is using, and the minimum amount of memory a process needs, without losing stability. The default value is 120 minutes.
Idle state limit. Lets you specify the percentage of CPU usage below which a process is considered idle. The default is 1%. We recommend that you do not use a value greater than 5%. Otherwise, a process being actively used can be mistaken for idle, causing its memory to be released.
Restrict optimization. Lets you specify a threshold limit below which WEM optimizes memory usage for idle applications.
Exclude processes from memory usage optimization. Lets you exclude processes from memory usage optimization. Specify the process name, for example, notepad.exe.
WEM does not optimize application memory usage for the following system processes:
rdpshell
wfshell
rdpclip
wmiprvse
dllhost
audiodg
msdtc
mscorsvw
spoolsv
smss
winlogon
svchost
taskmgr
System Idle Process
System
LSASS
wininit
msiexec
services
csrss
MsMpEng
NisSrv
Memory Compression
Memory usage limit for specific processes
When enabled, lets you limit the memory usage of a process by setting an upper limit for the memory the process can consume.
Warning:
Applying memory usage limits to certain processes might have unintended effects, including slow system responsiveness.
To add a process, click Add process. Specify the following information and then click Save process.
- Process name. Enter the name of the process you want to add (for example, notepad.exe.)
- Memory limit. Enter the memory usage limit.
-
Limit type. Select a limit mode from the list.
- Dynamic Limit. Lets you apply a dynamic limit to the specified process. This setting dynamically limits the amount of memory allocated to the specified process. If applied, enforces memory usage limits depending on available memory. Therefore, the memory that the specified process consumes might exceed the specified amount.
- Static Limit. Lets you apply a static limit to the specified process. This setting always limits the amount of memory allocated to the specified process. If applied, restricts the process from consuming more than the specified amount of memory regardless of the amount of available memory. As a result, the memory that the specified process consumes is capped at the specified amount.
To delete a process, click the ellipsis next to the process and select Delete.
To edit a process, click the ellipsis next to the process and select Edit.
I/O management
These settings let you optimize the I/O priority of certain processes so that processes which are contending for disk and network I/O access do not cause performance bottlenecks. For example, you can use I/O Management settings to throttle back a disk-bandwidth-hungry application.
The process priority you set here establishes the “base priority” for all of the threads in the process. The actual, or “current,” priority of a thread might be higher (but is never lower than the base). In general, Windows give access to threads of higher priority before threads of lower priority.
Process I/O priority
When enabled, Lets you optimize the I/O priority of specific processes, so that processes that are contending for disk and network I/O access do not cause performance bottlenecks.
To add a process, click Add process. Specify the following information and then click Save process.
- Process name. Enter The process executable name without the extension. For example, for Windows Explorer (explorer.exe) type “explorer”.
- I/O Priority. Enter the “base” priority of all threads in the process. The higher the I/O priority of a process, the sooner its threads get I/O access. Choose from High, Normal, Low, Very Low.
Tip:
Process I/O priorities you set here take effect when the agent receives the new settings and the process is next restarted.
To delete a process, click the ellipsis next to the process and select Delete.
To edit a process, click the ellipsis next to the process and select Edit.
Fast logoff
These settings let you immediately ends the HDX connection to a remote session. Doing that gives users the impression that the session has immediately closed. However, the session itself continues through the session logoff phases in the background on the VDA.
Note:
Fast logoff supports Citrix virtual apps and RDS resources only.
When enabled, enables fast logoff for all users in this configuration set. Users are logged out immediately, while session logoff tasks continue in the background.
To exclude specific groups, perform the following steps:
-
Select Exclude specified groups and then Add group. The Add group to exclude wizard appears.
-
Select the identity type.
-
Select a domain where the group you want to add exists.
-
In the Search box, enter the name of the group you want to add. (Searches are not case-sensitive.)
-
Click the plus icon to add the group.
-
After you have finished, click Save to add the group and to exit the Add group to exclude wizard.
Citrix Optimizer
These settings let you optimize user environments for better performance. Citrix Optimizer runs a quick scan of user environments and then applies template-based optimization recommendations.
You can optimize user environments in two ways:
- Use built-in templates to perform optimizations. To do so, select a template applicable to the operating system.
- Alternatively, create your own customized templates with specific optimizations you want and then add the templates to Workspace Environment Management (WEM).
To get a template that you can customize, use either of the following approaches:
- Use the template builder feature that the standalone Citrix Optimizer offers. Download the standalone Citrix Optimizer at https://support.citrix.com/article/CTX224676. The template builder feature lets you build your own custom templates to be uploaded to WEM.
- On an agent host (machine where the WEM agent is installed), navigate to the
<C:\Program Files (x86)>\Citrix\Workspace Environment Management Agent\Citrix Optimizer\Templates
folder, select a default template file, and copy it to a convenient folder. Customize the template file to reflect your specifics and then upload the custom template to WEM.
When enabled, you can configure the following settings:
Run weekly. If selected, WEM runs optimizations on a weekly basis. If Run weekly is not selected, WEM behaves as follows:
- The first time you add a template to WEM, WEM runs the corresponding optimization. WEM runs the optimization only once unless you make changes to that template later. Changes include applying a different template to OS and enabling or disabling the template.
- Each time you make changes to a template, WEM runs the optimization once.
To add a custom template:
-
Click Add custom template.
-
In the Add custom template wizard, complete the following steps:
- For Template name, click Browse and then select the template you want to add.
-
For Applicable operating system, select from the list one or more operating systems to which the template applies.
Tip:
You can add Windows 10 operating systems that are not available on the list but that the template applies to. Add those OSs by typing their build numbers. Be sure to separate the OSs with semicolons (;). For example, 2001;2004.
- Select groups you want to activate as needed.
- Click Save.
Important:
Citrix optimizer does not support exporting custom templates. Retain a local copy of your custom template after you add it.
You can use the toggle in the State column to toggle the template between enabled and disabled states. If disabled, the agent does not process the template, and WEM does not run optimizations associated with the template.
To delete a template, select the ellipsis of the applicable template and then select Delete. Note: You cannot delete built-in templates.
To edit a template, select the ellipsis of the applicable template and then select Edit.
To view details of a template, select the ellipsis of the applicable template and then select Preview.
Note:
For a non-persistent VDI environment, WEM follows the same behavior – all changes to the environment are lost when the machine restarts. In the case of Citrix Optimizer, WEM runs optimizations each time the machine restarts.
Automatically select template to use. If you are unsure which template to use, use this option to let WEM select the best match for each OS. If you want to use custom templates as the preferred templates, enter a comma-separated list of prefixes. Custom template follows this name format:
- prefix_<os version>_<os build>
- prefix_Server_<os version>_<os build>
Changes to Citrix Optimizer settings take some time to take effect, depending on the value that you specified for the SQL Settings Refresh Delay option on the Advanced Settings > Configuration > Service Options tab of the legacy console.
For the changes to take effect immediately, navigate to Monitoring > Administration > Agents, locate the agent, and then select Process Citrix Optimizer from the More menu.
Tip:
New changes might fail to take effect immediately. We recommend that you select Refresh agent host settings before you select Process Citrix Optimizer.
Multi-session optimization
These settings let you optimize multi-session OS machines with disconnected sessions for better user experience with connected sessions.
Multi-session OS machines run multiple sessions from a single machine to deliver applications and desktops to users. A disconnected session remains active and its applications continue to run. The disconnected session can consume resources needed for connected desktops and applications that run on the same machine. These settings let you optimize multi-session OS machines with disconnected sessions for better user experience with connected sessions.
When enabled, optimizes multi-session OS machines where disconnected sessions are present. By default, multi-session optimization is disabled. The feature improves the user experience of connected sessions by limiting the number of resources disconnected sessions can consume. After a session stays disconnected for one minute, the WEM agent lowers the CPU and the I/O priorities of processes or applications associated with the session. The agent then imposes limits on the amount of memory resources the session can consume. If the user reconnects to the session, WEM restores the priorities and removes the limitations.
Exclude groups
To exclude specific groups from multi-session optimization, perform the following steps:
-
Select Exclude specified groups and then click Add group. The Add group to exclude wizard appears.
-
Select the identity type.
-
Select a domain where the group you want to add exist.
-
In the Search box, enter the name of the group you want to add. Enter the full name of the group. (Searches are not case-sensitive.)
-
Click the plus icon to add the group.
-
After you have finished, click Save to add the group and to exit the Add group to exclude wizard.
Exclude processes
To exclude specific processes from multi-session optimization, click Add process, browse to the process you want to add, and then click Save process.
To delete a process, click the ellipsis next to the process and select Delete.
To edit a process, click the ellipsis next to the process and select Edit.