pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Fuhr <mike@fuhr.org>
Cc: Merlin Moncure <merlin.moncure@rcsonline.com>
Cc: Carlos Benkendorf <carlosbenkendorf@yahoo.com.br>
Cc: PostgreSQL-patches <pgsql-patches@postgresql.org>
Subject: Re: Stats collector performance improvement
Date: Mon, 2 Jan 2006 14:13:47 -0500 (EST)
Message-ID: <200601021913.k02JDlh26741@candle.pha.pa.us> (raw)
In-Reply-To: <7838.1136227521@sss.pgh.pa.us>

Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > I found if I put a pg_usleep(100) in the buffer process the backend
> > speed was good, but packets were lost.  What I found worked well was to
> > do multiple recv() calls in a loop.  The previous code did a select(),
> > then perhaps a recv() and pipe write() based on the results of the
> > select().  This caused many small packets to be written to the pipe and
> > the pipe write overhead seems fairly large.  The best fix I found was to
> > loop over the recv() call at most 25 times, collecting a group of
> > packets that can then be sent to the collector in one pipe write.  The
> > recv() socket is non-blocking, so a zero return indicates there are no
> > more packets available.  Patch attached.
> 
> This seems incredibly OS-specific.  How many platforms did you test it
> on?

Only mine.  I am posting the patch so others can test it, of course.

> A more serious objection is that it will cause the stats machinery to
> work very poorly if there isn't a steady stream of incoming messages.
> You can't just sit on 24 messages until the 25th one arrives next week.

You wouldn't.  It exits out of the loop on a not found, checks the pipe
write descriptor, and writes on it.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



view thread (17+ messages)  latest in thread

Message-ID: <200601021913.k02JDlh26741@candle.pha.pa.us>
Permalink:  ../200601021913.k02JDlh26741@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200601021913.k02JDlh26741@candle.pha.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-performance@postgresql.org
  Cc: pgman@candle.pha.pa.us, tgl@sss.pgh.pa.us, mike@fuhr.org, merlin.moncure@rcsonline.com, carlosbenkendorf@yahoo.com.br, pgsql-patches@postgresql.org
  Subject: Re: Stats collector performance improvement
  In-Reply-To: <200601021913.k02JDlh26741@candle.pha.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