What causes high %sy (system CPU) and how do you investigate?
AdvancedProductionPerformance & the USE Method
Answer
The kernel is doing a lot of work: very high syscall rates (tiny reads/writes, polling), context switching, page faults and memory compaction, network packet processing, or lock contention in the kernel.
sudo perf top # look for kernel symbols
strace -c -f -p <pid> # syscall counts
vmstat 1 # cs and in columns
sar -B 1 # paging and faults
Common fixes: larger I/O buffers, batching, epoll instead of busy polling, disabling THP defrag.
More on Performance & the USE Method
What is the USE method?BeginnerMap the USE method to concrete Linux commands.IntermediateWhat is your "first 60 seconds" checklist on a slow server?IntermediateHow do you read vmstat output?IntermediateHow do you read `iostat -xz 1`?IntermediateWhat is sar and why install sysstat on every server?Beginner