Interview Prep/Linux/Performance & the USE Method

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.

All Linux questions Roadmap: Linux

More on Performance & the USE Method