public inbox for gentoo-server@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-server] vmstat cs and in
@ 2006-10-14  2:24 Richard Broersma Jr
  2006-10-14 10:19 ` Jeroen Geilman
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Broersma Jr @ 2006-10-14  2:24 UTC (permalink / raw
  To: Gentoo Server-List

according to man vmstat:

   System
       in: The number of interrupts per second, including the clock.
       cs: The number of context switches per second.

1) Does anyone have a "layman's" explaination of what interrupts and context switches are?

2) How high can these numbers be before a system admin should start to worry about preformance?

3) what are the options to reduce these number?


Thanks for any information.

Regards,

Richard Broersma Jr.
-- 
gentoo-server@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-server] vmstat cs and in
  2006-10-14  2:24 [gentoo-server] vmstat cs and in Richard Broersma Jr
@ 2006-10-14 10:19 ` Jeroen Geilman
  2006-10-14 17:25   ` Richard Broersma Jr
  2006-11-22 15:49   ` Matthias Bethke
  0 siblings, 2 replies; 4+ messages in thread
From: Jeroen Geilman @ 2006-10-14 10:19 UTC (permalink / raw
  To: gentoo-server

Richard Broersma Jr wrote:
> according to man vmstat:
>
>    System
>        in: The number of interrupts per second, including the clock.
>        cs: The number of context switches per second.
>
> 1) Does anyone have a "layman's" explaination of what interrupts and context switches are?
>   
Interrupts are just that - signals that interrupt the CPU in whatever it 
is doing and command it to do something else that needs to be done right 
away.
There are two varieties: hardware and software.
The hardware type is invoked by an actual hardware signal on the CPU - 
the system timer is one of these, but so is the keyboard :)
The software interrupts can be programmed by anyone, and are often used 
as a handy shortcut to run a common task without a lot of overhead.

A context switch is the CPU switching from one execution context to 
another; task switches are context switches, but so are kernel system 
calls from userspace programs.
Since the kernel runs in a different execution environment than all the 
other processes, every switch from one to the other needs to save and 
later restore the context of that process - stack space, registers, 
flags, etc.

So the two are sort of related: every interrupt that causes a kernel 
function to be called (like the process scheduler), also causes a 
context switch when it suspends it current task and resumes the next task.

> 2) How high can these numbers be before a system admin should start to worry about preformance?
>   
Erm... they don't have much to do with performance, they just happen; if 
they didn't, you wouldn't have a working system...
Just FYI: the 2.6 kernel uses a 1000Hz timer for the process scheduler, 
so expect to see at least 1000 interrupts per second no matter what else 
your system is doing.
If the number drops much *lower* than this, you might have a performance 
problem: the CPU can't keep up with your tasks.
Same goes for context switches: the busier it is, the more switches will 
have to take place, except this need not happen on every interrupt - 
only when a task actually needs to be executed.
> 3) what are the options to reduce these number?
>   
Stop using your computer.
Seriously :)

If you really want to know what is going on , I suggest you start using 
_dstat_ instead of vmstat - it offers more information and will also 
help to correlate between the different numbers, e.g. an increase in 
disk or network activity will also show an increase in interrupts, and a 
maxed-out disk subsystem will show up as a higher system CPU percentage 
than normal.

But apart from the pretty nifty info you can get from dstat, don't worry 
about the values; it's just not that important.
The disk and cpu usage are much more informative in that respect.

J

-- 
gentoo-server@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-server] vmstat cs and in
  2006-10-14 10:19 ` Jeroen Geilman
@ 2006-10-14 17:25   ` Richard Broersma Jr
  2006-11-22 15:49   ` Matthias Bethke
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Broersma Jr @ 2006-10-14 17:25 UTC (permalink / raw
  To: gentoo-server

> > according to man vmstat:
> >
> >    System
> >        in: The number of interrupts per second, including the clock.
> >        cs: The number of context switches per second.
> >
> > 1) Does anyone have a "layman's" explaination of what interrupts and context switches are?
> >   
> Interrupts are just that - signals that interrupt the CPU in whatever it 
> is doing and command it to do something else that needs to be done right 
> away.
> There are two varieties: hardware and software.
> The hardware type is invoked by an actual hardware signal on the CPU - 
> the system timer is one of these, but so is the keyboard :)
> The software interrupts can be programmed by anyone, and are often used 
> as a handy shortcut to run a common task without a lot of overhead.
> 
> A context switch is the CPU switching from one execution context to 
> another; task switches are context switches, but so are kernel system 
> calls from userspace programs.
> Since the kernel runs in a different execution environment than all the 
> other processes, every switch from one to the other needs to save and 
> later restore the context of that process - stack space, registers, 
> flags, etc.
> 
> So the two are sort of related: every interrupt that causes a kernel 
> function to be called (like the process scheduler), also causes a 
> context switch when it suspends it current task and resumes the next task.
> 
> > 2) How high can these numbers be before a system admin should start to worry about
> preformance?
> >   
> Erm... they don't have much to do with performance, they just happen; if 
> they didn't, you wouldn't have a working system...
> Just FYI: the 2.6 kernel uses a 1000Hz timer for the process scheduler, 
> so expect to see at least 1000 interrupts per second no matter what else 
> your system is doing.
> If the number drops much *lower* than this, you might have a performance 
> problem: the CPU can't keep up with your tasks.
> Same goes for context switches: the busier it is, the more switches will 
> have to take place, except this need not happen on every interrupt - 
> only when a task actually needs to be executed.
> > 3) what are the options to reduce these number?
> >   
> Stop using your computer.
> Seriously :)
> 
> If you really want to know what is going on , I suggest you start using 
> _dstat_ instead of vmstat - it offers more information and will also 
> help to correlate between the different numbers, e.g. an increase in 
> disk or network activity will also show an increase in interrupts, and a 
> maxed-out disk subsystem will show up as a higher system CPU percentage 
> than normal.
> 
> But apart from the pretty nifty info you can get from dstat, don't worry 
> about the values; it's just not that important.
> The disk and cpu usage are much more informative in that respect.

Thanks!
-- 
gentoo-server@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-server] vmstat cs and in
  2006-10-14 10:19 ` Jeroen Geilman
  2006-10-14 17:25   ` Richard Broersma Jr
@ 2006-11-22 15:49   ` Matthias Bethke
  1 sibling, 0 replies; 4+ messages in thread
From: Matthias Bethke @ 2006-11-22 15:49 UTC (permalink / raw
  To: gentoo-server

[-- Attachment #1: Type: text/plain, Size: 1254 bytes --]

Hi Jeroen,
on Saturday, 2006-10-14 at 12:19:59, you wrote:
> >2) How high can these numbers be before a system admin should start
> >to worry about preformance?
> >  
> Erm... they don't have much to do with performance, they just happen;
> if they didn't, you wouldn't have a working system... Just FYI: the
> 2.6 kernel uses a 1000Hz timer for the process scheduler, so expect to
> see at least 1000 interrupts per second no matter what else your
> system is doing.

Butting in quite late, but...
Remember that conversation we had in April?
(http://article.gmane.org/gmane.linux.gentoo.server/3907)
I was having terrible performance problems on my SMP box and solved them
by recompiling the kernel with 100 Hz ticks. 250 or 1000 Hz are fine if
you need low latency at the cost of throughput, like for audio
applications (250 even for general single-CPU desktops) but in some
configurations they can be deadly.
So there's no reason to be overly concerned with interrupts and context
switches if you're not having any performance problems but it can be worth
looking into if you do.

cheers!
	Matthias
-- 
I prefer encrypted and signed messages. KeyID: FAC37665
Fingerprint: 8C16 3F0A A6FC DF0D 19B0  8DEF 48D9 1700 FAC3 7665

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-11-22 17:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-14  2:24 [gentoo-server] vmstat cs and in Richard Broersma Jr
2006-10-14 10:19 ` Jeroen Geilman
2006-10-14 17:25   ` Richard Broersma Jr
2006-11-22 15:49   ` Matthias Bethke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox