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 1jLusX-0005Xl-6x for pgsql-general@arkaria.postgresql.org; Tue, 07 Apr 2020 20:31:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jLusW-0003ly-2J for pgsql-general@arkaria.postgresql.org; Tue, 07 Apr 2020 20:31:24 +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 1jLusV-0003jj-Ov for pgsql-general@lists.postgresql.org; Tue, 07 Apr 2020 20:31:23 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jLusT-0000oJ-5E for pgsql-general@lists.postgresql.org; Tue, 07 Apr 2020 20:31:23 +0000 Received: by mail-pl1-x634.google.com with SMTP id g2so1675569plo.3 for ; Tue, 07 Apr 2020 13:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:in-reply-to:message-id:date :mime-version; bh=cin9XM2N98Mk1hsOPkHSEs3LIouBNRZRCzsJpLaMEfM=; b=njST/xb9Rxpn1LOVB7PagegdvRfKj/eZRyZsZdoY7NZIqMSn7tqjdBssOBt8+IeJ2M WOV8VPj67RZgRKpQlrS7A8gHGG1CtYJKTcTXBEYqhAX4dU3SVoL67+kdbI9bqc32sOfA NMvhgoBas95b+bWgUY4lI6HZ2caGDW8EOmBgXs80EkCWAsE+Kx2h8QLw2dWosK1vcEcT ijrjOa9Wukgh8NI386fE64zF8E3c905GMk2CMWoVZtt85yEsyLU6kWsSCCZmXWkoPl3/ 8QuDxsDiQX6+7h4cbW8L76Y7dCozHR5CLHcHOsq279X4vdeOcs6WqoEzZVQLvQXm1I0r x1Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:subject :in-reply-to:message-id:date:mime-version; bh=cin9XM2N98Mk1hsOPkHSEs3LIouBNRZRCzsJpLaMEfM=; b=lY3Tziw+EATtY6wOItexw7nzOp4QyB1SXqBHCKA7qpEDfkk3B1BdKIJ370dscJ+0xE Wjh59LahvgIkcRtKnqjv7MFMqDWSfc2MJFoBhH2OTCnfRw8oDyM5qy6pE1R0Z698Hq+p 3ufDwhiMjtImI/biI+B9cK77Nx8G4jkzHfuz3RqR2eTWVFai9bWHDJFCemuZ11alvcWe t7Odm7brSbfiCZLVZF3eCoR11y8NaY4enx/GYx7x8hAj2C7+3XpQZfcU9++M97zHu7aI IjINUg9z4dZzY9nZbnc3G+ArrVbzZ+NaqR7HQIX6jE5gqFwj+TgJSis9giuqxB4Hdtb6 OA0w== X-Gm-Message-State: AGi0PuYlQ4w2qCylbfuc75xe+WOHLNjtB4ucTHTdBtQGJtVgGkZiBtTn ymWrpz+mvw+MJhFN/9DM+IoWuSXg X-Google-Smtp-Source: APiQypJ/gF6/QDD87j22iyctCCuSnHSYy661RpBk5jinNlvgqpTpQskqPdXqHTKeI3e+poNoUMBioQ== X-Received: by 2002:a17:902:9b95:: with SMTP id y21mr4047510plp.101.1586291478547; Tue, 07 Apr 2020 13:31:18 -0700 (PDT) Received: from tim-desktop (203-173-28-185.dyn.iinet.net.au. [203.173.28.185]) by smtp.gmail.com with ESMTPSA id b11sm13385902pfr.155.2020.04.07.13.31.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 13:31:18 -0700 (PDT) References: <3fd51f3222a35e227484afae34796d3f4f667567.camel@cybertec.at> User-agent: mu4e 1.3.10; emacs 27.0.90 From: Tim Cross To: pgsql-general@lists.postgresql.org Subject: Re: Estimated resources for a 500 connections instance (VM) In-reply-to: Message-ID: <877dyr6nsd.fsf@gmail.com> Date: Wed, 08 Apr 2020 06:31:14 +1000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk David Gauthier writes: > 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) ? Based on that additional info, I would definitely follow Laurenz's suggestion. Long time since I used Perl DBI, but I'm pretty sure there is is support for connection pools or you can use one of the PG connection pooling solutions. There is a fixed memory allocation per connection, so 2 connections at 100% is not the same as 20 connections @ 10%. Using a connection pool is usually the first thing I will setup. If additional connections are still required, then I would increase the limit in small jumps - definitely would not go from 100 to 500. BTW running PG on a virtual is not an issue in itself - this is very common these days. However, I would ensure you are up-to-date wrt latest minor release for that version and would use clients with the same version as the master. -- Tim Cross