pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Postgres Server collapse
8+ messages / 7 participants
[nested] [flat]

* Postgres Server collapse
@ 2006-11-27 15:19 Sistemasvi <sistemasvi@aerogal.com.ec>
  2006-11-27 15:33 ` Re: Postgres Server collapse Dave Cramer <pg@fastcrypt.com>
  2006-11-27 15:34 ` Re: Postgres Server collapse Mark Lewis <mark.lewis@mir3.com>
  2006-11-27 15:38 ` Re: Postgres Server collapse Csaba Nagy <nagy@ecircle-ag.com>
  2006-11-27 18:26 ` Re: Postgres Server collapse imad <immaad@gmail.com>
  0 siblings, 4 replies; 8+ messages in thread

From: Sistemasvi @ 2006-11-27 15:19 UTC (permalink / raw)
  To: pgsql-jdbc

Hello.

I have a postsgresql database with max 500 connections. All development is in Java (View, Model, controller model). The problem is when I have high traffic (about 10 AM) when the database server collapse. The server turn too slow as It haven´t memory and the swap memory increase too much. I must kill all postgres connections and restart postmaster service.

I have only one connection by web session. It is good or bad?
I have already increased the number of connections to 800 in the postgres and sysctl configuration file.

My server is linux Red Hat and Postgres database V8

Which can be the problem?.


Carlos

 

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Postgres Server collapse
  2006-11-27 15:19 Postgres Server collapse Sistemasvi <sistemasvi@aerogal.com.ec>
@ 2006-11-27 15:33 ` Dave Cramer <pg@fastcrypt.com>
  3 siblings, 0 replies; 8+ messages in thread

From: Dave Cramer @ 2006-11-27 15:33 UTC (permalink / raw)
  To: Sistemasvi <sistemasvi@aerogal.com.ec>; +Cc: pgsql-jdbc

Carlos,

You should be using a connection pool, if you don't have the memory  
to support 800 connections then it just isn't going to work.

Dave
On 27-Nov-06, at 10:19 AM, Sistemasvi wrote:

> Hello.
>
> I have a postsgresql database with max 500 connections. All  
> development is in Java (View, Model, controller model). The problem  
> is when I have high traffic (about 10 AM) when the database server  
> collapse. The server turn too slow as It haven´t memory and the  
> swap memory increase too much. I must kill all postgres connections  
> and restart postmaster service.
>
> I have only one connection by web session. It is good or bad?
> I have already increased the number of connections to 800 in the  
> postgres and sysctl configuration file.
>
> My server is linux Red Hat and Postgres database V8
>
> Which can be the problem?.
>
>
> Carlos
>
>
>

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Postgres Server collapse
  2006-11-27 15:19 Postgres Server collapse Sistemasvi <sistemasvi@aerogal.com.ec>
@ 2006-11-27 15:34 ` Mark Lewis <mark.lewis@mir3.com>
  3 siblings, 0 replies; 8+ messages in thread

From: Mark Lewis @ 2006-11-27 15:34 UTC (permalink / raw)
  To: Sistemasvi <sistemasvi@aerogal.com.ec>; +Cc: pgsql-jdbc

Keeping one connection per session is a no-no if you need your site to
scale.  You'll want to use some kind of database connection pooling
instead.  Remember that sessions only expire after a certain amount of
inactivity.  Depending on your servlet container, the timeouts will be
between 20 and 60 minutes by default.  This means that if your DB server
can only handle, say, 250 connections, then you can't handle more than
250/60 = 4.17 new sessions per minute.  And you do have code to clean up
if the session times out, right?

-- Mark Lewis

On Mon, 2006-11-27 at 10:19 -0500, Sistemasvi wrote:
> Hello.
>  
> I have a postsgresql database with max 500 connections. All
> development is in Java (View, Model, controller model). The problem is
> when I have high traffic (about 10 AM) when the database server
> collapse. The server turn too slow as It haven´t memory and the swap
> memory increase too much. I must kill all postgres connections and
> restart postmaster service.
>  
> I have only one connection by web session. It is good or bad?
> I have already increased the number of connections to 800 in the
> postgres and sysctl configuration file.
>  
> My server is linux Red Hat and Postgres database V8
>  
> Which can be the problem?.
>  
>  
> Carlos
>  
>  



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Postgres Server collapse
  2006-11-27 15:19 Postgres Server collapse Sistemasvi <sistemasvi@aerogal.com.ec>
@ 2006-11-27 15:38 ` Csaba Nagy <nagy@ecircle-ag.com>
  3 siblings, 0 replies; 8+ messages in thread

From: Csaba Nagy @ 2006-11-27 15:38 UTC (permalink / raw)
  To: Sistemasvi <sistemasvi@aerogal.com.ec>; +Cc: pgsql-jdbc

[snip]
> I have only one connection by web session. It is good or bad?
> I have already increased the number of connections to 800 in the
> postgres and sysctl configuration file.

You should probably google for "connection pool" in general to see what
that means, and pick a solution for JDBC. 800 connections is way too
much, we have here ~100 in real use at any time for a busy (read: with
many users and web sessions) application.

Cheers,
Csaba.





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Postgres Server collapse
  2006-11-27 15:19 Postgres Server collapse Sistemasvi <sistemasvi@aerogal.com.ec>
@ 2006-11-27 18:26 ` imad <immaad@gmail.com>
  2006-11-28 09:33   ` Re: Postgres Server collapse Michael Paesold <mpaesold@gmx.at>
  2006-11-28 09:46   ` Re: Postgres Server collapse Altaf Malik <mmalik_altaf@yahoo.com>
  3 siblings, 2 replies; 8+ messages in thread

From: imad @ 2006-11-27 18:26 UTC (permalink / raw)
  To: Sistemasvi <sistemasvi@aerogal.com.ec>; +Cc: pgsql-jdbc

On 11/27/06, Sistemasvi <sistemasvi@aerogal.com.ec> wrote:
>
>
> Hello.
>
> I have a postsgresql database with max 500 connections. All development is
> in Java (View, Model, controller model). The problem is when I have high
> traffic (about 10 AM) when the database server collapse. The server turn too
> slow as It haven´t memory and the swap memory increase too much. I must kill
> all postgres connections and restart postmaster service.
>
> I have only one connection by web session. It is good or bad?

One connection only? Then why did you increased the number of connections
to 800? Sorry, I might be missing some point here.


> I have already increased the number of connections to 800 in the postgres
> and sysctl configuration file.
>
> My server is linux Red Hat and Postgres database V8
>
> Which can be the problem?.
>
>
> Carlos
>
>

--Imad
www.EnterpriseDB.com



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Postgres Server collapse
  2006-11-27 15:19 Postgres Server collapse Sistemasvi <sistemasvi@aerogal.com.ec>
  2006-11-27 18:26 ` Re: Postgres Server collapse imad <immaad@gmail.com>
@ 2006-11-28 09:33   ` Michael Paesold <mpaesold@gmx.at>
  2006-11-28 09:42     ` Re: Postgres Server collapse imad <immaad@gmail.com>
  1 sibling, 1 reply; 8+ messages in thread

From: Michael Paesold @ 2006-11-28 09:33 UTC (permalink / raw)
  To: imad <immaad@gmail.com>; +Cc: Sistemasvi <sistemasvi@aerogal.com.ec>; pgsql-jdbc

imad schrieb:
> On 11/27/06, Sistemasvi <sistemasvi@aerogal.com.ec> wrote:
>>
>>
>> Hello.
>>
>> I have a postsgresql database with max 500 connections. All 
>> development is
>> in Java (View, Model, controller model). The problem is when I have high
>> traffic (about 10 AM) when the database server collapse. The server 
>> turn too
>> slow as It haven´t memory and the swap memory increase too much. I 
>> must kill
>> all postgres connections and restart postmaster service.
>>
>> I have only one connection by web session. It is good or bad?
> 
> One connection only? Then why did you increased the number of connections
> to 800? Sorry, I might be missing some point here.

Strip "only" to understand the sentence. ;-)

Carlos has one open DB connection for each open "web" (i.e. Webbrowser) 
session, which means that there are way too many connections open for a 
great number of currently waiting sessions. A connection pool should 
alleviate the problems.

Best Regards
Michael Paesold




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Postgres Server collapse
  2006-11-27 15:19 Postgres Server collapse Sistemasvi <sistemasvi@aerogal.com.ec>
  2006-11-27 18:26 ` Re: Postgres Server collapse imad <immaad@gmail.com>
  2006-11-28 09:33   ` Re: Postgres Server collapse Michael Paesold <mpaesold@gmx.at>
@ 2006-11-28 09:42     ` imad <immaad@gmail.com>
  0 siblings, 0 replies; 8+ messages in thread

From: imad @ 2006-11-28 09:42 UTC (permalink / raw)
  To: Michael Paesold <mpaesold@gmx.at>; +Cc: Sistemasvi <sistemasvi@aerogal.com.ec>; pgsql-jdbc

Ok sorry.
I missed that "session" thing.

--Imad
www.EnterpriseDB.com


On 11/28/06, Michael Paesold <mpaesold@gmx.at> wrote:
> imad schrieb:
> > On 11/27/06, Sistemasvi <sistemasvi@aerogal.com.ec> wrote:
> >>
> >>
> >> Hello.
> >>
> >> I have a postsgresql database with max 500 connections. All
> >> development is
> >> in Java (View, Model, controller model). The problem is when I have high
> >> traffic (about 10 AM) when the database server collapse. The server
> >> turn too
> >> slow as It haven´t memory and the swap memory increase too much. I
> >> must kill
> >> all postgres connections and restart postmaster service.
> >>
> >> I have only one connection by web session. It is good or bad?
> >
> > One connection only? Then why did you increased the number of connections
> > to 800? Sorry, I might be missing some point here.
>
> Strip "only" to understand the sentence. ;-)
>
> Carlos has one open DB connection for each open "web" (i.e. Webbrowser)
> session, which means that there are way too many connections open for a
> great number of currently waiting sessions. A connection pool should
> alleviate the problems.
>
> Best Regards
> Michael Paesold
>
>



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Postgres Server collapse
  2006-11-27 15:19 Postgres Server collapse Sistemasvi <sistemasvi@aerogal.com.ec>
  2006-11-27 18:26 ` Re: Postgres Server collapse imad <immaad@gmail.com>
@ 2006-11-28 09:46   ` Altaf Malik <mmalik_altaf@yahoo.com>
  1 sibling, 0 replies; 8+ messages in thread

From: Altaf Malik @ 2006-11-28 09:46 UTC (permalink / raw)
  To: Sistemasvi <sistemasvi@aerogal.com.ec>; +Cc: pgsql-jdbc

This is because you open one connection per session and the number of sessions incease. :) It would be better if you use ConnectionPooling instead of managing your own session.
  Otherwise, do the following:-
   
  1. Reduce your session timeout
  2. Make sure no connection remains open
  3. It would be better if you make a single connection in your application and manage it somehow
   
  It seems like your sessions are never killed, or at the end of session, you never close your existing session.
   
  --Altaf Malik
  

imad <immaad@gmail.com> wrote:
  On 11/27/06, Sistemasvi wrote:
>
>
> Hello.
>
> I have a postsgresql database with max 500 connections. All development is
> in Java (View, Model, controller model). The problem is when I have high
> traffic (about 10 AM) when the database server collapse. The server turn too
> slow as It haven´t memory and the swap memory increase too much. I must kill
> all postgres connections and restart postmaster service.
>
> I have only one connection by web session. It is good or bad?

One connection only? Then why did you increased the number of connections
to 800? Sorry, I might be missing some point here.


> I have already increased the number of connections to 800 in the postgres
> and sysctl configuration file.
>
> My server is linux Red Hat and Postgres database V8
>
> Which can be the problem?.
>
>
> Carlos
>
>

--Imad
www.EnterpriseDB.com

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate


 
---------------------------------
Want to start your own business? Learn how on Yahoo! Small Business.

^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2006-11-28 09:46 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-11-27 15:19 Postgres Server collapse Sistemasvi <sistemasvi@aerogal.com.ec>
2006-11-27 15:33 ` Dave Cramer <pg@fastcrypt.com>
2006-11-27 15:34 ` Mark Lewis <mark.lewis@mir3.com>
2006-11-27 15:38 ` Csaba Nagy <nagy@ecircle-ag.com>
2006-11-27 18:26 ` imad <immaad@gmail.com>
2006-11-28 09:33   ` Michael Paesold <mpaesold@gmx.at>
2006-11-28 09:42     ` imad <immaad@gmail.com>
2006-11-28 09:46   ` Altaf Malik <mmalik_altaf@yahoo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox