Re: Estimated resources for a 500 connections instance (VM)

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: David Gauthier <davegauthierpg(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Estimated resources for a 500 connections instance (VM)
Date: 2020-04-07 20:32:39
Message-ID: 856ecfc2-de82-816b-9b9b-4bd6ae78e6a7@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrus 2020-04-07 21:56:30 Re: Performance degradation if query returns no rows and column expression is used after upgrading to 12
Previous Message Rob Sargent 2020-04-07 20:31:34 Re: Estimated resources for a 500 connections instance (VM)