pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Rory Falloon <rfalloon@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Dealing with latency to replication slave; what to do?
Date: Tue, 24 Jul 2018 13:02:13 -0700
Message-ID: <20180724200213.r7kdsmferazxr6ps@alap3.anarazel.de> (raw)
In-Reply-To: <CANP_6+NnvGQtChT8HPDDpdHW-yt-OHjNdQk9nPY2iUoOs6qRKw@mail.gmail.com>
References: <CANP_6+NnvGQtChT8HPDDpdHW-yt-OHjNdQk9nPY2iUoOs6qRKw@mail.gmail.com>

Hi,

On 2018-07-24 15:39:32 -0400, Rory Falloon wrote:
> Looking for any tips here on how to best maintain a replication slave which
> is operating under some latency between networks - around 230ms. On a good
> day/week, replication will keep up for a number of days, but however, when
> the link is under higher than average usage, keeping replication active can
> last merely minutes before falling behind again.
> 
> 2018-07-24 18:46:14 GMTLOG:  database system is ready to accept read only
> connections
> 2018-07-24 18:46:15 GMTLOG:  started streaming WAL from primary at
> 2B/93000000 on timeline 1
> 2018-07-24 18:59:28 GMTLOG:  incomplete startup packet
> 2018-07-24 19:15:36 GMTLOG:  incomplete startup packet
> 2018-07-24 19:15:36 GMTLOG:  incomplete startup packet
> 2018-07-24 19:15:37 GMTLOG:  incomplete startup packet
> 
> As you can see above, it lasted about half an hour before falling out of
> sync.

How can we see that from the above? The "incomplete startup messages"
are independent of streaming rep? I think you need to show us more logs.


> On the master, I have wal_keep_segments=128. What is happening when I see
> "incomplete startup packet" - is it simply the slave has fallen behind,
> and  cannot 'catch up' using the wal segments quick enough? I assume the
> slave is using the wal segments to replay changes and assuming there are
> enough wal segments to cover the period it cannot stream properly, it will
> eventually recover?

You might want to look into replication slots to ensure the primary
keeps the necessary segments, but not more, around.  You might also want
to look at wal_compression, to reduce the bandwidth usage.

Greetings,

Andres Freund




view thread (4+ messages)  latest in thread

Message-ID: <20180724200213.r7kdsmferazxr6ps@alap3.anarazel.de>
Permalink:  ../20180724200213.r7kdsmferazxr6ps@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20180724200213.r7kdsmferazxr6ps@alap3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: andres@anarazel.de, rfalloon@gmail.com
  Subject: Re: Dealing with latency to replication slave; what to do?
  In-Reply-To: <20180724200213.r7kdsmferazxr6ps@alap3.anarazel.de>
  References: <CANP_6+NnvGQtChT8HPDDpdHW-yt-OHjNdQk9nPY2iUoOs6qRKw@mail.gmail.com> <20180724200213.r7kdsmferazxr6ps@alap3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox