PG12: Any drawback of increasing wal_keep_segments

Started by Shukla, Pranjalabout 4 years ago5 messagesgeneral
Jump to latest
#1Shukla, Pranjal
pshukla@akamai.com

Team,
Are there any disadvantages of increasing the “wal_keep_segments” to a higher number say, 500? Will it have any impact on performance of streaming replication, on primary or secondary servers?

Thanks & Regards
Pranjal Shukla

#2Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Shukla, Pranjal (#1)
Re: PG12: Any drawback of increasing wal_keep_segments

On 2022-Mar-22, Shukla, Pranjal wrote:

Team,
Are there any disadvantages of increasing the “wal_keep_segments” to a
higher number say, 500? Will it have any impact on performance of
streaming replication, on primary or secondary servers?

No. It just means WAL will occupy more disk space. I've seen people go
even as high as 5000 with no issues.

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/

#3Stephen Frost
sfrost@snowman.net
In reply to: Alvaro Herrera (#2)
Re: PG12: Any drawback of increasing wal_keep_segments

Greetings,

* Alvaro Herrera (alvherre@alvh.no-ip.org) wrote:

On 2022-Mar-22, Shukla, Pranjal wrote:

Are there any disadvantages of increasing the “wal_keep_segments” to a
higher number say, 500? Will it have any impact on performance of
streaming replication, on primary or secondary servers?

No. It just means WAL will occupy more disk space. I've seen people go
even as high as 5000 with no issues.

Yeah, though it makes the primary into essentially a WAL repository and,
really, you'd be better off having a dedicated repo that replicas can
pull from instead. Consider that a replica might fall way behind and
then demand the primary send 5000 WAL segments to it. The primary then
has to go pull that 80GB of data from disk and send it across the
network. As to if that's an issue or not depends on the IOPS and
bandwidth available, of course, but it's not free.

Thanks,

Stephen

#4Nick Renders
postgres@arcict.com
In reply to: Stephen Frost (#3)
Re: PG12: Any drawback of increasing wal_keep_segments

On 29 Mar 2022, at 17:17, Stephen Frost wrote:

Greetings,

* Alvaro Herrera (alvherre@alvh.no-ip.org) wrote:

On 2022-Mar-22, Shukla, Pranjal wrote:

Are there any disadvantages of increasing the
“wal_keep_segments” to a
higher number say, 500? Will it have any impact on performance of
streaming replication, on primary or secondary servers?

No. It just means WAL will occupy more disk space. I've seen people
go
even as high as 5000 with no issues.

Yeah, though it makes the primary into essentially a WAL repository
and,
really, you'd be better off having a dedicated repo that replicas can
pull from instead. Consider that a replica might fall way behind and
then demand the primary send 5000 WAL segments to it. The primary
then
has to go pull that 80GB of data from disk and send it across the
network. As to if that's an issue or not depends on the IOPS and
bandwidth available, of course, but it's not free.

Thanks,

Stephen

Hello Stephen,

How do you see a setup with a ‘a dedicated repo that replicas can pull
from’ ?

Thanks in advance for the clarification.

Marc

#5Stephen Frost
sfrost@snowman.net
In reply to: Nick Renders (#4)
Re: PG12: Any drawback of increasing wal_keep_segments

Greetings,

On Thu, Mar 31, 2022 at 12:58 Marc <postgres@arcict.com> wrote:

On 29 Mar 2022, at 17:17, Stephen Frost wrote:

Greetings,

- Alvaro Herrera (alvherre@alvh.no-ip.org) wrote:

On 2022-Mar-22, Shukla, Pranjal wrote:

Are there any disadvantages of increasing the “wal_keep_segments” to a
higher number say, 500? Will it have any impact on performance of
streaming replication, on primary or secondary servers?

No. It just means WAL will occupy more disk space. I've seen people go
even as high as 5000 with no issues.

Yeah, though it makes the primary into essentially a WAL repository and,
really, you'd be better off having a dedicated repo that replicas can
pull from instead. Consider that a replica might fall way behind and
then demand the primary send 5000 WAL segments to it. The primary then
has to go pull that 80GB of data from disk and send it across the
network. As to if that's an issue or not depends on the IOPS and
bandwidth available, of course, but it's not free.

Thanks,

Stephen

Hello Stephen,

How do you see a setup with a ‘a dedicated repo that replicas can pull
from’ ?

Thanks in advance for the clarification.

I’d suggest checking out pgbackrest. There are other options out there but
that’s my favorite (probably because I also am one of the folks involved in
its development, full disclosure).

Thanks,

Stephen

Show quoted text