Re: Estimated resources for a 500 connections instance (VM) - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Estimated resources for a 500 connections instance (VM)
Date
Msg-id 856ecfc2-de82-816b-9b9b-4bd6ae78e6a7@aklaver.com
Whole thread Raw
In response to Re: Estimated resources for a 500 connections instance (VM)  (David Gauthier <davegauthierpg@gmail.com>)
List pgsql-general
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



pgsql-general by date:

Previous
From: Rob Sargent
Date:
Subject: Re: Estimated resources for a 500 connections instance (VM)
Next
From: "Andrus"
Date:
Subject: Re: Performance degradation if query returns no rows and column expression is used after upgrading to 12