pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Cross <theophilusx@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Estimated resources for a 500 connections instance (VM)
Date: Wed, 08 Apr 2020 06:31:14 +1000
Message-ID: <877dyr6nsd.fsf@gmail.com> (raw)
In-Reply-To: <CAMBRECC+1Z2bguc9cKnFUsJu2KoPeHjnr6P6NeqK1MRCZHoTOQ@mail.gmail.com>
References: <CAMBRECDfz6Zjzy0Bitf+WhKcYZ+j=rvJDe7JN5tZ8etu7E-J8Q@mail.gmail.com>
	<3fd51f3222a35e227484afae34796d3f4f667567.camel@cybertec.at>
	<CAMBRECC+1Z2bguc9cKnFUsJu2KoPeHjnr6P6NeqK1MRCZHoTOQ@mail.gmail.com>


David Gauthier <davegauthierpg@gmail.com> writes:

> 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) ?

Based on that additional info, I would definitely follow Laurenz's
suggestion. Long time since I used Perl DBI, but I'm pretty sure there
is is support for connection pools or you can use one of the PG
connection pooling solutions.

There is a fixed memory allocation per connection, so 2 connections at
100% is not the same as 20 connections @ 10%.

Using a connection pool is usually the first thing I will setup. If
additional connections are still required, then I would increase the
limit in small jumps - definitely would not go from 100 to 500.

BTW running PG on a virtual is not an issue in itself - this is very
common these days. However, I would ensure you are up-to-date wrt latest
minor release for that version and would use clients with the same
version as the master. 

-- 
Tim Cross





view thread (9+ messages)  latest in thread

Message-ID: <877dyr6nsd.fsf@gmail.com>
Permalink:  ../877dyr6nsd.fsf@gmail.com/
Also on:    postgresql.org/message-id/877dyr6nsd.fsf@gmail.com

 · 

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: theophilusx@gmail.com
  Subject: Re: Estimated resources for a 500 connections instance (VM)
  In-Reply-To: <877dyr6nsd.fsf@gmail.com>
  References: <CAMBRECDfz6Zjzy0Bitf+WhKcYZ+j=rvJDe7JN5tZ8etu7E-J8Q@mail.gmail.com> <3fd51f3222a35e227484afae34796d3f4f667567.camel@cybertec.at> <CAMBRECC+1Z2bguc9cKnFUsJu2KoPeHjnr6P6NeqK1MRCZHoTOQ@mail.gmail.com> <877dyr6nsd.fsf@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