23. January 2007 08:15
I was investigating a spike in the number of context switches/second that was observed during some performance testing of an ASP.NET web application. During my investigation around this topic I found a number of entries from Microsoft on MSDN and Tech-Net that essentially said the same thing - “if you see a high number for this counter you should investigate further”. So what is “high” exactly? “ASP.NET Performance Monitoring, and When to Alert Administrators” (a useful source of performance counter information) does slightly better:
Context Switches/sec. The rate at which the processors switch thread contexts. A high number may indicate high lock contention or transitions between user and kernel mode. Context Switches/sec should increase linearly with throughput, load, and the number of CPUs. If it increases exponentially, there is a problem. A profiler should be used for further investigation.
But it still falls into the same trap of telling us to look for a “high” value. If you're writing documentation like this try to provide some more information about what constitutes a “high” number (probably hard in this case since it will be machine dependent) or how a “high” number could be determined.