From: Rob Sargent <robjsargent@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Estimated resources for a 500 connections instance (VM)
Date: Tue, 7 Apr 2020 14:31:34 -0600
Message-ID: <b508e3a1-c3b2-6556-7cff-1f71c43159ec@gmail.com> (raw)
In-Reply-To: <CAKyoTgZifzZg5ig_1tQmD-dd8kOEZ4w1WGRiLO52AaD0aP=esQ@mail.gmail.com>
References: <CAMBRECDfz6Zjzy0Bitf+WhKcYZ+j=rvJDe7JN5tZ8etu7E-J8Q@mail.gmail.com>
<3fd51f3222a35e227484afae34796d3f4f667567.camel@cybertec.at>
<CAMBRECC+1Z2bguc9cKnFUsJu2KoPeHjnr6P6NeqK1MRCZHoTOQ@mail.gmail.com>
<CAKyoTgZifzZg5ig_1tQmD-dd8kOEZ4w1WGRiLO52AaD0aP=esQ@mail.gmail.com>
On 4/7/20 2:23 PM, Sándor Daku wrote:
> On Tue, 7 Apr 2020 at 21:52, David Gauthier <davegauthierpg@gmail.com
> <mailto:davegauthierpg@gmail.com>> wrote:
>
> After looking at some of the factors that can affect this, I think
> it may be important to know that most of the connections will be
> almost idle (in terms of interacting with the DB). The "users"
> are perl/dbi scripts which connect to the DB and spend the vast
> majority of the time doing things other than interacting with the
> DB. So a connection is consumed, but it's not really working very
> hard with the DB per-se. I am cleaning up some of that code by
> strategically connecting/disconnecting only when a DB
> interaction is required. But for my edification, is it roughly
> true that 2 connections working with the DB 100% of the time is
> equivalent to 20 connections @ 10% = 200 connections @ 1 % (if you
> know what I mean) ?
>
>
> Hi,
>
> Every open connection consumes a bit of resources witch is not a big
> deal if you keeping open a few more connections than you strictly
> needed. However when you keeping a few hundred idle connections those
> resources add up quickly. So don't do that if it's possible.
> Likewise, establishing a new connection is resource costly process. So
> don't do that either if it's possible.
> Long story short, if those connections don't use many different users
> then(as others already suggested) connection pooling will be the best
> solution.
>
> Regards,
> Sándor
And from my experience pg_bouncer if very easy to include in your
stack. (If not tried pg_pool.)
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: robjsargent@gmail.com
Subject: Re: Estimated resources for a 500 connections instance (VM)
In-Reply-To: <b508e3a1-c3b2-6556-7cff-1f71c43159ec@gmail.com>
References: <CAMBRECDfz6Zjzy0Bitf+WhKcYZ+j=rvJDe7JN5tZ8etu7E-J8Q@mail.gmail.com> <3fd51f3222a35e227484afae34796d3f4f667567.camel@cybertec.at> <CAMBRECC+1Z2bguc9cKnFUsJu2KoPeHjnr6P6NeqK1MRCZHoTOQ@mail.gmail.com> <CAKyoTgZifzZg5ig_1tQmD-dd8kOEZ4w1WGRiLO52AaD0aP=esQ@mail.gmail.com> <b508e3a1-c3b2-6556-7cff-1f71c43159ec@gmail.com>
* 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