Context Switches at OS

Reports the number of voluntary and involuntary context switches Adaptive Server threads perform at the operating system level. sp_sysmon prints this section only if there are reported context switches, and only if the operating system supports collecting the data.

Note“Page Faults at OS” does not appear for Windows, Red Hat 5, or SLES 11.

Adaptive Server may perform “Voluntary” context switches for a number of reasons, for example an I/O poll or an engine sleep. The number of context switches depends on the workload. “Non-Voluntary” context switches occur when the operating system removes an Adaptive Server thread from the CPU without the thread requesting the removal (for example, when the operating system preempts the thread). “Non-Voluntary” context switches may indicate that the host is low on CPU resources, and that Adaptive Server performance is likely to be severely impacted. You should expect a low number of nonvoluntary context switches, which does not represent a problem.

This is sample output from a system that is not overconfigured. The number of “Non-Voluntary” context switches is very low:

Context Switches at OS          per sec      per xact      count   % of total
 -------------------------  -----------  ------------  ---------   ----------
  Voluntary                       278.7         278.7       2787        99.7 %
  Non-Voluntary                     0.9           0.9          9         0.3 %
 -------------------------  -----------  ------------  ---------   ----------
Total Context Switches            279.6         279.6       2796       100.0 %

This is sample output from an overloaded machine with a very high level of “Non-Voluntary” context switching:

Context Switches at OS          per sec      per xact      count   % of total
 -------------------------  -----------  ------------  ---------   ----------
  Voluntary                      2683.7       16370.4     163704       18.4 %
  Non-Voluntary                 11893.0       72547.4     725474       81.6 %
 -------------------------  -----------  ------------  ---------   ----------
Total Context Switches          14576.7       88917.8     889178      100.0 %

To improve this situation, decrease the number of engines, remove non-Adaptive Server workload from the host, add additional CPUs, or migrate to a host that has additional processing power.