by Christopher Schrameyer, CTA
I love the ability with Citrix Workspace Environment Manager to be able to set limits on CPU usage for applications. However, WEM does not provide any built-in logs to determine when a CPU Spikes Protection action is taken. It would be nice to know what processes are often limited, so we can then add them to a CPU Clamping policy or identify why they are using so much CPU.
CPU SPIKES PROTECTION
WEM allows us to set limits on how much CPU a process can use, and when it hits that threshold, WEM will automatically lower the priority of the process. Notice that using “Enable CPU Spikes Protection” does not throttle a process, it simply lowers the priority of the process. The idea being that if a new application is launched, it will have a higher priority than the lower-priority process and the system will continue to run smoothly.

CPU CLAMPING
However, what about processes that often consume large amounts of CPU and you want to throttle them? WEM gives us an option called CPU Clamping. This is what I think of when I think of throttling a process. Here, you can set a limit for a process. WEM will throttle, or clamp, that process once it reaches the specified CPU % you set. This is a great way to prevent processes from consuming large amounts of CPU.

So now that we have CPU spike protection and clamping enabled, how do we know if it is working? How do we know when a process is throttled or if there is a process that is regularly getting its priority lowered?
WEM does not have any built-in reporting for this. However, you can easily identify when WEM manages the CPU of a process by looking at the Event Viewer. If you have a consolidated event logging tool, you can view all servers at once. I use ControlUp, which logs Event Viewer entries. By using this, I can see all events across my environment in one place.
Event Viewer
The Event Log location is Norskale Agent Service, which is under Application and Services Logs

CPU SPIKES PROTECTION
To see when a process priority is lowered (CPU Spikes protection), look for “Initializing process limitation thread for process:”
WEM will log a warning log each time it lowers a priority of a process.

CPU Clamping
For CPU Clamping, WEM does not log anything to the Event Viewer when it clamps a process. However, it does log when it adds a process to its’ watchlist. This happens when the WEM client initializes. You can verify that a process is clamped by viewing this.

You can also verify it is working by looking at process monitor. In my example, this process is clamped at 10% CPU. So, no matter how much CPU the process wants, WEM will limit it to 10%. This is extremely useful for applications that consistently consume large amounts of CPU.

Hope this helps in understanding how CPU Spike protection and clamping work, and how to verify that the WEM settings are indeed working as designed.