elastic/support-diagnostics

Add vmstat to check context switches

tailorzed opened this issue · 3 comments

Could you please add vmstat -t to see the amount of context switches (with a timestamp)?

@tailorzed Can you please add more detail to this ticket so it can be properly prioritized

@cactusinthenorth: Sure, here we go:

Modern systems utilize multitasking which means that multiple processes/threads can share the same physical CPU (core). In order to implement this execution time on CPU is shared and limited to a certain time slot and when that ends, the state of the thread/process has to be saved to be resumed when the next available timeslot comes. The switching between processes/threads is called context switching. The downside of this technique is that if the system is running too many processes/threads, it takes a lot of resources to execute the context switching (also the timeslots are getting slimmer and slimmer). To determine if there is a lot of concurrent processes (meaning a lot of context switching) in the system, the vmstat command has an output field cs containing this number.

Example output:

# vmstat -t
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- -----timestamp-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st                 UTC
 1  0      0 21463564  35732 744408    0    0   501   452  295  452  1  2 97  0  0 2022-09-13 12:48:55

Manual page for vmstat: link

I hope this helps to support my request to add this printout.

@cory-fair is this for you?