Thread: Controlling proliferation of postgres.exe processes

Controlling proliferation of postgres.exe processes

From
Radcon Entec
Date:
Greetings!
 
At the current moment, our customer's computer has 22 instances of postgres.exe running.  When a colleague checked a few minutes ago, there were 29.  Our contract specifies that we cannot consume more than 40% of the computer's memory, and we're over that level.  When does an instance of postgres.exe get created, and how can we make sure we create only the minimum number necessary?
 
Thanks very much!
 
RobR

Re: Controlling proliferation of postgres.exe processes

From
Bill Moran
Date:
In response to Radcon Entec <radconentec@yahoo.com>:

> Greetings!
>
> At the current moment, our customer's computer has 22 instances of postgres.exe running.  When a colleague checked a
fewminutes ago, there were 29.  Our contract specifies that we cannot consume more than 40% of the computer's memory,
andwe're over that level.  When does an instance of postgres.exe get created, and how can we make sure we create only
theminimum number necessary? 

Each connection gets a dedicated process.  If you need to control the
max # of processes, adjust the max_connections parameter in
postgresql.conf

Note that there are a few processes that run independently (such as
the stats collecter), so the actual # of process will be max_connections
plus a few (the exact # depends on config options, but usually 3 or so)

However, since memory is your problems and not # of processes, you may
want to look at other parameters in postgresql.conf related to memory
usage.  I'm not familiar with the use of PostgreSQL on Windows, so I can't
offer much advice there.

--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/

Re: Controlling proliferation of postgres.exe processes

From
Scott Mead
Date:
2009/6/23 Radcon Entec <radconentec@yahoo.com>
Greetings!
 
At the current moment, our customer's computer has 22 instances of postgres.exe running.  When a colleague checked a few minutes ago, there were 29.  Our contract specifies that we cannot consume more than 40% of the computer's memory, and we're over that level.  When does an instance of postgres.exe get created, and how can we make sure we create only the minimum number necessary?
 
Thanks very much!
 
RobR

  Every single time someone connects to the database, one of those things will start.  So if you have a new user in the app, and your app is 1 db connection per user, then you will have a postgres.exe for each one of them on top of 3 or 4 that the system is using.

  As far as memory, the way the task manager shows memory is slightly mis-leading.  Each process is not actually taking up the full amount shown.  The reason for this is that postgres is sharing a large memory area between multiple postgres.exe's, but windows (and linux, solaris etc.. for that matter) all think that each postgres.exe has taken that much memory up when in reality, there is only one memory segment that is that high. iow, you probably are well below your 'sla'. 

   There are some apps that can help you decipher exactly how much mem you are using, this has been talked about before:  http://archives.postgresql.org/pgsql-general/2009-06/msg00729.php

Good luck

--Scott

Re: Controlling proliferation of postgres.exe processes

From
Greg Stark
Date:
> In response to Radcon Entec <radconentec@yahoo.com>:
>> At the current moment, our customer's computer has 22 instances of postgres.exe running.  When a colleague checked a
fewminutes ago, there were 29.  Our contract specifies that we cannot consume more than 40% of the computer's memory,
andwe're over that level. 

Keep in mind the Postgres uses shared memory, so make sure not to
count the shared memory segment (set by the shared_buffers
configuration value) repeatedly for every process. I'm not sure which
Windows tools make it clear this shared memory is the same and which
might make it appear to belong to every process.

--
greg
http://mit.edu/~gsstark/resume.pdf

Re: Controlling proliferation of postgres.exe processes

From
Alan Hodgson
Date:
On Tuesday 23 June 2009, Radcon Entec <radconentec@yahoo.com> wrote:
> Greetings!
>
> At the current moment, our customer's computer has 22 instances of
> postgres.exe running.  When a colleague checked a few minutes ago, there
> were 29.  Our contract specifies that we cannot consume more than 40% of
> the computer's memory, and we're over that level.  When does an instance
> of postgres.exe get created, and how can we make sure we create only the
> minimum number necessary?
>

Most of the memory reported in use by PostgreSQL is shared ... the actual
per-process memory use is fairly low unless your work_mem is set  high and
you have queries that use it.