Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l8AKV-00038o-82 for pgsql-general@arkaria.postgresql.org; Fri, 05 Feb 2021 23:15:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l8AKS-0002ME-SB for pgsql-general@arkaria.postgresql.org; Fri, 05 Feb 2021 23:15:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l8AKS-0002M7-0w for pgsql-general@lists.postgresql.org; Fri, 05 Feb 2021 23:15:56 +0000 Received: from out2-40.antispamcloud.com ([185.201.17.40]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l8AKN-0005dL-DB for pgsql-general@lists.postgresql.org; Fri, 05 Feb 2021 23:15:55 +0000 Received: from hp309.hostpapa.com ([69.90.160.170]) by mx133.antispamcloud.com with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1l8AKG-000SQX-B8; Sat, 06 Feb 2021 00:15:48 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pendari.org ; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References :In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=WVRODg+JL2B75BV+O4vyDrRW4vGu4bEPlaKPSd9wDwU=; b=Ylb3+A2APgsz9lB2DR7TjcIAjr 0NkyeMF/8uJN1Lh89xcULTt7QW3MRQ0SIgWgpJXMwGnaCHSiyQFgJSNdhx4PhFnXoqes0+yAvZCiR vDzcjglJA6jYe2UZ6ju1VJR7ppZ9v/Y57Q4vLomesj7EIYoMHmmHTG+EMhHDj+KaQZiGdUYZiPQdA Y0UZGAnY7ieTZJEq0oQuMA/m4dDGf4ePe7bz//STl2Bt93aBr+8p2j0Efc0CVdW3N3II6yNeUjsGm XiAk6AB/AiDyDrpwJkuTnPP4wPYZFHc31IBvqV8YNx/y9DETks3lmb8FJEEy06ES1ZgoGKSxME2Lp /5veS7fw==; Received: from [1.129.156.142] (port=8837 helo=[192.168.20.53]) by hp309.hostpapa.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1l8AJX-009MhP-EI; Sat, 06 Feb 2021 10:15:00 +1100 From: "Gavan Schneider" To: pgsql-general@lists.postgresql.org Cc: "Atul Kumar" , Ron , "Rob Sargent" , "Laurenz Albe" , "Ravi Krishna" Subject: Re: vacuumdb not letting me connect to db Date: Sat, 06 Feb 2021 10:14:43 +1100 X-Mailer: MailMate (1.14r5757) Message-ID: <2FF4F45A-01AA-4AC5-9EFA-8CE6DCADA9C8@pendari.org> In-Reply-To: <7e35e59f-364a-eb98-43ac-6c927d8757b4@gmail.com> References: <367051164.1780361.1612460095810@mail.yahoo.com> <9645df52-2cdc-9e9e-b43c-d388c1aa7951@gmail.com> <0f3e4fa7-b028-f277-b3d2-114731a6c223@gmail.com> <7e35e59f-364a-eb98-43ac-6c927d8757b4@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-OutGoing-Spam-Status: No, score=-1.0 X-Get-Message-Sender-Via: hp309.hostpapa.com: authenticated_id: list.pg.gavan@pendari.org X-Authenticated-Sender: hp309.hostpapa.com: list.pg.gavan@pendari.org X-AuthUser: list.pg.gavan@pendari.org X-Originating-IP: 69.90.160.170 X-Spampanel-Domain: outgoing-shared.hostpapa.com X-Spampanel-Username: outgoingshared Authentication-Results: antispamcloud.com; auth=pass (login) smtp.auth=outgoingshared@outgoing-shared.hostpapa.com X-Spampanel-Outgoing-Class: unsure X-Spampanel-Outgoing-Evidence: Combined (0.24) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT9Liybz23Q78Jv2R5ac/heVPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5yRbHyHSrE6+xwYeRdbKCaJY9h0u/mcVM+/W7gGibTeyLl+ Hq+cvZRwwhUqYOtcvTN85LLgDoIytHJo22k72F7UPhXGkzn5vE9i7nXGdyx2Ki2fxLFK4MFu8IPl smrnU6opKEB9DicY2VBNslyjZdb1VQD7HE+is0c5Opz4VYXGpJ5qACNAgtH3chPjsaGmUubU0+kR IIWY5P/X0jOv7NKe3Pqwq7RYBHd0Ejk0RFaFj0orRk4lhyrLaUJFxSTu7+Jaa40DxZPJuLUk3zkV Kd8ppBMh+yq0/fmSpuTh9MlwVaJagvjSIWy5J6yycIo8TrtLMvXCXtHpzldqol3CqNVdBcTaduYw ulQTLJz9aeZvqvu2k2MGW42a88jDQWq+wmeK5zfaEIJp1rUvlORAl50D7xhxOmMPhf/svs68nDk0 Bo4YcascUGwJuDTnOL/160J3P2Mfz7S8DadN3ANXu8f6PNmuNlQWM9BfmavGk1YWj3bln0miWBLR +Z9ARCfnU1YmY7iFmspqvStPcW7RuFVD+lkjW2uStq2/To6fV0uiwyKVCaFKQz0cjGKQ/NJF0y3t jqSkydNKFCAlhAnoSI8xZxk+L6S/Lkdh9Wzp8TddHM99G89jRI6YrdXo1lS6944MPeeTUQ714gF1 fq0dcHfUKlqjFM9dZnXQ+fbzyF5vrkvOVKuuyo+UJNdlWpdC0gPaWvHU/Hcl1mquJNESceYj961M jaS1+/5kXU/NqN2wX+PFiaNpMZITv/qom4qN+7NcD6E3zjbrLvNJDVgthxCRcj8Z2kqGY1ANCf3U dN17XDcEgciPIEzrGSBStie8cCh5EW302hITeSBXJ/yNCJVoG/U0QpT9kDIXh9GorLSmPVN7LGvW pfSgoIpZ5oZSTJvNGP8s23QAz3AKHUXym3DsuEhlJ4BrtvKrowaNK2ZzakXhT4qfl1NI6F4w4Cw/ hkty2DNwOgV373pfDhBQ21OdNGjg+CAbJiofrnKc3D4GuP9ym1n1cYDjMFvk6Af7yOA0Ykh3Lp9Q aHIizhFhL7/RULWT166SZqUAsXx/ysRrSUmD20l5COzpqasgKe9zIH5lFawbDxpzYifNwA/+CbHA DzzDGKytPYsngV6TQ5WD87zqM0/avKfnR9/8XMxUT0/rkvs8zH96/y6w60eoNismfIa+/9yXSiHS i6s+1fI8GA== X-Report-Abuse-To: spam@quarantine10.antispamcloud.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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