Re: Too many postgres.exe

Lists: pgsql-general
From: <A(dot)Bhattacharya(at)sungard(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Too many postgres.exe
Date: 2009-12-15 09:51:01
Message-ID: 4AD2336877609F41A2B0D53BAD09FC57B6F1BA@VOO-EXCHANGE07.internal.sungard.corp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi All,

I have my application UI in Java and which is communicating with
Postgresql database.

However whenever my application is running I could see there are too
many postgres.exe are created even though the application is not doing
anything in database.

In general the observation is that there are too many progress.exe
processes get created every time I run my application and it
postgres.exe eats up the maximum memory.

Any help/suggestion please!!


From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: A(dot)Bhattacharya(at)sungard(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Too many postgres.exe
Date: 2009-12-15 10:08:14
Message-ID: 4B27600E.2050204@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On 15/12/2009 5:51 PM, A(dot)Bhattacharya(at)sungard(dot)com wrote:

> However whenever my application is running I could see there are too
> many postgres.exe are created even though the application is not doing
> anything in database.

What is "too many" ?

What does:

SELECT * FROM pg_stat_activity;

show?

How are you talking to PostgreSQL? Direct JDBC? An ORM like Hibernate?
Which one? What JDBC driver version? Are you using a connection pool?
Which one?

The people on this mailing list are, with the possible exception of Tom,
not psychic. Some kind of details will help your question get a better
answer, more quickly. See:

http://wiki.postgresql.org/wiki/Guide_to_reporting_problems

> In general the observation is that there are too many progress.exe
> processes get created every time I run my application and it
> postgres.exe eats up the maximum memory.

Then your server is not configured correctly. Set max connections,
shared_buffers, work_mem, maintenance_work_mem, etc so that your server
cannot consume too much memory.

--
Craig Ringer


From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Too many postgres.exe
Date: 2009-12-15 11:25:29
Message-ID: hg7rn9$pmr$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

A(dot)Bhattacharya(at)sungard(dot)com, 15.12.2009 10:51:
> Hi All,
>
> I have my application UI in Java and which is communicating with
> Postgresql database.
>
> However whenever my application is running I could see there are too
> many postgres.exe are created even though the application is not doing
> anything in database.
>
> In general the observation is that there are too many progress.exe
> processes get created every time I run my application and it
> postgres.exe eats up the maximum memory.

Define "too many".

Each connection that you open will start up a new postgres.exe

As Craig has already pointed out you have not specified enough details, so people can only guess what is going wrong (if at all)

My best guess is:

- you are simply not closing your connections when you are don
- you have configured a connection pool that creates a high number of initial connections

Thomas


From: Howard Cole <howardnews(at)selestial(dot)com>
To: A(dot)Bhattacharya(at)sungard(dot)com
Cc: "pgsql-general(at)postgresql(dot)org List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Too many postgres.exe
Date: 2009-12-15 13:08:32
Message-ID: 4B278A50.4030504@selestial.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

A(dot)Bhattacharya(at)sungard(dot)com wrote:
>
> Hi All,
>
>
>
> I have my application UI in Java and which is communicating with
> Postgresql database.
>
> However whenever my application is running I could see there are too
> many postgres.exe are created even though the application is not doing
> anything in database.
>
>
>
Have you defined a connection pool? It is possible that the connections
are part of a pool and will be created when your application starts. You
should be able to change the minimum/maximum pool size.

Howard
www.selestial.com


From: Scott Mead <scott(dot)lists(at)enterprisedb(dot)com>
To: A(dot)Bhattacharya(at)sungard(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Too many postgres.exe
Date: 2009-12-15 14:10:15
Message-ID: d3ab2ec80912150610n27c6b19sbbfb757e20a9d1f0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Tue, Dec 15, 2009 at 4:51 AM, <A(dot)Bhattacharya(at)sungard(dot)com> wrote:

> Hi All,
>
>
>
> I have my application UI in Java and which is communicating with Postgresql
> database.
>
> However whenever my application is running I could see there are too many
> postgres.exe are created even though the application is not doing anything
> in database.
>
Remember, every connection gets a 'postgres.exe' (dedicated backend per
connection). And it'll stick around until you close the connection. If you
create a connection and don't close it until the DB goes away, then you'll
still have the backend process there even though you're not doing anything.

Can you describe what you consider 'Too Many?' The process-per-connection
architecture is very common (albeit not on windows), so I'm curious what
your threshold is.

>
>

>
> In general the observation is that there are too many progress.exe
> processes get created every time I run my application and it postgres.exe
> eats up the maximum memory.
>

You'll need to use sysinternals tools here, task manager mis-reports how
much memory is actually being allocated by postgres. This is because each
postgres.exe is attaching to a shared memory area. This means that you
could be using 2 GB of memory (total) for your postgres database, when it
looks like you're using 20 GB of memory. (10 backends all showing 2 GB).
The reality is... you're not using (mem * num of postgres.exe), you should
use sysinternals tools to discern how much memory is shared vs. per-backend.

--Scott

>
>
> Any help/suggestion please!!
>
>
>