pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter T. Breuer <ptb@inv.it.uc3m.es>
To: Alvaro Herrera <alvherre@commandprompt.com>
Cc: Peter T. Breuer <ptb@inv.it.uc3m.es>
Cc: Richard Huxton <dev@archonet.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: general PG network slowness (possible cure) (repost)
Date: Fri, 25 May 2007 17:06:10 +0200 (MET DST)
Message-ID: <200705251506.l4PF6AW08031@inv.it.uc3m.es> (raw)
In-Reply-To: <20070525141013.GC4239@alvh.no-ip.org>

"Also sprach Alvaro Herrera:"
> > I really think it would be worthwhile getting some developer to tell me
> > where the network send is done in PG.
> 
> See src/backend/libpq/pqcomm.c (particularly internal_flush()).

Yes. Thanks. That looks like it. It calls secure_write continually
until the buffer is empty.

Secure_write is located ibe-secure.c, but I'm not using ssl, so the 
call reduces to just

    n = send(port->sock, ptr, len, 0);

And definitely all those could be grouped if there are several to do.
But under normal circumstances the send will be pushing against a
lttle resistance (the copy to the driver/protocol stack buffer is faster
than the physical network send, by a ratio of GB/s to MB/s, or 1000 to
1), and thus all these sends will probably complete as a single unit
once they have been started.

It's worth a try.  I thought first this may be too low level, but it
looks as though internal_flush is only triggered when some other buffer
is full, or deliberately, so it may be useful to block until it fires.

I'll try it.


Peter



view thread (22+ messages)  latest in thread

Message-ID: <200705251506.l4PF6AW08031@inv.it.uc3m.es>
Permalink:  ../200705251506.l4PF6AW08031@inv.it.uc3m.es/
Also on:    postgresql.org/message-id/200705251506.l4PF6AW08031@inv.it.uc3m.es

 · 

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-performance@postgresql.org
  Cc: ptb@inv.it.uc3m.es, alvherre@commandprompt.com, dev@archonet.com
  Subject: Re: general PG network slowness (possible cure) (repost)
  In-Reply-To: <200705251506.l4PF6AW08031@inv.it.uc3m.es>

* 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