X-Original-To: pgsql-performance@postgresql.org Received: from localhost.localdomain (208-41-234-242.client.dsl.net [208.41.234.242]) by postgresql.org (Postfix) with ESMTP id B8EC847601F for ; Tue, 11 Mar 2003 09:47:31 -0500 (EST) Received: from endeavour (endeavour.pointhere.net [192.168.2.11]) by localhost.localdomain (8.11.6/8.11.6) with SMTP id h2BEb3o30298; Tue, 11 Mar 2003 09:37:04 -0500 Message-ID: <011d01c2e7de$0451c960$0b02a8c0@pointhere.net> Reply-To: "Jeffrey D. Brower" From: "Jeffrey D. Brower" To: "Nikk Anderson" , References: Subject: Re: Large difference between elapsed time and run time Date: Tue, 11 Mar 2003 09:53:45 -0500 Organization: A Basic Marketing Company MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_011A_01C2E7B4.1B64DE00" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Archive-Number: 200303/78 X-Sequence-Number: 1376 This is a multi-part message in MIME format. ------=_NextPart_000_011A_01C2E7B4.1B64DE00 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [PERFORM] Large difference between elapsed time and run timeYes, this h= elps a lot. Obviously this is far more complicated than just a simple pg_p= connect to accomplish a speedy reply. I really thought that a persistent c= onnection was supposed to eliminate the overhead time in a connection (well= , other than the first time through). But even if I am the only person on = the machine it still takes forever to get a response every time I use http.= I wondered if I was supposed to have a php program that had its own pconn= ect and every http call to the PostgreSQL database went to that php program= rather than handling it by itself, but I found no indication of that while= RTFM. I will give this a try and see if I can get the speed to anything r= easonable. Thanks for the quick reply! Jeff ----- Original Message -----=20 From: Nikk Anderson=20 To: 'Jeffrey D. Brower' ; pgsql-performance@postgresql.org=20 Sent: Tuesday, March 11, 2003 9:30 AM Subject: Re: [PERFORM] Large difference between elapsed time and run time= =20 Hi,=20 -----Original Message-----=20 From: Jeffrey D. Brower [mailto:jeff@pointhere.net]=20 Sent: 11 March 2003 14:24=20 To: Nikk Anderson; 'Scott Buchan'; pgsql-performance@postgresql.org=20 Subject: Re: [PERFORM] Large difference between elapsed time and run time= =20 >My question is how are you accomplishing the connection pooling?=20 I have programmed a connection pool in Java - I am sure something similar= is possible in most other languages.=20 Very basically, the concept is as follows:=20 > Application initialisation=20 >>> 1) Create X number of connections to the database=20 >>> 2) Store connections in an Object=20 >>> 3) Create an array of free and busy connections - put all new= connections in free connection array=20 >>> 4) Object is visible to all components of web application=20 > Request for a connection=20 >>> 4) Code asks for a connection from the pool object (3).=20=20 >>> 5) Pool object moves connection from free array, to the busy = array.=20 >>> 5) Connection is used to do queries=20 >>> 6) Connection is sent back to pool object (3).=20=20 >>> 7) Pool object moves the connection from the busy array, back= to the free array=20 I hope that helps!=20 Nikk=20 ------=_NextPart_000_011A_01C2E7B4.1B64DE00 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [PERFORM] Large difference between elapsed time and = run time
Yes, this helps a lot.  Obviously this is f= ar more=20 complicated than just a simple pg_pconnect to accomplish a speedy reply.&nb= sp; I=20 really thought that a persistent connection was supposed to eliminate the= =20 overhead time in a connection (well, other than the first time through).&nb= sp;=20 But even if I am the only person on the machine it still takes forever to g= et a=20 response every time I use http.  I wondered if I was supposed to have = a php=20 program that had its own pconnect and every http call to the PostgreSQL=20 database went to that php program rather than handling it by itself, b= ut I=20 found no indication of that while RTFM.  I will give this a try and se= e if=20 I can get the speed to anything reasonable.  Thanks for the quick=20 reply!
 
     Jeff
----- Original Message -----
Fro= m:=20 Nikk Anderson
To: 'Jeffrey D. Brower' ; pgsql-performance@postgr= esql.org=20
Sent: Tuesday, March 11, 2003 9:30= =20 AM
Subject: Re: [PERFORM] Large diffe= rence=20 between elapsed time and run time

Hi,

-----Original Message-----
Fr= om:=20 Jeffrey D. Brower [mailto:jeff@pointhere.net]= =20
Sent: 11 March 2003 14:24
To= : Nikk=20 Anderson; 'Scott Buchan'; pgsql-performance@postgr= esql.org=20
Subject: Re: [PERFORM] Large difference between elapse= d time=20 and run time

>My question is how are you accomplishing the connec= tion=20 pooling?


I have programmed a connection pool in Java - I am sure= =20 something similar is possible in most other languages.

Very basically, the concept is as follows:

> Application initialisation=20
        >>>= ; 1)=20 Create X number of connections to the database=20
        >>>= ; 2)=20 Store connections in an Object=20
        >>>= ; 3)=20 Create an array of free and busy connections - put all new connections in= free=20 connection array
        >>> 4) Object is visible to all components of web=20 application

> Request for a connection=20
        >>>= ; 4)=20 Code asks for a connection from the pool object (3). =20
        >>> 5) Pool object moves connection from free array, to= the=20 busy array.
        >>> 5) Connection is used to do queries=20
        >>>= ; 6)=20 Connection is sent back to pool object (3). =20
        >>> 7) Pool object moves the connection from the busy a= rray,=20 back to the free array


I hope that helps!

Nikk

------=_NextPart_000_011A_01C2E7B4.1B64DE00--