pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: David Gauthier <davegauthierpg@gmail.com>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Postgres General <pgsql-general@postgresql.org>
Subject: Re: Estimated resources for a 500 connections instance (VM)
Date: Tue, 7 Apr 2020 13:32:39 -0700
Message-ID: <856ecfc2-de82-816b-9b9b-4bd6ae78e6a7@aklaver.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>

On 4/7/20 12:51 PM, David Gauthier 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) ?

Well to get a sense of the load you could use top, with in top:

1) Hitting u key and entering postgres as user

2) Hitting c key to get full command line

That should result in something like(though formatted better):

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ 
COMMAND 

   978 postgres  20   0   72072   7688   6548 S 0.000 0.096   0:00.04 
/usr/lib/systemd/systemd --user 

   981 postgres  20   0  117124   2704     52 S 0.000 0.034   0:00.00 
(sd-pam) 

  1201 postgres  20   0  184292  20396  19520 S 0.000 0.254   0:01.19 
/usr/local/pgsql12/bin/postmaster -D /usr/local/pgsql12/data 

  1255 postgres  20   0   38364   4192   3332 S 0.000 0.052   0:00.00 
postgres: logger 

  1263 postgres  20   0  184408   5916   5016 S 0.000 0.074   0:00.00 
postgres: checkpointer 

  1264 postgres  20   0  184424   5520   4640 S 0.000 0.069   0:00.18 
postgres: background writer 

  1265 postgres  20   0  184292   9500   8620 S 0.000 0.118   0:00.18 
postgres: walwriter 

  1266 postgres  20   0  185116   7756   6520 S 0.000 0.096   0:01.32 
postgres: autovacuum launcher 

  1267 postgres  20   0   39488   5316   3780 S 0.000 0.066   0:02.86 
postgres: stats collector 

  1268 postgres  20   0  184844   6064   4980 S 0.000 0.075   0:00.00 
postgres: logical replication launcher 

14478 postgres  20   0  185252   9612   8184 S 0.000 0.119   0:00.00 
postgres: postgres production [local] idle 

14507 postgres  20   0  185348  11380   9848 S 0.000 0.141   0:00.00 
postgres: aklaver task_manager ::1(45202) idle


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (9+ messages)  latest in thread

Message-ID: <856ecfc2-de82-816b-9b9b-4bd6ae78e6a7@aklaver.com>
Permalink:  ../856ecfc2-de82-816b-9b9b-4bd6ae78e6a7@aklaver.com/
Also on:    postgresql.org/message-id/856ecfc2-de82-816b-9b9b-4bd6ae78e6a7@aklaver.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: adrian.klaver@aklaver.com, davegauthierpg@gmail.com, laurenz.albe@cybertec.at
  Subject: Re: Estimated resources for a 500 connections instance (VM)
  In-Reply-To: <856ecfc2-de82-816b-9b9b-4bd6ae78e6a7@aklaver.com>
  References: <CAMBRECDfz6Zjzy0Bitf+WhKcYZ+j=rvJDe7JN5tZ8etu7E-J8Q@mail.gmail.com> <3fd51f3222a35e227484afae34796d3f4f667567.camel@cybertec.at> <CAMBRECC+1Z2bguc9cKnFUsJu2KoPeHjnr6P6NeqK1MRCZHoTOQ@mail.gmail.com> <856ecfc2-de82-816b-9b9b-4bd6ae78e6a7@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