Thread: Many instances of postgres.exe

Many instances of postgres.exe

From
"Bob Pawley"
Date:
Hi
 
While looking at an error message for iexplore.exe, I noticed, on Task Manager, that there are 5 or more instances of postgres.exe running. Each instance is consuming between 7 to 10 megs of resources, for a total of almost 50 megs.
 
Is this normal behavour?
 
If so, could someone enlighten me as to the purpose?
 
Bob

Re: Many instances of postgres.exe

From
Brian Modra
Date:
2009/10/15 Bob Pawley <rjpawley@shaw.ca>:
> Hi
>
> While looking at an error message for iexplore.exe, I noticed, on Task
> Manager, that there are 5 or more instances of postgres.exe running. Each
> instance is consuming between 7 to 10 megs of resources, for a total of
> almost 50 megs.
>
> Is this normal behavour?

yes

> If so, could someone enlighten me as to the purpose?

Its good that it uses more than one process, because each task then is
separated from other tasks by the operating system's memory
management. I.e. if one crashes, the others stay up.
This is good design as opposed to hugely multi-threaded apps where one
little bug can bring everything down.

The memory used is configurable, you can set up the amount of caching,
but actually I am not sure exactly how much memory is used for what
purpose. However, I set up my server with larger cache than standard.
It has a load of memory though... 50Mb is very little memory
considering you are talking about a professional database system....

> Bob



--
Brian Modra   Land line: +27 23 5411 462
Mobile: +27 79 69 77 082
5 Jan Louw Str, Prince Albert, 6930
Postal: P.O. Box 2, Prince Albert 6930
South Africa
http://www.zwartberg.com/

Re: Many instances of postgres.exe

From
John R Pierce
Date:
Bob Pawley wrote:
> Hi
>
> While looking at an error message for iexplore.exe, I noticed, on Task
> Manager, that there are 5 or more instances of postgres.exe running.
> Each instance is consuming between 7 to 10 megs of resources, for a
> total of almost 50 megs.
>
> Is this normal behavour?
>
> If so, could someone enlighten me as to the purpose?

A) much of that memory is shared by them.   task manager doesn't account
for shared memory


B) on a Linux or Unix system, we might see something like....

$ ps uww -U postgres
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
postgres  3279  0.0  0.5 152036  6000 ?        S    Sep29   2:59
/usr/bin/postmaster -p 5432 -D /var/lib/pgsql/data
postgres  3587  0.0  0.0  13056   704 ?        Ss   Sep29   0:04
postgres: logger process
postgres  3630  0.0 10.4 152192 108508 ?       Ss   Sep29   0:20
postgres: writer process
postgres  3631  0.0  0.0 152192   980 ?        Ss   Sep29   0:01
postgres: wal writer process
postgres  3632  0.0  0.2 153348  2072 ?        Ss   Sep29  13:08
postgres: autovacuum launcher process
postgres  3633  0.1  0.1  14196  1500 ?        Ss   Sep29  36:59
postgres: stats collector process
postgres 27452  0.0  0.1 152740  2028 ?        Ss   09:04   0:00
postgres: squeals squeals [local] idle

the first one is the postmaster process, then there is the 'logger', the
'writer', the 'write ahead log writer', the 'autovacuum launcher' and
hte 'stats collector'.   Finally, the last process 27452 is a user
connection to database squeals by local user squeals, which is idle.

the first 6 of these will always be running, then one additional process
for each active database connection.   While the VIRTUAL size (VSZ) of
most of them is 150MB 'each' on my system, you'll note the RESIDENT SET
SIZE (RSS) is 6M, 700k, 100M, 1M, 2M, 1,5M, 2M.   This is much more
representive of the actual memory usage.





Re: Many instances of postgres.exe

From
"Massa, Harald Armin"
Date:
Bob,
 
While looking at an error message for iexplore.exe, I noticed, on Task Manager, that there are 5 or more instances of postgres.exe running. Each instance is consuming between 7 to 10 megs of resources, for a total of almost 50 megs.
 
Is this normal behavour?

5 instances is the default when nothing has connected. 

Reason: statwriter, autovacuum, ... are all separate processes. For every additional connection there is another process, also giving a postgres.exe

What most likely is "wrong" are those "50 megs", as I guess you are looking at the default task manager.

Within those 50MB the PostgreSQL shared memory is counted (number of processes) time. That is: If there are 8MB of shared memory configured, you will see them as 40MB with 5 running processes.

Look within "View", "Select other columns" to find other memory columns.

best wishes,

Harald

 


--
GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
Spielberger Straße 49
70435 Stuttgart
0173/9409607
no fx, no carrier pigeon
-
%s is too gigantic of an industry to bend to the whims of reality

Re: Many instances of postgres.exe

From
Scott Mead
Date:


On Thu, Oct 15, 2009 at 12:07 PM, Brian Modra <brian@zwartberg.com> wrote:
2009/10/15 Bob Pawley <rjpawley@shaw.ca>:
> Hi
>
> While looking at an error message for iexplore.exe, I noticed, on Task
> Manager, that there are 5 or more instances of postgres.exe running. Each
> instance is consuming between 7 to 10 megs of resources, for a total of
> almost 50 megs.

It's not actually using up that much memory.  Windows (and linux for that matter) think Postgres is using up that much per process, but in actuality, most of that is shared memory between them.  So if you have 5 @ 10 MB a piece, you may only have 12 - 20 MB in use.

 
>
> Is this normal behavour?

yes


 +1
> If so, could someone enlighten me as to the purpose?



  Every time you connect to postgres, your connection gets a new postgres.exe (plus there are a few system ones).  So 5 connections = 5 postgres.exe + a few (3 or 4) system processes.  It's normal, it allows the OS to schedule who does what work.  If you have multiple processors, you get nice parallelism without postgres having to be threaded internally.

--Scott