pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
very high CPU usage in "top", but not in "mpstat"
3+ messages / 3 participants
[nested] [flat]

* very high CPU usage in "top", but not in "mpstat"
@ 2004-05-04 23:34 Cyrille Bonnet <cyrille@3months.com>
  2004-05-05 13:03 ` Re: very high CPU usage in "top", but not in "mpstat" Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Cyrille Bonnet @ 2004-05-04 23:34 UTC (permalink / raw)
  To: pgsql-performance

Hello all,

 

We are using Postgres 7.3 with JBoss 3.2.3 on a Linux Fedora 1.0 box.

 

When I am looking at CPU activity with "top", I often see something like:

 

  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND

14154 postgres  25   0  3592 3592  2924        R    99.1      0.3
93:53   0 postmaster

 

At the same time, "mpstat" gives me something like:

 

11:27:21 AM  CPU   %user   %nice %system   %idle    intr/s

11:27:21 AM  all       2.99      0.00   18.94         78.08    105.94

 

The system is not visibly slow and response time is satisfactory. Sometimes,
the CPU usage drops to 1 or 2%, but not for long usually. Also I have
checked the number of open connections to Postgres and there are only 5
(maximum is set to the default: 32).

 

Should I be worried that Postgres is eating up 99% of my CPU??? Or is this
*expected* behaviour?

 

Please note that I am a developer, not a system administrator, so maybe I
misunderstand the usage of "top" here.

 

Any help will be appreciated.

 

Cyrille.

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

* Re: very high CPU usage in "top", but not in "mpstat"
  2004-05-04 23:34 very high CPU usage in "top", but not in "mpstat" Cyrille Bonnet <cyrille@3months.com>
@ 2004-05-05 13:03 ` Tom Lane <tgl@sss.pgh.pa.us>
  2004-05-05 18:13   ` Re: very high CPU usage in "top", but not in "mpstat" Paul Tuckfield <paul@tuckfield.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2004-05-05 13:03 UTC (permalink / raw)
  To: Cyrille Bonnet <cyrille@3months.com>; +Cc: pgsql-performance

"Cyrille Bonnet" <cyrille@3months.com> writes:
> Should I be worried that Postgres is eating up 99% of my CPU??? Or is this
> *expected* behaviour?

It's not expected, unless you are running some very long-running query.

The conflict between what top says and what mpstat says is strange; I
wonder if you might have a buggy version of one of them?  You should
probably check some other tools (try "vmstat 1" for instance) to see if
you can get a consensus on whether the CPU is maxed out or not ...

			regards, tom lane



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

* Re: very high CPU usage in "top", but not in "mpstat"
  2004-05-04 23:34 very high CPU usage in "top", but not in "mpstat" Cyrille Bonnet <cyrille@3months.com>
  2004-05-05 13:03 ` Re: very high CPU usage in "top", but not in "mpstat" Tom Lane <tgl@sss.pgh.pa.us>
@ 2004-05-05 18:13   ` Paul Tuckfield <paul@tuckfield.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Paul Tuckfield @ 2004-05-05 18:13 UTC (permalink / raw)
  To: Cyrille Bonnet <cyrille@3months.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-performance

I'm guessing you have a 4 cpu box:
1 99 percent busy process on a 4 way box == about 25% busy overall.


On May 5, 2004, at 6:03 AM, Tom Lane wrote:

> "Cyrille Bonnet" <cyrille@3months.com> writes:
>> Should I be worried that Postgres is eating up 99% of my CPU??? Or is 
>> this
>> *expected* behaviour?
>
> It's not expected, unless you are running some very long-running query.
>
> The conflict between what top says and what mpstat says is strange; I
> wonder if you might have a buggy version of one of them?  You should
> probably check some other tools (try "vmstat 1" for instance) to see if
> you can get a consensus on whether the CPU is maxed out or not ...
>
> 			regards, tom lane
>
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 8: explain analyze is your friend
>




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


end of thread, other threads:[~2004-05-05 18:13 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-05-04 23:34 very high CPU usage in "top", but not in "mpstat" Cyrille Bonnet <cyrille@3months.com>
2004-05-05 13:03 ` Tom Lane <tgl@sss.pgh.pa.us>
2004-05-05 18:13   ` Paul Tuckfield <paul@tuckfield.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox