Thread: PostgreSQL Connections?

PostgreSQL Connections?

From
Ashish Karalkar
Date:
Hello All,
I am running PostgresSQL 8.2 on Redhat Linux 4.
When I look for the processes that are using postgres
using ps aux|more
I got lots of Idle processes with servers own IP
address. Can anybody please tell me why this is
happening.

Also there are multiple processes for my single
client(same IP) of which maximum are idle. are these
processes means connection or there is a single
connection starting  many processes.



I am having max connection =200



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Re: PostgreSQL Connections?

From
"Shoaib Mir"
Date:
Can you show us the output for:

ps auxwww | grep ^postgres

that should explain a little more...

-------------
Shoaib Mir
EnterpriseDB (www.enterprisedb.com )

On 1/10/07, Ashish Karalkar <ashish_karalkar@yahoo.com> wrote:
Hello All,
I am running PostgresSQL 8.2 on Redhat Linux 4.
When I look for the processes that are using postgres
using ps aux|more
I got lots of Idle processes with servers own IP
address. Can anybody please tell me why this is
happening.

Also there are multiple processes for my single
client(same IP) of which maximum are idle. are these
processes means connection or there is a single
connection starting  many processes.



I am having max connection =200



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Re: PostgreSQL Connections?

From
Jeff Davis
Date:
On Tue, 2007-01-09 at 21:48 -0800, Ashish Karalkar wrote:
> Hello All,
> I am running PostgresSQL 8.2 on Redhat Linux 4.
> When I look for the processes that are using postgres
> using ps aux|more
> I got lots of Idle processes with servers own IP
> address. Can anybody please tell me why this is
> happening.
>
> Also there are multiple processes for my single
> client(same IP) of which maximum are idle. are these
> processes means connection or there is a single
> connection starting  many processes.
>

You probably have clients accessing postgresql and holding the
connection open, perhaps in a connection pool. Do you have web
applications accessing the database?

Regards,
    Jeff Davis


Re: PostgreSQL Connections?

From
Ashish Karalkar
Date:
Hi Shoaib

Following is the output for ps auxwww | grep ^postgres

IP address of my server is 172.18.5.155



postgres  9635  0.0  0.4 44436 2420 pts/1    S
Jan11   0:04 /usr/local/pgsql/bin/postgres -D
/usr/local/pgsql/data
postgres  9636  0.0  0.2  7856 1368 ?        Ss
Jan11   0:00 postgres: logger process
postgres  9638  0.0  3.1 44564 16376 ?       Ss
Jan11   0:00 postgres: writer process
postgres  9639  0.0  0.4  9340 2104 ?        Ss
Jan11   1:15 postgres: stats collector process
postgres 12846  0.0  0.8 45328 4164 ?        Ss
Jan12   0:00 postgres: qsweb qsweb06jan07
172.18.4.61(4272) idle
postgres 18580  0.0  1.4 48176 7276 ?        Ss
Jan12   0:00 postgres: qsweb qsweb12jan2007
172.18.4.61(1320) idle
postgres 21614  0.0  0.6 45204 3584 ?        Ss
Jan12   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(3888) idle
postgres 21615  0.0  0.7 45204 3728 ?        Ss
Jan12   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(3890) idle
postgres 21616  0.0  0.7 45160 3784 ?        Ss
Jan12   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(3891) idle in transaction
postgres 21634  0.0  0.7 45204 3968 ?        Ss
Jan12   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(3892) idle in transaction
postgres 21635  0.0  0.7 45160 3784 ?        Ss
Jan12   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(3893) idle in transaction
postgres 21637  0.0  0.7 45204 3968 ?        Ss
Jan12   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(3894) idle in transaction
postgres 21648  0.0  0.7 45160 3784 ?        Ss
Jan12   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(3895) idle in transaction
postgres 21652  0.0  0.7 45160 4076 ?        Ss
Jan12   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(3896) idle in transaction
postgres 21660  0.0  0.9 45544 4812 ?        Ss
Jan12   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(3897) idle in transaction
postgres 21727  0.0  0.7 45164 4076 ?        Ss
Jan12   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(3925) idle in transaction
postgres 21728  0.0  0.7 45204 3968 ?        Ss
Jan12   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(3926) idle in transaction
postgres 21752  0.0  0.7 45160 4076 ?        Ss
Jan12   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(3943) idle in transaction
postgres 23335  0.0  0.9 45336 4800 ?        Ss
11:38   0:00 postgres: qsweb postgres
172.18.4.16(1313) idle
postgres 23336  0.0  2.2 48192 11812 ?       Ss
11:38   0:00 postgres: qsweb qsweb12jan2007
172.18.4.16(1314) idle
postgres 23665  0.0  0.8 45204 4260 ?        Ss
12:13   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(4799) idle
postgres 23666  0.0  0.8 45160 4472 ?        Ss
12:13   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(4800) idle in transaction
postgres 23667  0.0  0.8 45204 4424 ?        Ss
12:13   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(4803) idle
postgres 23668  0.0  0.8 45164 4476 ?        Ss
12:13   0:00 postgres: qsweb qsweb12jan2007
172.18.5.197(4804) idle in transaction
postgres 23753  0.0  1.0 45336 5216 ?        Ss
12:18   0:00 postgres: qsweb postgres
172.18.4.58(1140) idle
postgres 23754  0.0  2.7 48192 14308 ?       Ss
12:18   0:00 postgres: qsweb qsweb06jan07
172.18.4.58(1141) idle
postgres 23755  0.0  0.8 45164 4400 ?        Ss
12:18   0:00 postgres: qsweb qsweb06jan07
172.18.4.58(1143) idle
postgres 23756  0.0  1.0 45240 5256 ?        Ss
12:18   0:00 postgres: qsweb qsweb12jan2007
172.18.4.58(1144) idle
postgres 23761  0.0  1.0 45336 5216 ?        Ss
12:20   0:00 postgres: qsweb postgres
172.18.4.135(1214) idle
postgres 23762  0.0  1.7 46596 8840 ?        Ss
12:20   0:00 postgres: qsweb importdata
172.18.4.135(1215) idle
postgres 23868  0.0  0.8 45204 4260 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37415) idle
postgres 23869  0.0  0.8 45204 4260 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37416) idle
postgres 23870  0.0  0.8 45164 4476 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37417) idle in transaction
postgres 23871  0.0  0.8 45204 4424 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37418) idle
postgres 23872  0.0  0.8 45164 4476 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37419) idle in transaction
postgres 23874  0.0  0.8 45164 4476 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37420) idle in transaction
postgres 23875  0.0  0.9 45204 4736 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37421) idle in transaction
postgres 23877  0.0  0.8 45164 4476 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37422) idle in transaction
postgres 23878  0.0  0.8 45204 4424 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37423) idle
postgres 23879  0.0  0.8 45164 4476 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37424) idle in transaction
postgres 23880  0.0  0.9 45204 4736 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37425) idle in transaction
postgres 23881  0.0  0.8 45164 4476 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37426) idle in transaction
postgres 23883  0.0  0.8 45204 4260 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37427) idle
postgres 23884  0.0  0.8 45164 4476 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37428) idle in transaction
postgres 23885  0.0  0.9 45204 4736 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37429) idle in transaction
postgres 23886  0.0  0.9 45164 4828 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37430) idle in transaction
postgres 23887  0.0  1.1 45900 5696 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37431) idle
postgres 23888  0.0  0.8 45204 4424 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37432) idle
postgres 23889  0.0  0.8 45164 4476 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37433) idle in transaction
postgres 23890  0.0  0.9 45204 4732 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37434) idle in transaction
postgres 23891  0.0  0.8 45164 4472 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37435) idle in transaction
postgres 23892  0.0  0.9 45204 4732 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37436) idle in transaction
postgres 23893  0.0  0.9 45164 4824 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37437) idle in transaction
postgres 23894  0.0  1.1 45900 5872 ?        Ss
12:30   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37438) idle
postgres 23895  0.0  1.0 45592 5228 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37439) idle in transaction
postgres 23897  0.0  0.7 45164 4104 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37441) idle in transaction
postgres 23898  0.0  0.8 45896 4532 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37442) idle
postgres 23899  0.0  0.6 45028 3240 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37443) idle
postgres 23900  0.0  0.9 45188 4932 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37444) idle
postgres 23901  0.0  0.9 45188 4844 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37446) idle
postgres 23902  0.0  0.9 45188 4840 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37447) idle
postgres 23903  0.0  0.6 45028 3412 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37449) idle
postgres 23904  0.0  0.6 45028 3412 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37450) idle
postgres 23905  0.0  0.6 45028 3412 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37452) idle
postgres 23906  0.0  0.9 45164 4876 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37453) idle
postgres 23907  0.0  0.9 45164 4876 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37454) idle
postgres 23908  0.0  0.9 45164 4876 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37455) idle
postgres 23909  0.0  1.1 45968 6076 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37457) idle
postgres 23910  0.0  0.9 45188 4848 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37458) idle
postgres 23911  0.0  0.9 45188 4844 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37459) idle
postgres 23912  0.0  0.6 45028 3412 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37460) idle
postgres 23913  0.0  0.9 45188 4844 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37462) idle
postgres 23914  0.0  0.6 45028 3412 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37463) idle
postgres 23915  0.0  0.6 45028 3412 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37465) idle
postgres 23916  0.0  0.9 45320 4872 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37466) idle
postgres 23917  0.0  0.9 45188 4848 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37467) idle
postgres 23918  0.0  0.6 45028 3412 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37468) idle
postgres 23919  0.0  0.6 45028 3412 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37471) idle
postgres 23920  0.0  0.6 45028 3412 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37472) idle
postgres 23921  0.0  0.6 45028 3412 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37473) idle
postgres 23922  0.0  0.8 45188 4436 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37474) idle
postgres 23923  0.0  0.8 45188 4436 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37475) idle
postgres 23924  0.0  1.1 45940 6112 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37476) idle
postgres 23925  0.0  0.9 45164 4880 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37477) idle
postgres 23926  0.0  0.9 45164 4876 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37478) idle
postgres 23927  0.0  0.9 45164 4876 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37480) idle
postgres 23928  0.0  1.1 45968 6068 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37482) idle
postgres 23929  0.0  0.9 45188 4848 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37483) idle
postgres 23930  0.0  0.9 45188 4844 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37484) idle
postgres 23931  0.0  0.9 45188 4844 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37486) idle
postgres 23932  0.0  0.8 45164 4468 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37487) idle
postgres 23933  0.0  0.8 45164 4468 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37488) idle
postgres 23934  0.0  1.1 45608 5744 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37490) idle
postgres 23935  0.0  0.9 45188 4848 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37491) idle
postgres 23936  0.0  0.9 45188 4844 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37492) idle
postgres 23937  0.0  0.6 45028 3412 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37493) idle
postgres 23938  0.0  0.9 45188 4844 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37494) idle
postgres 23939  0.0  0.6 45028 3412 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37497) idle
postgres 23940  0.0  0.6 45028 3412 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37499) idle
postgres 23941  0.0  1.1 45968 6068 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37500) idle
postgres 23942  0.0  0.9 45188 4848 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37501) idle
postgres 23943  0.0  1.0 45320 5284 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37502) idle
postgres 23944  0.0  0.6 45028 3412 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37503) idle
postgres 23945  0.0  0.9 45188 4844 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37504) idle
postgres 23946  0.0  0.9 45188 4848 ?        Ss
12:31   0:00 postgres: qsweb qsweb12jan2007
172.18.5.155(37507) idle
postgres 24047  0.0  0.6 45028 3168 ?        Ss
12:42   0:00 postgres: qsweb qsweb12jan2007
172.18.4.16(2000) idle
postgres 24049  0.0  0.6 45028 3160 ?        Ss
12:42   0:00 postgres: qsweb qsweb12jan2007
172.18.4.16(2002) idle
postgres 24053  0.0  0.6 45028 3160 ?        Ss
12:42   0:00 postgres: qsweb qsweb12jan2007
172.18.4.16(2008) idle
postgres 24054  0.0  0.6 45028 3160 ?        Ss
12:42   0:00 postgres: qsweb qsweb12jan2007
172.18.4.16(2009) idle
postgres 24055  0.2  1.0 45772 5656 ?        Ss
12:42   0:00 postgres: qsweb qsweb12jan2007
172.18.4.16(2011) idle


--- Shoaib Mir <shoaibmir@gmail.com> wrote:

> Can you show us the output for:
>
> ps auxwww | grep ^postgres
>
> that should explain a little more...
>
> -------------
> Shoaib Mir
> EnterpriseDB (www.enterprisedb.com)
>
> On 1/10/07, Ashish Karalkar
> <ashish_karalkar@yahoo.com> wrote:
> >
> > Hello All,
> > I am running PostgresSQL 8.2 on Redhat Linux 4.
> > When I look for the processes that are using
> postgres
> > using ps aux|more
> > I got lots of Idle processes with servers own IP
> > address. Can anybody please tell me why this is
> > happening.
> >
> > Also there are multiple processes for my single
> > client(same IP) of which maximum are idle. are
> these
> > processes means connection or there is a single
> > connection starting  many processes.
> >
> >
> >
> > I am having max connection =200
> >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 5: don't forget to increase your free space
> map settings
> >
>




____________________________________________________________________________________
Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

Re: PostgreSQL Connections?

From
Shane Ambler
Date:
Ashish Karalkar wrote:
> Hi Shoaib
>
> Following is the output for ps auxwww | grep ^postgres
>
> IP address of my server is 172.18.5.155

> postgres 12846  0.0  0.8 45328 4164 ?        Ss
> Jan12   0:00 postgres: qsweb qsweb06jan07
> 172.18.4.61(4272) idle

> postgres 23335  0.0  0.9 45336 4800 ?        Ss
> 11:38   0:00 postgres: qsweb postgres
> 172.18.4.16(1313) idle

> postgres 23665  0.0  0.8 45204 4260 ?        Ss
> 12:13   0:00 postgres: qsweb qsweb12jan2007
> 172.18.5.197(4799) idle

> postgres 23753  0.0  1.0 45336 5216 ?        Ss
> 12:18   0:00 postgres: qsweb postgres
> 172.18.4.58(1140) idle

> postgres 23761  0.0  1.0 45336 5216 ?        Ss
> 12:20   0:00 postgres: qsweb postgres
> 172.18.4.135(1214) idle

> postgres 23868  0.0  0.8 45204 4260 ?        Ss
> 12:30   0:00 postgres: qsweb qsweb12jan2007
> 172.18.5.155(37415) idle

Will probably need a bit more information here but what I can figure is-

You say you have a server and a single client - there are at least 6
different ip addresses in the process list you sent.

With the multiple client connections from other machines - one is
obviously the ip address that you know you are using, can you account
for the others?
If not then you should be fixing your security settings - either in your
pg_hba.conf or a firewall on the server.

 From the multiple connections from your server IP I would guess that
you are running a web server and using persistent connections of some
sort. This will keep each connection open so the next page request
doesn't have the overhead of establishing a new connection. The ones
that say idle in transaction would be linked to a page being
constructed. The idle ones will be waiting for the next page request.
This is not a bad thing, although some methods of achieving this are
better than others.

What client software are you using on your client machine?

Does this program exit normally or is it crashing before it closes the
connection it has established?

Does the one program open more than one connection when it is running?

Was this list taken while the client program was running?


>
> --- Shoaib Mir <shoaibmir@gmail.com> wrote:
>
>> Can you show us the output for:
>>
>> ps auxwww | grep ^postgres
>>
>> that should explain a little more...
>>
>> -------------
>> Shoaib Mir
>> EnterpriseDB (www.enterprisedb.com)
>>
>> On 1/10/07, Ashish Karalkar
>> <ashish_karalkar@yahoo.com> wrote:
>>> Hello All,
>>> I am running PostgresSQL 8.2 on Redhat Linux 4.
>>> When I look for the processes that are using
>> postgres
>>> using ps aux|more
>>> I got lots of Idle processes with servers own IP
>>> address. Can anybody please tell me why this is
>>> happening.
>>>
>>> Also there are multiple processes for my single
>>> client(same IP) of which maximum are idle. are
>> these
>>> processes means connection or there is a single
>>> connection starting  many processes.
>>>

--

Shane Ambler
pgSQL@007Marketing.com

Get Sheeky @ http://Sheeky.Biz

Re: PostgreSQL Connections?

From
Ashish Karalkar
Date:
Thanks Shane for your replay,
It was by mistake , I have multiple clients,my server
IP is 155, having a web server, what we are doing is
using a java pool. and yes we are following the method
to close the connection immediatly after its work and
for next work pick up the new connection from pool, we
are using jboss as web application server. Point of
worry is that my server has many idle process on its
own IP .

With regards
Ashish Karalkar


--- Shane Ambler <pgsql@007Marketing.com> wrote:

> Ashish Karalkar wrote:
> > Hi Shoaib
> >
> > Following is the output for ps auxwww | grep
> ^postgres
> >
> > IP address of my server is 172.18.5.155
>
> > postgres 12846  0.0  0.8 45328 4164 ?        Ss
> > Jan12   0:00 postgres: qsweb qsweb06jan07
> > 172.18.4.61(4272) idle
>
> > postgres 23335  0.0  0.9 45336 4800 ?        Ss
> > 11:38   0:00 postgres: qsweb postgres
> > 172.18.4.16(1313) idle
>
> > postgres 23665  0.0  0.8 45204 4260 ?        Ss
> > 12:13   0:00 postgres: qsweb qsweb12jan2007
> > 172.18.5.197(4799) idle
>
> > postgres 23753  0.0  1.0 45336 5216 ?        Ss
> > 12:18   0:00 postgres: qsweb postgres
> > 172.18.4.58(1140) idle
>
> > postgres 23761  0.0  1.0 45336 5216 ?        Ss
> > 12:20   0:00 postgres: qsweb postgres
> > 172.18.4.135(1214) idle
>
> > postgres 23868  0.0  0.8 45204 4260 ?        Ss
> > 12:30   0:00 postgres: qsweb qsweb12jan2007
> > 172.18.5.155(37415) idle
>
> Will probably need a bit more information here but
> what I can figure is-
>
> You say you have a server and a single client -
> there are at least 6
> different ip addresses in the process list you sent.
>
> With the multiple client connections from other
> machines - one is
> obviously the ip address that you know you are
> using, can you account
> for the others?
> If not then you should be fixing your security
> settings - either in your
> pg_hba.conf or a firewall on the server.
>
>  From the multiple connections from your server IP I
> would guess that
> you are running a web server and using persistent
> connections of some
> sort. This will keep each connection open so the
> next page request
> doesn't have the overhead of establishing a new
> connection. The ones
> that say idle in transaction would be linked to a
> page being
> constructed. The idle ones will be waiting for the
> next page request.
> This is not a bad thing, although some methods of
> achieving this are
> better than others.
>
> What client software are you using on your client
> machine?
>
> Does this program exit normally or is it crashing
> before it closes the
> connection it has established?
>
> Does the one program open more than one connection
> when it is running?
>
> Was this list taken while the client program was
> running?
>
>
> >
> > --- Shoaib Mir <shoaibmir@gmail.com> wrote:
> >
> >> Can you show us the output for:
> >>
> >> ps auxwww | grep ^postgres
> >>
> >> that should explain a little more...
> >>
> >> -------------
> >> Shoaib Mir
> >> EnterpriseDB (www.enterprisedb.com)
> >>
> >> On 1/10/07, Ashish Karalkar
> >> <ashish_karalkar@yahoo.com> wrote:
> >>> Hello All,
> >>> I am running PostgresSQL 8.2 on Redhat Linux 4.
> >>> When I look for the processes that are using
> >> postgres
> >>> using ps aux|more
> >>> I got lots of Idle processes with servers own IP
> >>> address. Can anybody please tell me why this is
> >>> happening.
> >>>
> >>> Also there are multiple processes for my single
> >>> client(same IP) of which maximum are idle. are
> >> these
> >>> processes means connection or there is a single
> >>> connection starting  many processes.
> >>>
>
> --
>
> Shane Ambler
> pgSQL@007Marketing.com
>
> Get Sheeky @ http://Sheeky.Biz
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>                http://archives.postgresql.org/
>




____________________________________________________________________________________
Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

Re: PostgreSQL Connections?

From
Shane Ambler
Date:
Ashish Karalkar wrote:
> Thanks Shane for your replay,
> It was by mistake , I have multiple clients,my server
> IP is 155, having a web server, what we are doing is
> using a java pool. and yes we are following the method
> to close the connection immediatly after its work and
> for next work pick up the new connection from pool, we
> are using jboss as web application server. Point of
> worry is that my server has many idle process on its
> own IP .

That is the whole point of the connection pools.
When a client connection is created there are things like allocating
memory and authentication etc that take a certain amount of time to do.
The connection pool opens a number of connections (or opens as needed
until limit is reached) and then gives the client one of these
connections when it asks for a new connection. The connection to
PostgerSQL is established and resources are already allocated so it is
quicker to start using the existing connection than if the connection
was established when asked for.
The connection pool keeps the connection active (in an idle state) when
the client disconnects and uses it to give to the next connection request.

When generating web pages the time overhead of creating new connections
can more than double the time to generate the page making for a very
slow site.

Unless you are hitting a performance limit (needing more concurrent
connections than your pool settings allow) then you will have some
client connections from the pool that are idle.

If the number of idle connections is excessive and you don't expect
traffic to increase/peak then feel free to reduce the number of
connections in your pool settings to reduce the number of idle
connections kept open.

The connections from the server IP would indicate that JBoss is running
on the same machine as Postgresql - that is the machine connecting to
Postgresql or there is some kind of tunnel (such as through ssh) that
means the connections are established locally.


> With regards
> Ashish Karalkar
>
>
> --- Shane Ambler <pgsql@007Marketing.com> wrote:
>
>> Ashish Karalkar wrote:
>>> Hi Shoaib
>>>
>>> Following is the output for ps auxwww | grep
>> ^postgres
>>> IP address of my server is 172.18.5.155
>>> postgres 12846  0.0  0.8 45328 4164 ?        Ss
>>> Jan12   0:00 postgres: qsweb qsweb06jan07
>>> 172.18.4.61(4272) idle
>>> postgres 23335  0.0  0.9 45336 4800 ?        Ss
>>> 11:38   0:00 postgres: qsweb postgres
>>> 172.18.4.16(1313) idle
>>> postgres 23665  0.0  0.8 45204 4260 ?        Ss
>>> 12:13   0:00 postgres: qsweb qsweb12jan2007
>>> 172.18.5.197(4799) idle
>>> postgres 23753  0.0  1.0 45336 5216 ?        Ss
>>> 12:18   0:00 postgres: qsweb postgres
>>> 172.18.4.58(1140) idle
>>> postgres 23761  0.0  1.0 45336 5216 ?        Ss
>>> 12:20   0:00 postgres: qsweb postgres
>>> 172.18.4.135(1214) idle
>>> postgres 23868  0.0  0.8 45204 4260 ?        Ss
>>> 12:30   0:00 postgres: qsweb qsweb12jan2007
>>> 172.18.5.155(37415) idle
>> Will probably need a bit more information here but
>> what I can figure is-
>>
>> You say you have a server and a single client -
>> there are at least 6
>> different ip addresses in the process list you sent.
>>
>> With the multiple client connections from other
>> machines - one is
>> obviously the ip address that you know you are
>> using, can you account
>> for the others?
>> If not then you should be fixing your security
>> settings - either in your
>> pg_hba.conf or a firewall on the server.
>>
>>  From the multiple connections from your server IP I
>> would guess that
>> you are running a web server and using persistent
>> connections of some
>> sort. This will keep each connection open so the
>> next page request
>> doesn't have the overhead of establishing a new
>> connection. The ones
>> that say idle in transaction would be linked to a
>> page being
>> constructed. The idle ones will be waiting for the
>> next page request.
>> This is not a bad thing, although some methods of
>> achieving this are
>> better than others.
>>
>> What client software are you using on your client
>> machine?
>>
>> Does this program exit normally or is it crashing
>> before it closes the
>> connection it has established?
>>
>> Does the one program open more than one connection
>> when it is running?
>>
>> Was this list taken while the client program was
>> running?
>>
>>
>>> --- Shoaib Mir <shoaibmir@gmail.com> wrote:
>>>
>>>> Can you show us the output for:
>>>>
>>>> ps auxwww | grep ^postgres
>>>>
>>>> that should explain a little more...
>>>>
>>>> -------------
>>>> Shoaib Mir
>>>> EnterpriseDB (www.enterprisedb.com)
>>>>
>>>> On 1/10/07, Ashish Karalkar
>>>> <ashish_karalkar@yahoo.com> wrote:
>>>>> Hello All,
>>>>> I am running PostgresSQL 8.2 on Redhat Linux 4.
>>>>> When I look for the processes that are using
>>>> postgres
>>>>> using ps aux|more
>>>>> I got lots of Idle processes with servers own IP
>>>>> address. Can anybody please tell me why this is
>>>>> happening.
>>>>>
>>>>> Also there are multiple processes for my single
>>>>> client(same IP) of which maximum are idle. are
>>>> these
>>>>> processes means connection or there is a single
>>>>> connection starting  many processes.
>>>>>
>> --
>>
>> Shane Ambler
>> pgSQL@007Marketing.com
>>
>> Get Sheeky @ http://Sheeky.Biz
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 4: Have you searched our list archives?
>>
>>                http://archives.postgresql.org/
>>
>
>
>
>
> ____________________________________________________________________________________
> Don't get soaked.  Take a quick peak at the forecast
> with the Yahoo! Search weather shortcut.
> http://tools.search.yahoo.com/shortcuts/#loc_weather
>
>


--

Shane Ambler
pgSQL@007Marketing.com

Get Sheeky @ http://Sheeky.Biz