Обсуждение: Idle postmaster taking up a lot of CPU

Поиск
Список
Период
Сортировка

Idle postmaster taking up a lot of CPU

От
John Siracusa
Дата:
Here's the top item from the "top" listing on my Postgres machine:

 10:20am  up 98 days, 18:28,  3 users,  load average: 1.14, 1.09, 0.85
103 processes: 101 sleeping, 1 running, 0 zombie, 1 stopped
CPU0 states: 38.0% user, 13.1% system,  0.0% nice, 48.3% idle
CPU1 states: 39.0% user, 11.3% system,  0.0% nice, 49.1% idle
Mem:  1033384K av, 1021972K used,   11412K free, 0K shrd,   42772K buff
Swap: 1185080K av,   17012K used, 1168068K free            748736K cached

  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME COMMAND
20753 postgres  17   0 40292  39M 35960 S    60.9  3.8  26:54 postmaster

Process 20753 was hovering around 60-70% CPU usage for a long time.

I tried to see what that postmaster was doing, but it appeared to be "idle"

% ps -wwwx -p 20753
  PID TTY      STAT   TIME COMMAND
20753 pts/3    R     26:59 postgres: postgres pdm 192.168.0.35 idle

192.168.0.35 is one of our web servers.  I restarted the web server (thus
ending all db connections from that machine) and the "idle-but-CPU-hogging"
postmaster went away.  I'm still concerned about exactly what it was doing,
however.  Any ideas?  Any suggestions for further debugging the situation if
it happens again?

Also, a second question while I'm here :)  Ignoring that one CPU-hogging
postmaster, does the header information in that "top" listing look
reasonable in terms of memory usage?  The "free" memory always hovers around
11412K, but "buff" and "cache" are usually huge.  I'm assuming "buff" and
"cache" memory is available if any of the processes needs it, but there is
always some small amount of swap in use anyway.  Should I be concerned, or
does this look okay?

-John


Re: Idle postmaster taking up a lot of CPU

От
Tom Lane
Дата:
John Siracusa <siracusa@mindspring.com> writes:
> Process 20753 was hovering around 60-70% CPU usage for a long time.

> I tried to see what that postmaster was doing, but it appeared to be "idle"

> % ps -wwwx -p 20753
>   PID TTY      STAT   TIME COMMAND
> 20753 pts/3    R     26:59 postgres: postgres pdm 192.168.0.35 idle

That seems odd to me too.  What PG version is this exactly?

If it happens again, please see if you can get a stack trace from the
not-so-idle process:

    $ gdb /path/to/postgres-executable
    gdb> attach PID-of-process
    gdb> bt
    gdb> quit

            regards, tom lane

Re: Idle postmaster taking up a lot of CPU

От
John Siracusa
Дата:
On 1/17/04 12:32 PM, Tom Lane wrote:
> John Siracusa <siracusa@mindspring.com> writes:
>> Process 20753 was hovering around 60-70% CPU usage for a long time.
>
>> I tried to see what that postmaster was doing, but it appeared to be "idle"
>
>> % ps -wwwx -p 20753
>>   PID TTY      STAT   TIME COMMAND
>> 20753 pts/3    R     26:59 postgres: postgres pdm 192.168.0.35 idle
>
> That seems odd to me too.  What PG version is this exactly?

This is Postgres 7.4.0 on:

% uname -a
Linux foo.com 2.4.22 #5 SMP Fri Oct 10 16:32:42 EDT 2003 i686 i686 i386
GNU/Linux

> If it happens again, please see if you can get a stack trace from the
> not-so-idle process:
>
> $ gdb /path/to/postgres-executable
> gdb> attach PID-of-process
> gdb> bt
> gdb> quit

Will do.

-John