Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 91503634BEF for ; Wed, 6 Jan 2010 13:51:30 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 12370-01-8 for ; Wed, 6 Jan 2010 17:51:18 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f227.google.com (mail-fx0-f227.google.com [209.85.220.227]) by mail.postgresql.org (Postfix) with ESMTP id 68A256371B1 for ; Wed, 6 Jan 2010 13:04:05 -0400 (AST) Received: by fxm27 with SMTP id 27so2902473fxm.3 for ; Wed, 06 Jan 2010 09:04:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=lWFEUC3Qgq+eNd32uMgXGSHGDUZmjA9WERUrX8HfDWE=; b=L9KLb5f0GuS9H76j1AWm17dk75/JZj+XuGfg2QQpLHVvFI9BUQss+hkIa4uww8wqmR YS5PtYG9ZCE4i2G7Md4CYERRuiYDdwbo7TsmoONTLPvDMZu+ROKHgP4Px9ytxpEgm0aB RrkYfSM30zGDnuQiJe11L9MVHydhI91FWsggY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=T4I8tbuL84UnxSejiOQIlBUtwygP4Em7lGGFXqOGB9XtKgiz7AHAvr+jTJn6ytEWaU 2r8XMsabe40gLi/THVdZkLqi5urhuicyKbHiApcc3ikFYfOl0SJ8hOk+aTxKEkzXlxfu RDaUYg+8VfU0ynTa01+S5UtMBFajH3Y27JD44= MIME-Version: 1.0 Received: by 10.216.87.79 with SMTP id x57mr785421wee.83.1262797443791; Wed, 06 Jan 2010 09:04:03 -0800 (PST) In-Reply-To: References: Date: Wed, 6 Jan 2010 11:04:03 -0600 Message-ID: Subject: Re: pg_connect takes 3.0 seconds From: Dave Crooke To: Dmitri Girski Cc: pgsql-performance@postgresql.org Content-Type: multipart/alternative; boundary=0016e6d7dfa70f7d3b047c81f102 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.26 tagged_above=-10 required=5 tests=AWL=-2.339, BAYES_05=-1.11, FH_DATE_PAST_20XX=3.188, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201001/61 X-Sequence-Number: 36941 --0016e6d7dfa70f7d3b047c81f102 Content-Type: text/plain; charset=ISO-8859-1 The fact that the delays are clustered at (3 + 0.2 n) seconds, rather than a distributed range, strongly indicates a timeout and not (directly) a resource issue. 3 seconds is too fast for a timeout on almost any DNS operation, unless it has been modified, so I'd suspect it's the TCP layer, e.g. perhaps the SYN packet goes awol and it has to retry. I'd second the vote for investigation with a packet sniffing tool (Wireshark, tcpdump, etc) Cheers Dave On Mon, Jan 4, 2010 at 8:12 PM, Dmitri Girski wrote: > Hi everybody, > > I am running a PostgreSQL server 8.3.5 with a pretty much standard config. > > The web application server which runs Apache 1.3/PHP2.9 has an > intermittent problem: > pg_connect takes exactly 3.0 seconds. The usual connection time is 0.0045. > The long request happens at approximate rate 1:100. > > I turned on logs on postgres server side, and there is > nothing suspicious for me there. When a connection request comes, it is > being served without any delay. > > Could anyone point me to the direction in which I should investigate this > problem further? > Thank you in advance! > > > PS The hardware is: Dell SC1435/4Gb/2x2.0GHz/Gentoo Linux. > The database & web servers are in the 2 local subnets. > > > Dmitri. > > --0016e6d7dfa70f7d3b047c81f102 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable The fact that the delays are clustered at (3 + 0.2 n) seconds, rather than = a distributed range, strongly indicates a timeout and not (directly) a reso= urce issue.

3 seconds is too fast for a timeout on almost any DNS op= eration, unless it has been modified, so I'd suspect it's the TCP l= ayer, e.g. perhaps the SYN packet goes awol and it has to retry.

I'd second the vote for investigation with a packet sniffing tool (= Wireshark, tcpdump, etc)

Cheers
Dave

On Mon, Jan 4, 2010 at 8:12 PM, Dmitri Girski <<= a href=3D"mailto:mitek17@gmail.com">mitek17@gmail.com> wrote:=
Hi ever= ybody,

I am running a Pos= tgreSQL server 8.3.5 with a pretty much standard config.
<= span style=3D"color: rgb(0, 0, 153);">
The web application server which runs Apache 1.3/PH= P2.9 =A0has an intermittent problem:
pg_connect takes exactly 3.0 se= conds. The usual connection time is 0.0045.
The long request happens at approximate rate 1:100= .

= I turned on logs on postgres server side, and there is nothing=A0suspicious= =A0for me there. When a connection request comes, it is being served withou= t any delay.=A0

= Could anyone point me to the direction in which I should investigate this p= roblem further?
Thank you in advan= ce!

=
PS The hardware is: Dell=A0SC= 1435/4Gb/2x2.0GHz/Gentoo Linux.
Th= e database & web servers are in the 2 local subnets.=A0

=
Dmitri.


--0016e6d7dfa70f7d3b047c81f102--