From: Gavan Schneider <list.pg.gavan@pendari.org>
To: pgsql-general@lists.postgresql.org
Cc: Atul Kumar <akumar14871@gmail.com>
Cc: Ron <ronljohnsonjr@gmail.com>
Cc: Rob Sargent <robjsargent@gmail.com>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Ravi Krishna <rkrishna_pg@aol.com>
Subject: Re: vacuumdb not letting me connect to db
Date: Sat, 06 Feb 2021 10:14:43 +1100
Message-ID: <2FF4F45A-01AA-4AC5-9EFA-8CE6DCADA9C8@pendari.org> (raw)
In-Reply-To: <7e35e59f-364a-eb98-43ac-6c927d8757b4@gmail.com>
References: <CA+ONtZ7hmwQn+6+fGqSbo_RXE7MBeV=OR86LpG57xRvOerWfag@mail.gmail.com>
<b5c8a7b5a1b90443051c9158970420c1113fd751.camel@cybertec.at>
<CA+ONtZ7L54XXOq4_ZgkTRCP2VGdc-1q4aTTEADaUjkg9ZC6jaA@mail.gmail.com>
<367051164.1780361.1612460095810@mail.yahoo.com>
<CA+ONtZ50t+T-RPYS-QwZx2-L+Rd9PNEniz6CqV_uOab1teRpjQ@mail.gmail.com>
<9645df52-2cdc-9e9e-b43c-d388c1aa7951@gmail.com>
<CA+ONtZ5VcPA1s5fuHb6+x4W_Nv9SrFdtDG+H3OKAiSLHgn-7Yw@mail.gmail.com>
<a988e21a-7f1c-8480-235a-1c5cf7ba6b3c@gmail.com>
<0f3e4fa7-b028-f277-b3d2-114731a6c223@gmail.com>
<7e35e59f-364a-eb98-43ac-6c927d8757b4@gmail.com>
On 6 Feb 2021, at 3:37, Ron wrote:
> On 2/5/21 10:22 AM, Rob Sargent wrote:
>>
>>
>> On 2/5/21 9:11 AM, Ron wrote:
>>> Obviously... don't use 300 threads.
>>>
>> No, no Ron. Clearly the answer is more CPUs
>
> I hope you're being sarcastic.
>
A reasonable conjecture… though there is the consideration that 300
CPU intensive tasks spread across a given number of CPUs is going to
waste some resources with context switching., i.e., need more CPUs :)
Basically if there is plenty of wait time for I/O completion then CPU
task switching can get more total work done. So far so obvious. In this
thread I can see where it is disappointing to have a system considered
capable of 700 connections getting saturated by a “mere” 300
threads. But this is only a “problem” if connections are equated to
threads. PG max connection count is about external users having access
to resources needed to get a task done. Like all resource allocations
this relies on estimated average usage, i.e., each connection only asks
for a lot of CPU in brief bursts and then the result is transmitted with
a time lag before the connection makes another CPU demand. The system
designer should use estimations about usage and load to budget and
configure the system, and, monitor it all against actual performance in
the real world. Of course estimates are a standing request for outliers
and the system will show stress under an unexpected load.
So far I have not seen an analysis of where the bottle neck has
occurred: CPU RAM HD and/or the data bus connecting these. Some of these
hardware resources maxed out to the extent the system would not
immediately pick up an additional work unit. As I see it OP started 300
CPU intensive tasks on hardware intended for 700 connections. If the
connection count was designed with say 50% CPU intensive time per
connection you would expect this hardware to be fully saturated with 300
CPU intensive tasks. More than that, doing the task with 300 threads
would probably take longer than (say) 200 threads as the increased CPU
context swapping time is just wasted effort.
OP now has a choice: decrease threads or (seriously) upgrade the
hardware. We in the gallery would love to see a plot of total time to
completion as a function of threads invoked (50-300 increments of 50)
assuming the starting conditions are the same :)
Gavan Schneider
——
Gavan Schneider, Sodwalls, NSW, Australia
Explanations exist; they have existed for all time; there is always a
well-known solution to every human problem — neat, plausible, and
wrong.
— H. L. Mencken, 1920
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: list.pg.gavan@pendari.org, akumar14871@gmail.com, ronljohnsonjr@gmail.com, robjsargent@gmail.com, laurenz.albe@cybertec.at, rkrishna_pg@aol.com
Subject: Re: vacuumdb not letting me connect to db
In-Reply-To: <2FF4F45A-01AA-4AC5-9EFA-8CE6DCADA9C8@pendari.org>
References: <CA+ONtZ7hmwQn+6+fGqSbo_RXE7MBeV=OR86LpG57xRvOerWfag@mail.gmail.com> <b5c8a7b5a1b90443051c9158970420c1113fd751.camel@cybertec.at> <CA+ONtZ7L54XXOq4_ZgkTRCP2VGdc-1q4aTTEADaUjkg9ZC6jaA@mail.gmail.com> <367051164.1780361.1612460095810@mail.yahoo.com> <CA+ONtZ50t+T-RPYS-QwZx2-L+Rd9PNEniz6CqV_uOab1teRpjQ@mail.gmail.com> <9645df52-2cdc-9e9e-b43c-d388c1aa7951@gmail.com> <CA+ONtZ5VcPA1s5fuHb6+x4W_Nv9SrFdtDG+H3OKAiSLHgn-7Yw@mail.gmail.com> <a988e21a-7f1c-8480-235a-1c5cf7ba6b3c@gmail.com> <0f3e4fa7-b028-f277-b3d2-114731a6c223@gmail.com> <7e35e59f-364a-eb98-43ac-6c927d8757b4@gmail.com> <2FF4F45A-01AA-4AC5-9EFA-8CE6DCADA9C8@pendari.org>
* 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