Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJL47-0005tl-8P for pgsql-general@arkaria.postgresql.org; Tue, 31 Mar 2020 17:52:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jJL46-00008K-3E for pgsql-general@arkaria.postgresql.org; Tue, 31 Mar 2020 17:52:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJL45-00008D-Qh for pgsql-general@lists.postgresql.org; Tue, 31 Mar 2020 17:52:41 +0000 Received: from buffalo.birch.relay.mailchannels.net ([23.83.209.24]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJL3y-0004zs-Jl for pgsql-general@postgresql.org; Tue, 31 Mar 2020 17:52:41 +0000 X-Sender-Id: a2hosting|x-authuser|bench@silentmedia.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id C2C29360AB8 for ; Tue, 31 Mar 2020 17:52:30 +0000 (UTC) Received: from a2ss24.a2hosting.com (100-96-44-34.trex.outbound.svc.cluster.local [100.96.44.34]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id 33C923616E4 for ; Tue, 31 Mar 2020 17:52:30 +0000 (UTC) X-Sender-Id: a2hosting|x-authuser|bench@silentmedia.com Received: from a2ss24.a2hosting.com (a2ss24.a2hosting.com [75.98.175.117]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.6); Tue, 31 Mar 2020 17:52:30 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|bench@silentmedia.com X-MailChannels-Auth-Id: a2hosting X-Tart-Left: 67f0543c76a19d0b_1585677150560_4225546090 X-MC-Loop-Signature: 1585677150560:1318412233 X-MC-Ingress-Time: 1585677150559 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=silentmedia.com; s=default; h=Content-Type:MIME-Version:Date:Message-ID:To: Subject:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=WAArM7NMcRTQaqvVnVNHbvMjI1mf7al76x8or+m5ZcM=; b=T15E7HDFgSuDDP/v8nnjIuaX2f kV9ZaOSdddy/LKtDCD8gnjO1AG0hYTZeuJ7D4HsU16bH0v7a9rf8EaZP7hfu5ZS285AxXbPFGH5tV svINxDsUqnxAmOg/mliLVvGHnahTl3ZL215ovQtn0Stb/FQoGiVXpEsbeHVvw4P8EMyuxlmAXy17C eO4FSPnqu1bCylzg7WzC25st25krrKpTOyLchfgXXFhuwdIHAYZ05SFqNEjv5DXqf2hYi1cTLkxKi xqtjYb9zHe2UjZWmtt4jyrlQfyPsvX2IyCtXmelAgmG4s42RQGVXEPYUYEiYsxf6LekORfoCs8OCh akf5apww==; Received: from 75-172-24-182.tukw.qwest.net ([75.172.24.182]:49744 helo=Rolo.local) by a2ss24.a2hosting.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1jJL3t-00EuUL-3x for pgsql-general@postgresql.org; Tue, 31 Mar 2020 13:52:29 -0400 From: Ben Chobot Subject: streaming slaves can't keep up? To: pgsql-general@postgresql.org Message-ID: Date: Tue, 31 Mar 2020 10:52:27 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:52.0) Gecko/20100101 PostboxApp/7.0.12 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------E2CEEC7B951819AEDCD1E1FB" Content-Language: en-US X-AuthUser: bench@silentmedia.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------E2CEEC7B951819AEDCD1E1FB Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit We have a few busy 9.5 dbs, both streaming to a few slaves each. The master and slaves are identical hardware and are getting no small amount of load - about 45k transactions/s on the master and ~36k transactions/s on the slave actively serving clients. During these busy times, queries are all fairly responsive (mostly well under <1s) on both master and slave, and according to pg_stat_replication, replication is mostly good - the flush_location for all slaves seems quite up to date. But the replay_location on those busy slaves falls behind by quite a lot (over an hour behind), and this is a problem. On the slaves which aren't taking client load, their replay_location remains close to the flush_location. Does it make sense that the reason this is happening is because all those queries, which are quick but quite numerous, are causing the replay to slow down? If so, my hope is that we can simply throw more slaves at the problem, reducing the amount of queries and therefore allowing the replication to not get blocked as often. But if that theory is nonsense, I'm going to need a different solution. --------------E2CEEC7B951819AEDCD1E1FB Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit We have a few busy 9.5 dbs, both streaming to a few slaves each. The master and slaves are identical hardware and are getting no small amount of load - about 45k transactions/s on the master and ~36k transactions/s on the slave actively serving clients. During these busy times, queries are all fairly responsive (mostly well under <1s) on both master and slave, and according to pg_stat_replication, replication is mostly good - the flush_location for all slaves seems quite up to date. But the replay_location on those busy slaves falls behind by quite a lot (over an hour behind), and this is a problem. On the slaves which aren't taking client load, their replay_location remains close to the flush_location.

Does it make sense that the reason this is happening is because all those queries, which are quick but quite numerous, are causing the replay to slow down? If so, my hope is that we can simply throw more slaves at the problem, reducing the amount of queries and therefore allowing the replication to not get blocked as often. But if that theory is nonsense, I'm going to need a different solution.
--------------E2CEEC7B951819AEDCD1E1FB--