1824858 Members
3829 Online
109674 Solutions
New Discussion юеВ

Context Switch Rate?

 
Jose Vidal
Advisor

Context Switch Rate?

Anyone know how to determine if the switch rate is too high?

Is there a formula to determine what is an acceptable context switch rate?
4 REPLIES 4
A. Clay Stephenson
Acclaimed Contributor

Re: Context Switch Rate?

Hi:

I don't know of a formula but I know it when I see it. Some boxes perform very well with process switch rates in the thousands/sec other are dogs at far less. It depends upon whether you are running large batch jobs or many, many interactive processes. If you are concerned that this might be a problem the very first thing to check is whether someone used one of the dumb tuned parameter sets that incorrectly sets timeslice to 1 rather than 10.

A very good tuning guide can be found at:
http://docs.hp.com//hpux/onlinedocs/os/11.0/tuningwp.html#kernparmrec
If it ain't broke, I can fix that.
Jose Vidal
Advisor

Re: Context Switch Rate?

Hi, A. Clay and thanks for your response.

We have a N4000 with 6 cpus and 8GB of memory, and most of the heavy processing is batch with an OracleDB, with some interactive.

Our context switch rate varies between between a normal of just over 3K, to a high of 34K.
The equivalent Cswitch cpu% is .03% to 4.3%.

My main concern is, is a high 4.3% Cswitch cpu% normal?

Thanks.
J.Vidal
A. Clay Stephenson
Acclaimed Contributor

Re: Context Switch Rate?

In that case then yes this may be high. A timeslice set to 1 would do just this.
If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: Context Switch Rate?

Well, context switching is very desirable because it allows multiple programs to seem like they are running at the same time, but really timeslicing. The only concern is with the kernel parameter: timeslice, it must be 10 and not 1. When set to 1 (a mistake in SAM's database template for kernel params), then the kernel will context excessively fast and all programs will suffer in performance. System overhead will also be quite high.

Otherwise, high context switching can be caused by programs that perform polling or other fast I/O, low compute time operations. Whether this is by design or not is an exercise for the original programmers to decicde.


Bill Hassell, sysadmin