From cyrille@3months.com Tue May 4 23:35:10 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 66FB3D1CA43 for ; Tue, 4 May 2004 20:35:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 98685-01 for ; Tue, 4 May 2004 20:34:51 -0300 (ADT) Received: from 3months.com (unknown [203.96.25.18]) by svr1.postgresql.org (Postfix) with ESMTP id BF0C9D1EB44 for ; Tue, 4 May 2004 20:34:47 -0300 (ADT) Received: from Spooler by 3months.com (Mercury/32 v4.01a) ID MO00020B; 5 May 2004 11:31:29 +1200 Received: from spooler by 3months.com (Mercury/32 v4.01a); 5 May 2004 11:31:24 +1200 Received: from Cyrillelaptop (203.96.25.15) by 3months.com (Mercury/32 v4.01a) with ESMTP ID MG00004F; 5 May 2004 11:31:21 +1200 From: "Cyrille Bonnet" To: Subject: very high CPU usage in "top", but not in "mpstat" Date: Wed, 5 May 2004 11:34:41 +1200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0018_01C43294.F4B6B620" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcQyMF9N3R0vP6P2T4aKHdZRNbaNdg== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Message-ID: <47E18B2A3472@3months.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=HTML_60_70, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200405/31 X-Sequence-Number: 6862 This is a multi-part message in MIME format. ------=_NextPart_000_0018_01C43294.F4B6B620 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit 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. ------=_NextPart_000_0018_01C43294.F4B6B620 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

Hello all,

 

We are using Postgres 7.3 with JBoss 3.2.3 on a Linux Fe= dora 1.0 box.

 

When I am looking at CPU activity with “top”= , I often see something like:

 

  PID USER     PRI  NI&nbs= p; SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND=

14154 postgres  25   0  3592 3592&nb= sp; 2924        R    99.1&nbs= p;     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      &nbs= p;2.99      0.00   18.94       &nbs= p; 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.

------=_NextPart_000_0018_01C43294.F4B6B620-- From tgl@sss.pgh.pa.us Wed May 5 13:03:40 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C05E2D1E7C7 for ; Wed, 5 May 2004 10:03:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 26637-01 for ; Wed, 5 May 2004 10:03:18 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id CC142D1E7C4 for ; Wed, 5 May 2004 10:03:14 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i45D3Ftm024917; Wed, 5 May 2004 09:03:16 -0400 (EDT) To: "Cyrille Bonnet" Cc: pgsql-performance@postgresql.org Subject: Re: very high CPU usage in "top", but not in "mpstat" In-reply-to: <47E18B2A3472@3months.com> References: <47E18B2A3472@3months.com> Comments: In-reply-to "Cyrille Bonnet" message dated "Wed, 05 May 2004 11:34:41 +1200" Date: Wed, 05 May 2004 09:03:15 -0400 Message-ID: <24916.1083762195@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/32 X-Sequence-Number: 6863 "Cyrille Bonnet" 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 From paul@tuckfield.com Wed May 5 18:13:35 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6917AD1F151 for ; Wed, 5 May 2004 15:13:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 73511-06 for ; Wed, 5 May 2004 15:13:15 -0300 (ADT) Received: from monsoon.he.net (monsoon.he.net [64.62.221.2]) by svr1.postgresql.org (Postfix) with SMTP id 540F6D1E856 for ; Wed, 5 May 2004 15:13:13 -0300 (ADT) Received: from [10.244.45.7] ([216.113.168.128]) by monsoon.he.net for ; Wed, 5 May 2004 11:13:06 -0700 In-Reply-To: <24916.1083762195@sss.pgh.pa.us> References: <47E18B2A3472@3months.com> <24916.1083762195@sss.pgh.pa.us> Mime-Version: 1.0 (Apple Message framework v613) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: Tom Lane , pgsql-performance@postgresql.org From: Paul Tuckfield Subject: Re: very high CPU usage in "top", but not in "mpstat" Date: Wed, 5 May 2004 11:13:11 -0700 To: Cyrille Bonnet X-Mailer: Apple Mail (2.613) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/39 X-Sequence-Number: 6870 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" 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 >