Re: Streaming Replication replay lag

From: Nikhil Shetty <nikhil(dot)dba04(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Streaming Replication replay lag
Date: 2020-11-25 05:32:35
Message-ID: CAFpL5VzpXfYc6fKJbT_+=_b5aFDXvyo1vyDWyG=c_gpH-wuP9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi Laurenz,

We don't have any queries running on the DR server so setting
"hot_standby=off" can be done and we will observe the WAL replay but ss
there a way to identify that replay lag is because of the queries running
on DR. I don't see any long running queries in pg_stat_activity to suggest
that queries are not allowing the replay to happen.

Thanks & Regards,
Nikhil

On Tue, Nov 24, 2020 at 9:35 PM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
wrote:

> On Tue, 2020-11-24 at 19:54 +0530, Nikhil Shetty wrote:
> > We have one Primary and three Standby Postgresql setup. Two standby in
> DC and one standby in DR.
> >
> > We have configured streaming replication.When there are a lot of write
> transactions
> > in the master, we observed that DR lags behind the master for 5-6
> hours. We initially
> > thought this could be because of the slow network between DC and DR and
> this is normal
> > but when we saw the replay_lsn and receive_lsn , they had a huge
> difference.
> >
> > DR standby was receiving the WAL's in time and there was no delay, the
> delay was in
> > replaying the lag. Can anybody point me to where I can start with the
> investigation?
> > DC (Master and 2 Standby) and DR(Standby) have the same setup in terms
> of storage
> > and some database configuration parameters but DR has a little less CPU
> and RAM.
>
> If there is a delay replaying WAL, the cause is probably a replication
> conflict.
>
> Set "hot_standby = off" on the standby to avoid the problem totally.
>
> If you want queries on the standby, set "max_standby_streaming_delay" to 0
> to keep replication from falling behind.
>
> Yours,
> Laurenz Albe
> --
> Cybertec | https://www.cybertec-postgresql.com
>
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Игорь Выскорко 2020-11-25 09:46:29 Hot standby with hot_standny_feedback enabled: cancelling statement issues
Previous Message Nikhil Shetty 2020-11-25 05:26:19 Re: Streaming Replication replay lag