Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: OpenSSH: Users

High latency when port-forwarding postgresql (for statements which don't return data)

 

 

OpenSSH users RSS feed   Index | Next | Previous | View Threaded


linuxhippy at gmail

Mar 22, 2011, 6:35 AM

Post #1 of 2 (2107 views)
Permalink
High latency when port-forwarding postgresql (for statements which don't return data)

Hi,

I experience a very strange problem, when using the jdbc driver with
ssh's local port forwarding:
ssh -v -L 4321:dbserver:5432 user [at] dbserve

SELECT statements show about the same latency as without
port-forwarding (and even decreased latency when compression is
enabled), but sometimes UPDATE/DELETE statements take seconds to
complete.
The other time they are as fast as they should be. When I connect to
postgres without port-forwarding the update statements consistently
take only a few milliseconds.

Any idea what the reason could be, I've tested it with two different
ssh clients (one java, and openssh) both show the same behaviour.
Could it be some buffering on the server side, to make data transfer
more efficient?
Could it be because selects usually send a lot of data back to the
client, buffering doesn't hurt - but for update/delete usually only a
acknoledgement is sent back and buffering starts to be an issue?

Thank you in advance, Clemens


Btw the java-based client seems to be waiting for data while it
executes the statements:

java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:129)
org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:135)
org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:104)
org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73)
org.postgresql.core.PGStream.ReceiveChar(PGStream.java:259)
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1620)
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
- locked org.postgresql.core.v3.QueryExecutorImpl [at] 17b168


amolarakh at yahoo

Mar 29, 2011, 11:32 PM

Post #2 of 2 (1980 views)
Permalink
Re: High latency when port-forwarding postgresql (for statements which don't return data) [In reply to]

Hi Clemens,
There are various scenarios for decreased latency.

1. Kindly check the host entry if dbserver is internal and not
communicating to Internet
2. Please traceroute/ use sniffer on forwarded port will give you exact
route followed.

Regards
Amol Arakh


On Tuesday 22 March 2011 07:05 PM, Clemens Eisserer wrote:
> Hi,
>
> I experience a very strange problem, when using the jdbc driver with
> ssh's local port forwarding:
> ssh -v -L 4321:dbserver:5432 user [at] dbserve
>
> SELECT statements show about the same latency as without
> port-forwarding (and even decreased latency when compression is
> enabled), but sometimes UPDATE/DELETE statements take seconds to
> complete.
> The other time they are as fast as they should be. When I connect to
> postgres without port-forwarding the update statements consistently
> take only a few milliseconds.
>
> Any idea what the reason could be, I've tested it with two different
> ssh clients (one java, and openssh) both show the same behaviour.
> Could it be some buffering on the server side, to make data transfer
> more efficient?
> Could it be because selects usually send a lot of data back to the
> client, buffering doesn't hurt - but for update/delete usually only a
> acknoledgement is sent back and buffering starts to be an issue?
>
> Thank you in advance, Clemens
>
>
> Btw the java-based client seems to be waiting for data while it
> executes the statements:
>
> java.net.SocketInputStream.socketRead0(Native Method)
> java.net.SocketInputStream.read(SocketInputStream.java:129)
> org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:135)
> org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:104)
> org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73)
> org.postgresql.core.PGStream.ReceiveChar(PGStream.java:259)
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1620)
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
> - locked org.postgresql.core.v3.QueryExecutorImpl [at] 17b168
>

OpenSSH users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.