SUSE Support

Here When You Need Us

High Context Switch Troubleshooting

This document (7002720) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 15
SUSE Linux Enterprise Server 12
SUSE Linux Enterprise Server 11
SUSE Linux Enterprise Server 10

Situation

You have observed a high number of context switches and some applications may not be performing as expected. A context switch is the switching of the CPU from one process or thread to another. The context switches are reported in the system "cs" column.

#==[ Command ]======================================#
# /usr/bin/vmstat 1 4                                         vvvvv
procs -----------memory----------  ---swap-- -----io----  -system-- -----cpu------
 r  b   swpd   free   buff  cache   si    so    bi    bo   in    cs us sy id wa st
 1  1 373704   7156   1296   4144   47    78   139    92 2450 25574  9 27 64  0  0
24 16 376664   6924   1360   3152  532  3104   552  3356 8101 73269  3 97  0  0  0
15 15 386388   6788   1356   5260 5872 10212  8656 10284 7623 79149  2 96  0  1  0
10 10 389896   6720   1232   3244 2384  3584  2532  3640 8893 67113 11 89  0  0  0
                                                              ^^^^^

When context switches exceed 60,000, you should account for the cause.

Resolution

A high number of context switches may just mean you have a lot of running busy processes and few idle ones. If your server is just busy and performance is an issue, consider distributing the processes among more servers. If the context switches are really high, then you might consider isolating the application causing the context switches. It may be an indication of an application bug. Use the ps command to view the running processes and unloaded and load applications one at a time to narrow down which may be causing the high number of context switches.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7002720
  • Creation Date: 20-Feb-2009
  • Modified Date:27-Aug-2021
    • SUSE Linux Enterprise Desktop
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.