Skip site navigation (1) Skip section navigation (2)

Re: Establishing remote connections is slow

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mindaugas Žakšauskas <mindas(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Establishing remote connections is slow
Date: 2012-01-17 15:09:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
=?UTF-8?Q?Mindaugas_=C5=BDak=C5=A1auskas?= <mindas(at)gmail(dot)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

In response to


pgsql-admin by date

Next:From: Mindaugas ŽakšauskasDate: 2012-01-17 15:31:23
Subject: Re: Establishing remote connections is slow
Previous:From: Mindaugas ŽakšauskasDate: 2012-01-17 12:44:26
Subject: Establishing remote connections is slow

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group