Re: Performance monitor signal handler - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Performance monitor signal handler
Date
Msg-id 19724.985019304@sss.pgh.pa.us
Whole thread Raw
In response to Performance monitor signal handler  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Performance monitor signal handler  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Only shared memory gives us near-zero cost for write/read.  99% of
> backends will not be using stats, so it has to be cheap.

Not with a circular buffer it's not cheap, because you need interlocking
on writes.  Your claim that you can get away without that is simply
false.  You won't just get lost messages, you'll get corrupted messages.

> The collector program can read the shared memory stats and keep hashed
> values of accumulated stats.  It uses the "Loops" variable to know if it
> has read the current information in the buffer.

And how does it sleep until the counter has been advanced?  Seems to me
it has to busy-wait (bad) or sleep (worse; if the minimum sleep delay
is 10 ms then it's guaranteed to miss a lot of data under load).
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: new version of contrib-intarray
Next
From: Tom Lane
Date:
Subject: Re: New version of contrib-intarray is ready !