Re: WaitLatchOrSocket optimization - Mailing list pgsql-hackers

From Andres Freund
Subject Re: WaitLatchOrSocket optimization
Date
Msg-id 20180315172514.tm47h4do4clfmif7@alap3.anarazel.de
Whole thread Raw
In response to WaitLatchOrSocket optimization  (Konstantin Knizhnik <k.knizhnik@postgrespro.ru>)
Responses Re: WaitLatchOrSocket optimization  (Konstantin Knizhnik <k.knizhnik@postgrespro.ru>)
List pgsql-hackers
Hi,

On 2018-03-15 19:01:40 +0300, Konstantin Knizhnik wrote:
> Right now function WaitLatchOrSocket is implemented in very inefficient way:
> for each invocation it creates epoll instance, registers events and then
> closes this instance.

Right, everything performance critical should be migrated to using a
persistent wait even set.


> But there are still lot of places in Postgres where WaitLatchOrSocket or
> WaitLatch are used.

Most don't matter performancewise though.



> There are two possible ways of fixing this issue:
> 1. Patch postgres_fdw to store WaitEventSet in connection.
> 2. Patch WaitLatchOrSocket to cache created wait event sets.

I'm strongly opposed to 2).  The lifetime of sockets will make this an
absolute mess, it'll potentially explode the number of open file
handles, and some OSs don't handle a large number of sets at the same
time.

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Chapman Flack
Date:
Subject: Re: worker_spi.naptime in worker_spi example
Next
From: Catalin Iacob
Date:
Subject: Re: JIT compiling with LLVM v11