Friday, 16 January 2015

CPU Bottlnenecks Insights - How to find & resolve


Processor bottlenecks normally occur when the processor is so busy that it cannot respond to requests very immediately. Let’s see more about it in this blog.

Symptoms of CPU bottlenecks

You can recognize a developing bottleneck by the following conditions:
  • High Processor activity 
    • Processor\% Processor Time – Value of this counter consistently showing 80 percent for a smaller workload.
  • High Queue length
    • Queue length is a measure of number of requests waiting for the processor. Higher the value, higher the pending tasks with the processor. A combination of high processor utilization and a lengthy processor queue may be an indication that the processor is overloaded
  • High rate of context switches
    • In the world of multi-tasking, Context switching becomes inevitable. It is a procedure that a CPU follows to change from one task to other by ensuring that tasks don’t conflict. Context switching is a CPU intensive program, since certain procedure is followed by CPU to resort the state of its current task and switching to next pending task. 

 Performance Counters

1.    For the Processor(_Total) performance object, you can add the following counters
Processor(_Total)\% Processor Time: The percentage of time that the processors spend on executing active threads. Simply put, it is the percentage of time that the processors are busy. The recommended average value should always be below 80%.

Processor(_Total)\% Privileged Time: Note that there are two modes for all activities inside a Windows Operating System: user mode and kernel mode. Kernel mode is also known as privileged mode. All system activities are classified as kernel mode (privileged mode). Disk access or activity is a privileged mode. The recommended average value should always be below 15%.

Processor: %User Time:  percentage of time the processor is spending executing user processes.

2.    For the System object, the below counters could be useful:
System\Processor Queue Length: Note that regardless of the number processors, there will always be only one processor queue. This counter measures the number of threads in the processor queue. The recommended average value should not be greater than 2 per processor

System\Context Switches/sec: This counter measures the rate in which the processors are switched from one thread to another. The recommended average value should always not be greater than 15,000.

Tips for fixing CPU bottlenecks
  • Ensure hyper threading is enabled in the processors
  • Reduce the amount of OS tasks and
  • Distribute the batch jobs /non-critical tasks in non-peak timing.
  • If user mode utilization is high, it may be your server running too many specific roles which you may consider
    • Scaling up the hardware (adding more or better processors)
    • Reduce the number of user applications.
    • Horizontal scaling of the server architecture by adding additional servers.

No comments:

Post a Comment