Re: LISTEN NOTIFY sometimes huge delay

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: LISTEN NOTIFY sometimes huge delay
Дата
Msg-id 21909.1651163915@sss.pgh.pa.us
обсуждение исходный текст
Ответ на LISTEN NOTIFY sometimes huge delay  ("Peter Eser HEUFT [Germany]" <peter.eser@heuft.com>)
Список pgsql-performance
"Peter Eser HEUFT [Germany]" <peter.eser@heuft.com> writes:
> I have a table with time series data and on this table a trigger for 
> notifies:
> containers_notify AFTER INSERT ON containers FOR EACH ROW EXECUTE 
> PROCEDURE containers_notify('containers_notify_collector')
> and the function does:
> PERFORM pg_notify(CAST(TG_ARGV[0] AS text), row_to_json(NEW)::text);

> This works as a charm but occasionally (I think with more load on the 
> system) the notifications are received much time (up to hours!) after 
> the INSERTs.
> Nevertheless no notifications become lost, they are only very late! The 
> delay grows, seems as a queue grows, but the java process tries to fetch 
> the notifications fairly fast,

Hm.  We've not previously had reports of late notifications.  One idea
that comes to mind is that the server won't deliver notifications as
long as the client has an open transaction, so is it possible your
listening process sometimes forgets to close its transaction?

> Versions:
> PostgreSQL 10.12 on x86_64-pc-linux-gnu, compiled by 
> x86_64-pc-linux-gnu-gcc (Gentoo 6.4.0-r1 p1.3) 6.4.0, 64-bit
> JDBC 42.2.23

That's pretty old.  We've made a number of changes to the LISTEN/NOTIFY
code since then; although in reading the commit log entries about them,
nothing is said about long-delayed notifications.

            regards, tom lane



В списке pgsql-performance по дате отправления:

Предыдущее
От: "Peter Eser HEUFT [Germany]"
Дата:
Сообщение: LISTEN NOTIFY sometimes huge delay
Следующее
От: aditya desai
Дата:
Сообщение: FATAL: canceling authentication due to timeout