Re: Remote access to Postgresql slow - Mailing list pgsql-performance

From Andrew Barnham
Subject Re: Remote access to Postgresql slow
Date
Msg-id CAC9_YpZ5xg+naNMVyTJ1wEHXBBcXmrmZrQJwyzSxxu3s6=34Ww@mail.gmail.com
Whole thread Raw
In response to Remote access to Postgresql slow  ("Manoj Agarwal" <ma@ockham.be>)
List pgsql-performance
Is your network link between server and client across the public internet? 

You need to check bandwidth and latency characteristics of your network.

A simple test run following on server host and run it again on the client host.

time psql [connect details] -c 'select now()'

I access postgresql database across the public internet (by tunnelling port 5432 across compressed ssh sessions). In my case latency is a significant penalty.  Locally time response is for above is <10ms but remotely it is 30 times slower (350ms)

You may need to install wireshark or similar and monitor client traffic in order to figure out the network penalty.  Maybe your app goes back and forward to postgres multiple time;  does lots of chatter. If so then latency cost becomes very significant. You want to try and minimise the number of postgresql calls; retrieve more data will less SQL operations. 



On Fri, Sep 14, 2012 at 7:02 PM, Manoj Agarwal <ma@ockham.be> wrote:

Hi,

I have a Centos 6.2 Virtual machine that contains Postgresql version 8.4 database. The application installed in this Virtual machine uses this database that is local to this Virtual machine.  I have tried to offload the database, by installing it on a remote Virtual machine, on another server, and tried to connect to it from my local Virtual machine. The application configuration remains the same, only database is offloaded to a remote Virtual machine on another server and the connection parameters have changed.  The connection is all fine and the application can access the remote database.

I have observed that the Postgresql is responding extremely slow.  What should I do to improve its performance?

Please suggest.


Kind Regards,
Manoj Agarwal
   


pgsql-performance by date:

Previous
From: "Manoj Agarwal"
Date:
Subject: Remote access to Postgresql slow
Next
From: Scott Marlowe
Date:
Subject: Re: Remote access to Postgresql slow