CPU scheduling and memory optimizations solutions compared Part 1 of 2 CPU
For a while now customers and colleagues are asking me which tool to use when it comes to CPU scheduling and memory optimization. We use several management products and end up with more than one product utilizing these tasks. Choice is good but do we just enable them all and if not what’s the best way to configure this?
When you look a little bit deeper then plain and simple marketing you’ll notice that the way the different products handle CPU scheduling is totally different and combining some of them will degrade system performance or simply don’t work for example Citrix CPU management does not start when Microsoft DFSS is enabled.
Before we start I’d like to thank Andrew Morgan for allowing me to re-use some information from his ThreadLocker topic.
To start off I will first try to explain how each product works and will then summarize and see if we can work through them and work to a proper advice.
Microsoft Windows 2008 R2 Dynamic Fair Share Scheduling (DFSS)
Fair Share CPU Scheduling is included in RDS since Windows Server 2008 R2. Fair Share CPU Scheduling dynamically distributes processor time across sessions based on the number of active sessions and load on those sessions by using the kernel-level scheduling mechanism included with Windows Server 2008 R2. On an RDS server, one user will not affect the performance of another user’s session, even if the RD Session Host server is under a high load. Enabled by default so no configuration needed.
DFSS works based on a filter driver which means that it will react instantly when a process is launched. Remember this when we get to the conclusion.
The downside of using DFSS is that each and every user is bound to the same default policy, so if you want certain users to be able to utilize more resources you can’t by default. To do this you need Windows System Resource Manager (Depreciated in Windows Server 2012) to be able to create profiles and attach those to AD groups. Although this is a free product and does the basic trick of configuring DFSS policies based on user groups it’s a lot of work to configure this on more than one system and requires Windows Internal Database.
Citrix CPU Utilization Management Only available with Citrix XenApp Enterprise and Platinum The Dynamic Fair Share Scheduling (DFSS) solution is incompatible with CPU utilization management.
The CPU utilization management feature can be used to improve the ability of a farm to manage resources and normalize CPU peaks when the farm’s performance becomes limited by CPU-intensive operations. When you enable CPU utilization management, the server manages the share of the CPU allocated to each user. By default, this is an equal share. This prevents one user from impacting the productivity of other users and allows more users to connect to a server. This feature allows you to control the share.
Fair sharing of CPU between sessions to allocate an equal share of the CPU to each user. Preferential Load Balancing to allocate shares based on importance levels.
Citrix acts based on process spikes and process priority so although this might work well is means that it will start acting after a certain period of CPU usage. Remember this when we get to the conclusion.
The CPU utilization management feature ensures that CPU resources are equitably shared among users by having the server allocate an equal share of the CPU to each user.
RES CPU Management
CPU Optimization actively lowers the priority of processes with a sustained high CPU usage. This keeps the process running, but with a low priority so that other applications in the system are not affected anymore. When the process returns to a more acceptable level of CPU usage, its priority is changed back to the original level.
The configured thresholds are based on a single CPU/Core/vCPU this means that when the threshold is set to 90% on a dual CPU system the process will be noticed when it uses more than 45% of total CPU.
Although this does some kind of a trick it’s always reactive and you will still see issues caused by CPU spikes because it will only act after a configured time of usage.
ThreadLocker by Andy Morgan
ThreadLocker adds a pro-active layer on top of the re-active solutions of the forementioned products. It allows us to change the priority and affinity of processes known to cause issues. Because we configure this before something happens the process will start with a lower priority and/or changed CPU affinity making sure these processes will never cause issues.
This product does not replace or compete with any of the other products which will monitor all processes and when issues occur act accordingly.
Unfortunately there is no one answer to question “What should I use?” all of the products work in a different way and most likely will give different results in different situations depending on the type of process and the type of load it generates. For this conclusion I assume you are licensed to use all CPU features within all products.
The first choice to make is between the Citrix and Microsoft solution as they don’t play well together. Looking at both solutions a big difference I see is manageability of different load profiles which is implemented better at Citrix. If you don’t need it use Microsoft DFSS and if you do use the Citrix solution. You might think that you are on the good side if you just go with Citrix each and every time, remember what I said about DFSS being filter driver based? In the end this will give you the best results so if you don’t need management, use DFSS.
If we go ahead and take a look at RES CPU Management, would I use it INSTEAD of DFSS or Citrix CPU Management? No, the RES solution focusses on a single process, instead of a session, using more than a configured amount of CPU time and changes the priority for that process. This happens even when there are more than enough resources left.
So when do we use RES CPU Management or ThreadLocker? The difference between these products is that RES reacts to a process utilizing more than a configured amount of CPU while ThreadLocker acts instantly when the process is launched. ThreadLocker needs the process to be configured while RES would just monitor all of the processes (except exclusions).
What about VDI
Do we need process monitoring on a VDI desktop? My first response would be “No of course not we don’t share anything”. When you think a bit more about this (Thanks Andy) that’s not entirely true because we are sharing the hypervisor, the better we handle resources the more sessions I get on a hypervisor machine. Do you need it? It depends on applications and use case but if you do read a bit moreJ.
The question which product to use is easier for VDI because Microsoft DFSS and Citrix CPU Management is not available on VDI so we are back to RES CPU Management vs ThreadLockerJ.
There are known cases of applications that really hate it when we try to change CPU priority Sources
http://microsoftplatform.blogspot.nl/2011/01/dfss-fair-sharing-your-rds-2008-r2.html http://support.citrix.com/proddocs/topic/xenapp6-w2k8-admin/ps-cpu-utilization-features-v3.html http://support.ressoftware.com http://andrewmorgan.ie/2012/05/15/introducing-threadlocker-a-community-tool-for-granular-control-of-processes/