What should I expect when creating many logical replication slots?

From: Antonin Bas <antonin(dot)bas(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: What should I expect when creating many logical replication slots?
Date: 2024-01-12 00:17:32
Message-ID: CAAkB0aDof-atNom4qO_RGefgPDib3ukEzX1B9Tva11nusWMriA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I have a use case for which I am considering using Postgres Logical
Replication, but I would like to scale up to 100 or even 200
replication slots.

I have increased max_wal_senders and max_replication_slots to 100 (also
making sure that max_connections is large enough). Things seem to be
working pretty well so far based on some PoC code I have written. Postgres
is creating a walsender process for each replication slot, as expected, and
the memory footprint of each one is around 4MB.

So I am quite happy with the way things are working, but I am a bit uneasy
about increasing these configuration values by 10-20x compared to their
defaults (both max_wal_senders and max_replication_slots default to 10).

Is there anything I should be looking out for specifically? Is it
considered an anti-pattern to use that many replication slots and walsender
processes? And, when my database comes under heavy write load, will
walsender processes start consuming a large amount of CPU / memory (I
recognize that this is a vague question, I am still working on some
empirical testing).

Finally, I am currently using Postgres 14. Should I consider upgrading to
Postgres 15 or 16 based on my use case?

Thanks in advance for any insight on this.

Antonin

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim Nasby 2024-01-12 00:20:59 Re: Time zone offset in to_char()
Previous Message Jim Nasby 2024-01-12 00:15:41 Re: Refresh Materialized View Issue