Re: Up to 50x degradation in dblink performance when receiving notice traffic 19 vs 18 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Up to 50x degradation in dblink performance when receiving notice traffic 19 vs 18
Date
Msg-id 1201635.1790109101@sss.pgh.pa.us
Whole thread
In response to Up to 50x degradation in dblink performance when receiving notice traffic 19 vs 18  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: Up to 50x degradation in dblink performance when receiving notice traffic 19 vs 18
List pgsql-hackers
Merlin Moncure <mmoncure@gmail.com> writes:
> Bisecting revealed the obvious culprit:
> 112faf1378ee: Log remote NOTICE, WARNING, and similar messages using
> ereport().

> The commit solves an obvious problem, and I do not think it should be
> reverted.  This does raise a couple of questions, however:
> * Is it really true that ereport() is up to 20x slower than stderr?
> * Why does stderr have such wierd performance variations?

I did a simple performance test, measuring tight loops around

        ereport(LOG,
                errmsg_internal("%s", my_string));

and

        fprintf(stderr, "%s\n", my_string);

For me, ereport is consistently about 3x slower than fprintf
when using bare log-to-a-file (logging_collector off), or about
2x slower when using the logging collector with default options.
That's more or less in line with what I'd expect.  So there's
something odd going on in your setup; where is log output going
exactly?

> * Why does dblink even bother with NOTICE level messages at all?  They are
> not produced at all to the receiving client, only to the hosting database
> log (which IMO is very non-intuitive).

I think the intent of 112faf137 was to get log message prefixes
attached to these messages without disturbing the pre-existing
behavior about what gets recorded where.  Maybe there's room for
a discussion about changing that, but since postgres_fdw has been
acting like that for a long time it might be a hard sell.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Adding a range check on the sequence index from the publisher.
Next
From: Vadim Ponomarev
Date:
Subject: Re: Reduce SyncRepLock contention on the commit path