From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Mark Moellering <markmoellering@psyberation.com>
To: Postgres General <pgsql-general@postgresql.org>
Subject: Re: db-connections (application architecture)
Date: Thu, 15 Nov 2018 07:15:56 -0800
Message-ID: <ae39ddce-c932-a9e4-14ce-bb9ef55b35c4@aklaver.com> (raw)
In-Reply-To: <CAA0uU3XTasTDfiSC-Q=TETWorpmAh_QTn3fBEegrKENb51-jLg@mail.gmail.com>
References: <CAA0uU3XTasTDfiSC-Q=TETWorpmAh_QTn3fBEegrKENb51-jLg@mail.gmail.com>
On 11/15/18 7:09 AM, Mark Moellering wrote:
> So, I am working on some system designs for a web application, and I
> wonder if there is any definitive answer on how to best connect to a
> postgres database.
>
> I could have it so that each time a query, or set of queries, for a
> particular request, needs to be run, a new connection is opened, queries
> are run, and then connection is closed / dropped.
>
> OR, I could create a persistent connection that will remain open as long
> as a user is logged in and then any queries are run against the open
> connection.
>
> I can see how, for only a few (hundreds to thousands) of users, the
> latter might make more sense but if I need to scale up to millions, I
> might not want all of those connections open.
>
> Any idea of how much time / overhead is added by opening and closing a
> connection everytime?
>
> Any and all information is welcome.
Connection pooling?
In no particular order:
https://pgbouncer.github.io/http://www.pgpool.net/mediawiki/index.php/Main_Page>
> Thanks in advance
>
> -- Mark M
--
Adrian Klaver
adrian.klaver@aklaver.com
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: adrian.klaver@aklaver.com, markmoellering@psyberation.com
Subject: Re: db-connections (application architecture)
In-Reply-To: <ae39ddce-c932-a9e4-14ce-bb9ef55b35c4@aklaver.com>
References: <CAA0uU3XTasTDfiSC-Q=TETWorpmAh_QTn3fBEegrKENb51-jLg@mail.gmail.com> <ae39ddce-c932-a9e4-14ce-bb9ef55b35c4@aklaver.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