调试 Postgres 'too many notifications in the NOTIFY queue'

Debug Postgres 'too many notifications in the NOTIFY queue'

我正在使用每秒更新 2000-3000 次的 Postgres table。 我正在使用 pg-promise 库的更新助手生成的 table 查询进行更新。

每次更新都会触发一个带有 pg_notify() 函数的通知。一些 nodejs 脚本正在处理这些通知。出于某种原因,在 Postgres 日志中不断出现 'too many notifications in the NOTIFY queue' 消息以及有关通知队列大小的指示,该大小不断增加到 100%。 我读了一些帖子,例如:https://postgrespro.com/list/thread-id/1557124https://github.com/hasura/graphql-engine/issues/6263 但我找不到调试此问题的方法。 处理这种情况的好方法是什么?

您的听众似乎没有足够快地使用通知,或者可能根本没有。因此,第一步是记录应用程序代码中每个通知的处理过程,以弄清楚实际发生了什么。