Interview Prep/Linux/Load, CPU and I/O performance

A server is slow and `vmstat` shows a high `cs` (context switches) value, 500k per second.

AdvancedTroubleshootingLoad, CPU and I/O performance
Answer

Likely causes → Too many threads competing for CPUs, lock contention, or very chatty IPC/network patterns.

Diagnose →

vmstat 1 5
pidstat -w 1 5                    # cswch/s (voluntary) and nvcswch/s (involuntary) per process
ps -eLf | wc -l                   # total threads

Fix → High involuntary switches: too many runnable threads; reduce thread pools to near core count. High voluntary: threads blocking on locks or I/O; investigate contention.

Prevent → Size thread pools deliberately; load test.

All Linux questions Roadmap: Linux

More on Load, CPU and I/O performance