pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mindaugas Žakšauskas <mindas@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Establishing remote connections is slow
Date: Tue, 17 Jan 2012 10:09:42 -0500
Message-ID: <15697.1326812982@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKTEH83nqC5NBZjWJ2ZAW8eBMWjW3N6G3RhbsWy68rMgf=MF1Q@mail.gmail.com>
References: <CAKTEH83nqC5NBZjWJ2ZAW8eBMWjW3N6G3RhbsWy68rMgf=MF1Q@mail.gmail.com>

=?UTF-8?Q?Mindaugas_=C5=BDak=C5=A1auskas?= <mindas@gmail.com> writes:
> I have a very weird problem related to establishing remote connections
> to PostgreSQL server and hopefully someone can give me some hints how
> can I debug this.

> The essence is that establishing remote connection takes anywhere from
> 10 to 30 seconds. Once connected, the queries are fast - it's just
> establishing new connection that takes ages.

Perhaps the problem is related to authentication - what auth mode
are you using, and can you experiment with some other ones?

What I'd do to start debugging this is to get out a packet sniffer
(wireshark or some such) and just observe the timings of packets sent
and received by Postgres.  This would at least give you a hint which
step is the bottleneck.

> This problem is not
> applicable to establishing local connections: running psql command
> from the local machine takes no time to connect, same applies if a
> client connects to the PostgreSQL via ssh tunnel.

What about "psql -h localhost", ie physically local connection but
via TCP not unix socket?

			regards, tom lane



view thread (13+ messages)  latest in thread

Message-ID: <15697.1326812982@sss.pgh.pa.us>
Permalink:  ../15697.1326812982@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/15697.1326812982@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mindas@gmail.com
  Subject: Re: Establishing remote connections is slow
  In-Reply-To: <15697.1326812982@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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