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 1jnYkj-0001YB-9x for pgsql-novice@arkaria.postgresql.org; Tue, 23 Jun 2020 02:33:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jnYkC-00078E-Pg for pgsql-novice@arkaria.postgresql.org; Tue, 23 Jun 2020 02:33:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jnYkC-00075z-Is for pgsql-novice@lists.postgresql.org; Tue, 23 Jun 2020 02:33:04 +0000 Received: from mail-qt1-x82b.google.com ([2607:f8b0:4864:20::82b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jnYk6-0006Rw-G7 for pgsql-novice@postgresql.org; Tue, 23 Jun 2020 02:33:03 +0000 Received: by mail-qt1-x82b.google.com with SMTP id x62so10970402qtd.3 for ; Mon, 22 Jun 2020 19:32:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=pXGq31wzMBh8VXtHeW1A76P0SIyktNnuHNBnGwBDKFg=; b=clZsoZ4RkbvpB13IlD3k/5H2R6IQ39qtS/wqRyi03susx4E75uX2xvz+hdeQ9MqjcS NH3FcNPy6WuJACrh7mNhzRD4eaRJPFt5UwI6eCrbZXzhGt/ePygq5/T9wXnju4l8qgUL 2qUFyAvIz7uqFXrUG5bZbgjytCg7F2y9jfn/O7tMVU5aCIRMkDIm6dOEpPy6/qz/se5Y L3zWWpRmqFYUibg46DqlMJjsuBkdxjmBwo0Y2rUH38DN0Ez1Z4txBgrgiVw0hvglzpEi /iiR0qesa0n05gHhSje8wfoeO/8tJHrOOMtezQ7iWgOoqwzW4eAeJMUhQmjMsTI+hgra LlIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=pXGq31wzMBh8VXtHeW1A76P0SIyktNnuHNBnGwBDKFg=; b=a6qTsV6qQekIdg0f+pPDCKaPhfhACQNy0FDPwiRqMEjwhS6m0LigekcXf8X1nrIj+i vNAGX0UM6V2wxzzmUJJibZoA7xNf8oN+a8mK2V4sl0yIAeCd4AC2KrPGfb62ke6vV/7J 5cljOlzcd3ZPYxnAuqDubgUAnIQ52CFKWv6hNRR9TceAsNOhT2WaldJ66dLQDQWWSa3i 19wIClUpet15efc5onzArMB0D8SMxgWw3Ptgr3I2dHhWD6EIsJIGVGUNsD8oE3maeWvf V0Ea08gAP3tAWOQYCbYpODjQ7Bs0Tr12mGwvxl+/leZJIdOS0hQGdgPC71KhWXcTQDUI 14SA== X-Gm-Message-State: AOAM532XcDVq4M42ZVDhPhrrQAJMiWG7vzyNy45TrueNYCB6Y93vYn+m DkqmZzAldKLBuvcLTQkWvIQ= X-Google-Smtp-Source: ABdhPJzpWVOwemzjJB0qadTYy0g1p84SUh9LuUt8cqc+5A8awysQHxpNTy0quy6xGXJawxCzi618rQ== X-Received: by 2002:ac8:4cc9:: with SMTP id l9mr5609333qtv.59.1592879577566; Mon, 22 Jun 2020 19:32:57 -0700 (PDT) Received: from [192.168.1.4] (pints.com. [206.248.184.17]) by smtp.gmail.com with ESMTPSA id i10sm10808815qkn.126.2020.06.22.19.32.56 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Mon, 22 Jun 2020 19:32:57 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: Connections Increasing Slowly From: "Bee.Lists" In-Reply-To: <2114531.1592878045@sss.pgh.pa.us> Date: Mon, 22 Jun 2020 22:32:56 -0400 Cc: Submit Postgresql Novice Content-Transfer-Encoding: quoted-printable Message-Id: <889C9020-88AF-4254-B9D2-D515C4298DAD@gmail.com> References: <8A1234E2-D4C3-451F-8F60-901D0D5E0CA5@gmail.com> <2088230.1592856708@sss.pgh.pa.us> <0345AEA7-346C-452F-B3AE-13ED57818F5F@gmail.com> <2114531.1592878045@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3124) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Jun 22, 2020, at 10:07 PM, Tom Lane wrote: >=20 > Hmm. If the client thinks the server dropped the connection, but the > server thinks the connection is still live, that smells strongly of > network-level disconnects. Does the client let the connection sit = idle > for more than a minute or two at a time? If so I'd bet that some = firewall > in between is deciding that the connection is dead and dropping it. > Again, setting the server's tcp_keepalives_* settings could help fix = that, > by ensuring that the network connection sees some traffic regularly. The gem says it used something in the connection pool. Then it says the = server dropped it. Like I said, I=E2=80=99m not clear who owns the = connections or the connection pool, as the pool can be outdated. = There=E2=80=99s a check in the gem to check the connection pool for = valid connections, over a set amount of time (it=E2=80=99s variable and = I can change it, but it does add overhead). I think that default is 60 = minutes. =20 The client (this gem) throws an error. I don=E2=80=99t think any = firewall is on this server that I know of. =20 Note: This error shows up first thing in the morning sometimes. I=E2=80=99= ve not had it in about a week now. I have reduced the max_connections = to 30, and the connections are now at 4. I have a bunch of queries on = the top page (it=E2=80=99s a dashboard) and it just increased from 2 to = 4. I just set the tcp_keepalives_* to around 3, so we=E2=80=99ll see = what=E2=80=99s going on. Another page request has connections up to 8: select datid, datname, numbackends, xact_commit, stats_reset from = pg_stat_database where datname in (=E2=80=98mydatabase') Cheers, Bee