1830820 Members
2867 Online
110016 Solutions
New Discussion

sar ( pswch/s )

 
SOLVED
Go to solution
Jerry_109
Super Advisor

sar ( pswch/s )

HP-UX B.11.11 U 9000/800/rp3440

Hello All,

Just trying to find an explaination that I can understand clearly related to SAR's "pswch/s"
reference. I received a call from the users
indicating around 13:30 system was slow for a period of time. When I executed SAR to help gather information I noticed the "pswch/s" was
higher at that perion of time. The man page explaination is not clear to me. Can someone help me understand what could cause this, and
is there a kernel parm that needs to be changed?

******************************************
( sar -w ) : SYSTEM SWAPPING & SWITCHING ACTIVITY

Analysis :

swpin/s Number of process swapins per second;

swpot/s Number of process swapouts per second;

bswin/s Number of 512-byte units transferred for
swapins per second;

bswot/s Number of 512-byte units transferred for
swapouts per second;

pswch/s Number of process context switches per second.

HP-UX hohp118 B.11.11 U 9000/800 03/22/05

11:00:00 swpin/s bswin/s swpot/s bswot/s pswch/s
11:20:00 0.00 0.0 0.00 0.0 762
11:40:00 0.00 0.0 0.00 0.0 749
12:00:00 0.00 0.0 0.00 0.0 761
12:20:00 0.00 0.0 0.00 0.0 732
12:40:00 0.00 0.0 0.00 0.0 729
13:00:00 0.00 0.0 0.00 0.0 733
13:20:00 0.00 0.0 0.00 0.0 787
13:40:00 0.00 0.0 0.00 0.0 4214
14:00:00 0.00 0.0 0.00 0.0 781
14:20:00 0.00 0.0 0.00 0.0 791
14:40:00 0.00 0.0 0.00 0.0 773
15:00:00 0.00 0.0 0.00 0.0 782
15:20:00 0.00 0.0 0.00 0.0 758
15:40:00 0.00 0.0 0.00 0.0 738
16:00:00 0.00 0.0 0.00 0.0 765

Average 0.00 0.0 0.00 0.0 990
********************************************
5 REPLIES 5
Paul_481
Respected Contributor
Solution

Re: sar ( pswch/s )

Hi,

If I am not mistaken, process in unix have different state or context, these are sleep,wait,run. Changing from one state to another is context switching.

Regards,
Paul
A. Clay Stephenson
Acclaimed Contributor

Re: sar ( pswch/s )

One of the kernel tunables that is often mistakenly set is timeslice. If set to 1 (rather than a value very near 10 - the default) then as the machine begins to load it does context switching any very little useful work. Check that value. There are not enough data to know if you have a problem. You need to gather data over a longer period of time and also know what activity is actually occurring during these busy times.
If it ain't broke, I can fix that.
Jerry_109
Super Advisor

Re: sar ( pswch/s )

I had a question regarding the switching activity. Does the average (775) and the increase (4214) mean the number of processes running at a particular time or could it be even 1 processes switching 775 times on average and in this instant, it switched 4214 times?
A. Clay Stephenson
Acclaimed Contributor

Re: sar ( pswch/s )

It probably means that a large number of processes were running during the sample interval BUT high context switch rates can be induced in a very small number of processes.

For example, one could create two processes and pass a token back (typically a single byte sent via a pipe) and forth between them. Process A would block on reading the token. Process B writes the token and blocks waiting for it to be returned. Processes A and B could then trigger very high context switch rates each blocking while the other performs its task.

Again, there are not enough data to answer your question. Sar is a pretty poor performance analysis tool but its better than a sharp stick. You will get much more meaningful data with a tool like Glance. You can install the 60-day trial version from any Applications CD set.
If it ain't broke, I can fix that.
Jerry_109
Super Advisor

Re: sar ( pswch/s )

# kmtune | grep -i slice
timeslice 10 - (100/10)